aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/capture_file_dlg.c35
-rw-r--r--ui/gtk/iax2_analysis.c2
-rw-r--r--ui/gtk/main.c4
-rw-r--r--ui/gtk/packet_list_store.c2
-rw-r--r--ui/gtk/packet_win.c2
-rw-r--r--ui/gtk/rlc_lte_graph.c2
-rw-r--r--ui/gtk/rtp_analysis.c2
-rw-r--r--ui/gtk/sctp_assoc_analyse.c2
-rw-r--r--ui/qt/capture_file_dialog.cpp35
-rw-r--r--ui/qt/packet_list.cpp2
-rw-r--r--ui/qt/packet_list_model.cpp2
-rw-r--r--ui/tap-tcp-stream.c2
-rw-r--r--ui/win32/file_dlg_win32.c41
13 files changed, 74 insertions, 59 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index baef2baed9..74f35d6748 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -173,6 +173,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
static void
preview_do(GtkWidget *prev, wtap *wth)
{
+ int rec_type;
GtkWidget *label;
unsigned int elapsed_time;
time_t time_preview;
@@ -183,6 +184,7 @@ preview_do(GtkWidget *prev, wtap *wth)
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;
gboolean is_breaked = FALSE;
gchar string_buff[PREVIEW_STR_MAX];
@@ -192,22 +194,25 @@ preview_do(GtkWidget *prev, wtap *wth)
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/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c
index 6f7fe77c73..d756b3a58b 100644
--- a/ui/gtk/iax2_analysis.c
+++ b/ui/gtk/iax2_analysis.c
@@ -3711,7 +3711,7 @@ void iax2_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
return; /* if we exit here it's an error */
/* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
+ if (cf_read_frame(cf, fdata) == -1)
return; /* error reading the frame */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index e49e0531a0..a3140b18e1 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -543,7 +543,7 @@ get_ip_address_list_from_packet_list_row(gpointer data)
if (fdata != NULL) {
epan_dissect_t edt;
- if (!cf_read_frame (&cfile, fdata))
+ if (cf_read_frame (&cfile, fdata) == -1)
return NULL; /* error reading the frame */
epan_dissect_init(&edt, cfile.epan, FALSE, FALSE);
@@ -584,7 +584,7 @@ get_filter_from_packet_list_row_and_column(gpointer data)
if (fdata != NULL) {
epan_dissect_t edt;
- if (!cf_read_frame(&cfile, fdata))
+ if (cf_read_frame(&cfile, fdata) == -1)
return NULL; /* error reading the frame */
/* proto tree, visible. We need a proto tree if there's custom columns */
epan_dissect_init(&edt, cfile.epan, have_custom_cols(&cfile.cinfo), FALSE);
diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c
index dd904b58be..efb8e44ea1 100644
--- a/ui/gtk/packet_list_store.c
+++ b/ui/gtk/packet_list_store.c
@@ -1117,7 +1117,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
cinfo = NULL;
buffer_init(&buf, 1500);
- if (!cf_read_frame_r(&cfile, fdata, &phdr, &buf)) {
+ if (cf_read_frame_r(&cfile, fdata, &phdr, &buf) == -1) {
/*
* Error reading the frame.
*
diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c
index c25d62b48a..67fb5fddd2 100644
--- a/ui/gtk/packet_win.c
+++ b/ui/gtk/packet_win.c
@@ -961,7 +961,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
}
/* With the new packetlists "lazy columns" it's necessary to reread the frame */
- if (!cf_read_frame(&cfile, fd)) {
+ if (cf_read_frame(&cfile, fd) == -1) {
/* error reading the frame */
return;
}
diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c
index aeb5b9996b..eb9e2635f1 100644
--- a/ui/gtk/rlc_lte_graph.c
+++ b/ui/gtk/rlc_lte_graph.c
@@ -903,7 +903,7 @@ static rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf, struct segment
}
/* dissect the current frame */
- if (!cf_read_frame(cf, fdata)) {
+ if (cf_read_frame(cf, fdata) == -1) {
return NULL; /* error reading the frame */
}
diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c
index 0305b0a26a..66c2406658 100644
--- a/ui/gtk/rtp_analysis.c
+++ b/ui/gtk/rtp_analysis.c
@@ -3946,7 +3946,7 @@ rtp_analysis_cb(GtkAction *action _U_, gpointer user_data _U_)
return; /* if we exit here it's an error */
/* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
+ if (cf_read_frame(cf, fdata) == -1)
return; /* error reading the frame */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
epan_dissect_prime_dfilter(&edt, sfcode);
diff --git a/ui/gtk/sctp_assoc_analyse.c b/ui/gtk/sctp_assoc_analyse.c
index 2b751f7135..927be97b0e 100644
--- a/ui/gtk/sctp_assoc_analyse.c
+++ b/ui/gtk/sctp_assoc_analyse.c
@@ -975,7 +975,7 @@ sctp_analyse_cb(struct sctp_analyse *u_data, gboolean ext)
return; /* if we exit here it's an error */
/* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
+ if (cf_read_frame(cf, fdata) == -1)
return; /* error reading the frame */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);
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.
*
diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c
index 9dd1e46381..8ba41c22cc 100644
--- a/ui/tap-tcp-stream.c
+++ b/ui/tap-tcp-stream.c
@@ -305,7 +305,7 @@ select_tcpip_session(capture_file *cf, struct segment *hdrs)
}
/* dissect the current frame */
- if (!cf_read_frame(cf, fdata))
+ if (cf_read_frame(cf, fdata) == -1)
return NULL; /* error reading the frame */
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index a65aaf4d0f..47cf06cd4c 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -1119,8 +1119,10 @@ 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 packet = 0;
+ guint records = 0;
+ guint packets = 0;
gint64 filesize;
time_t ti_time;
struct tm *ti_tm;
@@ -1186,21 +1188,24 @@ preview_set_file_info(HWND of_hwnd, gchar *preview_file) {
SetWindowText(cur_ctrl, string_buff);
time(&time_preview);
- 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;
+ 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++;
}
- packet++;
- if(packet%100 == 0) {
+ records++;
+ if(records%100 == 0) {
time(&time_current);
if(time_current-time_preview >= (time_t) prefs.gui_fileopen_preview) {
is_breaked = TRUE;
@@ -1210,7 +1215,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"), packet);
+ StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("error after reading %u packets"), packets);
cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_PACKETS);
SetWindowText(cur_ctrl, string_buff);
wtap_close(wth);
@@ -1219,9 +1224,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)"), packet);
+ StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("more than %u packets (preview timeout)"), packets);
} else {
- StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%u"), packet);
+ StringCchPrintf(string_buff, PREVIEW_STR_MAX, _T("%u"), packets);
}
cur_ctrl = GetDlgItem(of_hwnd, EWFD_PTX_PACKETS);
SetWindowText(cur_ctrl, string_buff);