aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/capture_file_dialog.cpp
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-05-23 10:50:02 +0000
committerGuy Harris <guy@alum.mit.edu>2014-05-23 10:50:10 +0000
commita344c9736efe5519543da1290e1ad9065d0b0cff (patch)
tree7757d80d74ae710e5d4e4a1b0cb638d0ec644fc4 /ui/qt/capture_file_dialog.cpp
parent716fdc8e398ea7435b23192ab1f7d59e7b21e32b (diff)
Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/capture_file_dialog.cpp')
-rw-r--r--ui/qt/capture_file_dialog.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 3e123dc34b..03d4892411 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -736,13 +736,11 @@ void CaptureFileDialog::preview(const QString & path)
wtap *wth;
int err = 0;
gchar *err_info;
- int rec_type;
gint64 data_offset;
const struct wtap_pkthdr *phdr;
double start_time = 0; /* seconds, with nsec resolution */
double stop_time = 0; /* seconds, with nsec resolution */
double cur_time;
- unsigned int records = 0;
unsigned int packets = 0;
bool timed_out = FALSE;
time_t time_preview;
@@ -794,25 +792,22 @@ void CaptureFileDialog::preview(const QString & path)
preview_size_.setText(QString(tr("%1 bytes")).arg(wtap_file_size(wth, &err)));
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(&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(&phdr->ts);
+ if(packets == 0) {
+ start_time = cur_time;
+ stop_time = cur_time;
}
- records++;
- if(records%1000 == 0) {
+ if (cur_time < start_time) {
+ start_time = cur_time;
+ }
+ if (cur_time > stop_time){
+ stop_time = cur_time;
+ }
+
+ packets++;
+ if(packets%1000 == 0) {
/* do we have a timeout? */
time(&time_current);
if(time_current-time_preview >= (time_t) prefs.gui_fileopen_preview) {