aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk
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/gtk
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/gtk')
-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
8 files changed, 23 insertions, 28 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index 74f35d6748..baef2baed9 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -173,7 +173,6 @@ 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;
@@ -184,7 +183,6 @@ 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];
@@ -194,25 +192,22 @@ preview_do(GtkWidget *prev, wtap *wth)
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) {
diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c
index d756b3a58b..6f7fe77c73 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) == -1)
+ if (!cf_read_frame(cf, fdata))
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 a3140b18e1..e49e0531a0 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) == -1)
+ if (!cf_read_frame (&cfile, fdata))
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) == -1)
+ if (!cf_read_frame(&cfile, fdata))
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 efb8e44ea1..dd904b58be 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) == -1) {
+ if (!cf_read_frame_r(&cfile, fdata, &phdr, &buf)) {
/*
* Error reading the frame.
*
diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c
index 67fb5fddd2..c25d62b48a 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) == -1) {
+ if (!cf_read_frame(&cfile, fd)) {
/* error reading the frame */
return;
}
diff --git a/ui/gtk/rlc_lte_graph.c b/ui/gtk/rlc_lte_graph.c
index eb9e2635f1..aeb5b9996b 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) == -1) {
+ if (!cf_read_frame(cf, fdata)) {
return NULL; /* error reading the frame */
}
diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c
index 66c2406658..0305b0a26a 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) == -1)
+ if (!cf_read_frame(cf, fdata))
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 927be97b0e..2b751f7135 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) == -1)
+ if (!cf_read_frame(cf, fdata))
return; /* error reading the frame */
epan_dissect_init(&edt, cf->epan, TRUE, FALSE);