diff options
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 35 | ||||
-rw-r--r-- | ui/qt/packet_list.cpp | 2 | ||||
-rw-r--r-- | ui/qt/packet_list_model.cpp | 2 |
3 files changed, 22 insertions, 17 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index 03d4892411..3e123dc34b 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -736,11 +736,13 @@ 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; @@ -792,22 +794,25 @@ void CaptureFileDialog::preview(const QString & path) preview_size_.setText(QString(tr("%1 bytes")).arg(wtap_file_size(wth, &err))); time(&time_preview); - 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; - } - if (cur_time < start_time) { - start_time = cur_time; - } - if (cur_time > stop_time){ - stop_time = cur_time; - } + 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++; - if(packets%1000 == 0) { + packets++; + } + records++; + if(records%1000 == 0) { /* do we have a timeout? */ time(&time_current); if(time_current-time_preview >= (time_t) prefs.gui_fileopen_preview) { diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index 7e9ff94132..2388c6b380 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -655,7 +655,7 @@ QString &PacketList::getFilterFromRowAndColumn() if (fdata != NULL) { epan_dissect_t edt; - if (!cf_read_frame(cap_file_, fdata)) + if (cf_read_frame(cap_file_, fdata) == -1) return filter; /* error reading the frame */ /* proto tree, visible. We need a proto tree if there's custom columns */ epan_dissect_init(&edt, cap_file_->epan, have_custom_cols(&cap_file_->cinfo), FALSE); diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index a6b68f51bd..805da14c8f 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -221,7 +221,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const memset(&phdr, 0, sizeof(struct wtap_pkthdr)); buffer_init(&buf, 1500); - if (!cap_file_ || !cf_read_frame_r(cap_file_, fdata, &phdr, &buf)) { + if (!cap_file_ || cf_read_frame_r(cap_file_, fdata, &phdr, &buf) == -1) { /* * Error reading the frame. * |