Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at visual.c:533

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

visual_seek_read

(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/visual.c)expand/collapse
Show more  
 480  static gboolean visual_seek_read (wtap *wth, gint64 seek_off,
 481      union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
 482      int *err, gchar **err_info _U_)
 483  {
 484      struct visual_pkt_hdr vpkt_hdr;
 485      struct visual_atm_hdr vatm_hdr;
 486      int phdr_size = sizeof(vpkt_hdr);
 487      int ahdr_size = sizeof(vatm_hdr);
 488      int bytes_read;
 489      int header_size;
 490   
 491      /* Get the size of the visual packet header to skip */
 492      header_size = sizeof(struct visual_pkt_hdr);
 493   
 494      /* If ATM capture, need to skip over visual ATM packet header too */
 495      if (wth->file_encap == WTAP_ENCAP_ATM_PDUS)
 496      {
 497         header_size += (int)sizeof(struct visual_atm_hdr);
 498      }
 499       
 500      /* Seek to the packet header */
 501      if (file_seek(wth->random_fh, seek_off - header_size,
 502                    SEEK_SET, err) == -1)
 503          return FALSE;
 504   
 505      /* Read the packet header to get the status flags. */
 506      errno = WTAP_ERR_CANT_READ;
 507      bytes_read = file_read(&vpkt_hdr, 1, phdr_size, wth->random_fh);
 508      if (bytes_read != phdr_size) {
 509          *err = file_error(wth->random_fh);
 510          if (*err == 0)
 511              *err = WTAP_ERR_SHORT_READ;
 512          return FALSE;
 513      }
 514       
 515      /* Check for additional ATM packet header */
 516      if (wth->file_encap == WTAP_ENCAP_ATM_PDUS)
 517      {
 518         /* Read the atm packet header */
 519         errno = WTAP_ERR_CANT_READ;
 520         bytes_read = file_read(&vatm_hdr, 1, ahdr_size, wth->random_fh);
 521         if (bytes_read != ahdr_size)
 522         {
 523             *err = file_error(wth->fh);
 524             if (*err == 0 && bytes_read != 0)
 525             {
 526                 *err = WTAP_ERR_SHORT_READ;
 527             }
 528             return FALSE;
 529         }
 530      }
 531   
 532      /* Read the packet data. */
 533      errno = WTAP_ERR_CANT_READ;
 534      bytes_read = file_read(pd, sizeof(guint8), len, wth->random_fh);
 535      if (bytes_read != len) {
 536          if (*err == 0)
 537              *err = WTAP_ERR_SHORT_READ;
 538          return FALSE;
 539      }
 540   
 541      /* Set the pseudo_header. */
 542      visual_set_pseudo_header(wth->file_encap, &vpkt_hdr, &vatm_hdr, pseudo_header);
 543   
 544      return TRUE;
 545  }
Show more  




Change Warning 1061.29856 : Useless Assignment

Because they are very similar, this warning shares annotations with warning 1061.29857.

Priority:
State:
Finding:
Owner:
Note: