Text   |  XML   |  ReML   |   Visible Warnings:

Format String  at file.c:1887

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

process_specified_packets

(/home/sate/Testcases/c/cve/wireshark-1.2.0/file.c)expand/collapse
Show more  
 1788  process_specified_packets(capture_file *cf, packet_range_t *range,
 1789      const char *string1, const char *string2, gboolean terminate_is_stop,
 1790      gboolean (*callback)(capture_file *, frame_data *,
 1791                           union wtap_pseudo_header *, const guint8 *, void *),
 1792      void *callback_args)
 1793  {
 1794    frame_data *fdata;
 1795    int         err;
 1796    gchar      *err_info;
 1797    union wtap_pseudo_header pseudo_header;
 1798    guint8      pd[WTAP_MAX_PACKET_SIZE+1];
 1799    psp_return_t ret = PSP_FINISHED;
 1800   
 1801    progdlg_t  *progbar = NULL;
 1802    int         progbar_count;
 1803    float       progbar_val;
 1804    gboolean    progbar_stop_flag;
 1805    GTimeVal    progbar_start_time;
 1806    gchar       progbar_status_str[100];
 1807    int         progbar_nextstep;
 1808    int         progbar_quantum;
 1809    range_process_e process_this;
 1810   
 1811    /* Update the progress bar when it gets to this value. */
 1812    progbar_nextstep = 0;
 1813    /* When we reach the value that triggers a progress bar update,
 1814       bump that value by this amount. */
 1815    progbar_quantum = cf->count/N_PROGBAR_UPDATES;
 1816    /* Count of packets at which we've looked. */
 1817    progbar_count = 0;
 1818    /* Progress so far. */
 1819    progbar_val = 0.0f;
 1820   
 1821    progbar_stop_flag = FALSE;
 1822    g_get_current_time(&progbar_start_time);
 1823   
 1824    packet_range_process_init(range);
 1825   
 1826    /* Iterate through the list of packets, printing the packets that
 1827       were selected by the current display filter.  */
 1828    for (fdata = cf->plist; fdata != NULL; fdata = fdata->next) {
 1829      /* Create the progress bar if necessary.
 1830         We check on every iteration of the loop, so that it takes no 
 1831         longer than the standard time to create it (otherwise, for a
 1832         large file, we might take considerably longer than that standard
 1833         time in order to get to the next progress bar step). */
 1834      if (progbar == NULL)
 1835        progbar = delayed_create_progress_dlg(string1, string2,
 1836                                              terminate_is_stop,
 1837                                              &progbar_stop_flag,
 1838                                              &progbar_start_time,
 1839                                              progbar_val);
 1840   
 1841      /* Update the progress bar, but do it only N_PROGBAR_UPDATES times;
 1842         when we update it, we have to run the GTK+ main loop to get it 
 1843         to repaint what's pending, and doing so may involve an "ioctl()"
 1844         to see if there's any pending input from an X server, and doing
 1845         that for every packet can be costly, especially on a big file. */
 1846      if (progbar_count >= progbar_nextstep) {
 1847        /* let's not divide by zero. I should never be started 
 1848         * with count == 0, so let's assert that
 1849         */
 1850        g_assert(cf->count > 0);
 1851        progbar_val = (gfloat) progbar_count / cf->count;
 1852   
 1853        if (progbar != NULL) {
 1854          g_snprintf(progbar_status_str, sizeof(progbar_status_str),
 1855                     "%4u of %u packets", progbar_count, cf->count);
 1856          update_progress_dlg(progbar, progbar_val, progbar_status_str);
 1857        }
 1858   
 1859        progbar_nextstep += progbar_quantum;
 1860      }
 1861   
 1862      if (progbar_stop_flag) {
 1863        /* Well, the user decided to abort the operation.  Just stop,
 1864           and arrange to return PSP_STOPPED to our caller, so they know 
 1865           it was stopped explicitly. */
 1866        ret = PSP_STOPPED;
 1867        break;
 1868      }
 1869   
 1870      progbar_count++;
 1871   
 1872      /* do we have to process this packet? */
 1873      process_this = packet_range_process_packet(range, fdata);
 1874      if (process_this == range_process_next) {
 1875          /* this packet uninteresting, continue with next one */
 1876          continue;
 1877      } else if (process_this == range_processing_finished) {
 1878          /* all interesting packets processed, stop the loop */
 1879          break;
 1880      }
 1881   
 1882      /* Get the packet */
 1883      if (!wtap_seek_read(cf->wth, fdata->file_off, &pseudo_header,
 1884                          pd, fdata->cap_len, &err, &err_info)) {
 1885        /* Attempt to get the packet failed. */
 1886        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 1887                      cf_read_error_message(err, err_info), cf->filename);
 1888        ret = PSP_FAILED;
 1889        break;
 1890      }
 1891      /* Process the packet */
 1892      if (!callback(cf, fdata, &pseudo_header, pd, callback_args)) {
 1893        /* Callback failed.  We assume it reported the error appropriately. */
 1894        ret = PSP_FAILED;
 1895        break;
 1896      }
 1897    }
 1898   
 1899    /* We're done printing the packets; destroy the progress bar if 
 1900       it was created. */
 1901    if (progbar != NULL)
 1902      destroy_progress_dlg(progbar);
 1903   
 1904    return ret;
 1905  }
Show more  




Change Warning 5597.35909 : Format String

Priority:
State:
Finding:
Owner:
Note: