Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at pcapio.c:499

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

libpcap_write_interface_statistics_block

(/home/sate/Testcases/c/cve/wireshark-1.2.0/pcapio.c)expand/collapse
Show more  
 418  libpcap_write_interface_statistics_block(FILE *fp,
 419                                           guint32 interface_id,
 420                                           pcap_t *pd,
 421                                           long *bytes_written,
 422                                           int *err)
 423  {
 424          struct isb isb;
 425  #ifdef _WIN32 
 426          FILETIME now;
 427  #else
 428          struct timeval now;
 429  #endif
 430          struct option option;
 431          struct pcap_stat stats;
 432          guint32 block_total_length;
 433
454
Show [ Lines 433 to 454 omitted. ]
 455          /*
 456           * Subtract difference, in microseconds, between January 1, 1601 
 457           * 00:00:00 UTC and January 1, 1970, 00:00:00 UTC.
 458           */
 459          timestamp -= G_GINT64_CONSTANT(11644473600000000U);
 460  #else
 461          /*
 462           * Current time, represented as seconds and microseconds since
 463           * January 1, 1970, 00:00:00 UTC.
 464           */
 465          gettimeofday(&now, NULL);
 466   
 467          /*
 468           * Convert to delta in microseconds.
 469           */
 470          timestamp = (guint64)(now.tv_sec) * 1000000 +
 471                      (guint64)(now.tv_usec);
 472  #endif
 473          if (pcap_stats(pd, &stats) < 0) {
 474                  stats_retrieved = FALSE;
 475                  g_warning("pcap_stats() failed.");
 476          } else {
 477                  stats_retrieved = TRUE;
 478          }
 479          block_total_length = sizeof(struct isb) +
 480                               sizeof(guint32);
 481          if (stats_retrieved) {
 482                  block_total_length += 3 * sizeof(struct option) + 2 * sizeof(guint64);
 483          }
 484          isb.block_type = INTERFACE_STATISTICS_BLOCK_TYPE;
 485          isb.block_total_length = block_total_length;
 486          isb.interface_id = interface_id;
 487          isb.timestamp_high = (guint32)((timestamp>>32) & 0xffffffff);
 488          isb.timestamp_low = (guint32)(timestamp & 0xffffffff);
 489          WRITE_DATA(fp, &isb, sizeof(struct isb), *bytes_written, err);
 490          if (stats_retrieved) {
 491                  /* */
 492                  option.type = ISB_IFRECV;
 493                  option.value_length = sizeof(guint64);
 494                  counter = stats.ps_recv;
 495                  WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
 496                  WRITE_DATA(fp, &counter, sizeof(guint64), *bytes_written, err);
 497                  /* */
 498                  option.type = ISB_IFDROP;
 499                  option.value_length = sizeof(guint64);
 500                  counter = stats.ps_drop;
 501                  WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
 502                  WRITE_DATA(fp, &counter, sizeof(guint64), *bytes_written, err);
 503                  /* last option */
 504                  option.type = OPT_ENDOFOPT;
 505                  option.value_length = 0;
 506                  WRITE_DATA(fp, &option, sizeof(struct option), *bytes_written, err);
 507          }
 508          WRITE_DATA(fp, &block_total_length, sizeof(guint32), *bytes_written, err);
 509           
 510          return TRUE;
 511  }
Show more  




Change Warning 5025.29785 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: