diff options
Diffstat (limited to 'ui/win32/file_dlg_win32.c')
-rw-r--r-- | ui/win32/file_dlg_win32.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index 47cf06cd4c..a65aaf4d0f 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -1119,10 +1119,8 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) { int err = 0; gchar *err_info; TCHAR string_buff[PREVIEW_STR_MAX]; - int rec_type; gint64 data_offset; - guint records = 0; - guint packets = 0; + guint packet = 0; gint64 filesize; time_t ti_time; struct tm *ti_tm; @@ -1188,24 +1186,21 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) { SetWindowText(cur_ctrl, string_buff); time(&time_preview); - while ( (rec_type = wtap_read(wth, &err, &err_info, &data_offset)) != -1 ) { - if (rec_type == REC_TYPE_PACKET) { - phdr = wtap_phdr(wth); - cur_time = nstime_to_sec( (const nstime_t *) &phdr->ts ); - if(packets == 0) { - start_time = cur_time; - stop_time = cur_time; - } - if (cur_time < start_time) { - start_time = cur_time; - } - if (cur_time > stop_time){ - stop_time = cur_time; - } - packets++; + while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) { + phdr = wtap_phdr(wth); + cur_time = nstime_to_sec( (const nstime_t *) &phdr->ts ); + if(packet == 0) { + start_time = cur_time; + stop_time = cur_time; + } + if (cur_time < start_time) { + start_time = cur_time; + } + if (cur_time > stop_time){ + stop_time = cur_time; } - records++; - if(records%100 == 0) { + packet++; + if(packet%100 == 0) { time(&time_current); if(time_current-time_preview >= (time_t) prefs.gui_fileopen_preview) { is_breaked = TRUE; @@ -1215,7 +1210,7 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) { } if(err != 0) { - StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("error after reading %u packets"), packets); + StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("error after reading %u packets"), packet); cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_PACKETS); SetWindowText(cur_ctrl, string_buff); wtap_close(wth); @@ -1224,9 +1219,9 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) { /* Packets */ if(is_breaked) { - StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("more than %u packets (preview timeout)"), packets); + StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("more than %u packets (preview timeout)"), packet); } else { - StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%u"), packets); + StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%u"), packet); } cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_PACKETS); SetWindowText(cur_ctrl, string_buff); |