diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-01-25 21:55:17 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-01-25 21:55:17 +0000 |
commit | d6cd61061efe7207b298b5ac40a92e7b86b00b3e (patch) | |
tree | 392720e018248f9cf2b46db00a4a9740ff7d1fca /gtk | |
parent | 34bddb3c1a932632fd0515f7999ed96ef9974611 (diff) |
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/file_dlg.c | 7 | ||||
-rw-r--r-- | gtk/main.c | 9 | ||||
-rw-r--r-- | gtk/menu.c | 9 | ||||
-rw-r--r-- | gtk/rtp_analysis.c | 8 | ||||
-rw-r--r-- | gtk/tcp_graph.c | 9 |
5 files changed, 22 insertions, 20 deletions
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c index c8f6f3672c..49d816a3a0 100644 --- a/gtk/file_dlg.c +++ b/gtk/file_dlg.c @@ -1,7 +1,7 @@ /* file_dlg.c * Dialog boxes for handling files * - * $Id: file_dlg.c,v 1.83 2004/01/20 02:21:17 ulfl Exp $ + * $Id: file_dlg.c,v 1.84 2004/01/25 21:55:10 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -391,7 +391,7 @@ file_open_ok_cb(GtkWidget *w, GtkFileSelection *fs) { gtk_widget_hide(GTK_WIDGET (fs)); gtk_widget_destroy(GTK_WIDGET (fs)); - switch (cf_read(&cfile, &err)) { + switch (cf_read(&cfile)) { case READ_SUCCESS: case READ_ERROR: @@ -1010,7 +1010,6 @@ void file_reload_cmd_cb(GtkWidget *w _U_, gpointer data _U_) { gchar *filename; gboolean is_tempfile; - int err; /* If the file could be opened, "cf_open()" calls "cf_close()" to get rid of state for the old capture file before filling in state @@ -1026,7 +1025,7 @@ file_reload_cmd_cb(GtkWidget *w _U_, gpointer data _U_) { is_tempfile = cfile.is_tempfile; cfile.is_tempfile = FALSE; if (cf_open(filename, is_tempfile, &cfile) == 0) { - switch (cf_read(&cfile, &err)) { + switch (cf_read(&cfile)) { case READ_SUCCESS: case READ_ERROR: diff --git a/gtk/main.c b/gtk/main.c index 42ee6fc00b..f3ca6ee631 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.374 2004/01/25 18:51:25 ulfl Exp $ + * $Id: main.c,v 1.375 2004/01/25 21:55:10 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -585,12 +585,13 @@ get_text_from_packet_list(gpointer data) gchar *buf=NULL; int len; int err; + gchar *err_info; if (fdata != NULL) { if (!wtap_seek_read(cfile.wth, fdata->file_off, &cfile.pseudo_header, - cfile.pd, fdata->cap_len, &err)) { + cfile.pd, fdata->cap_len, &err, &err_info)) { simple_dialog(ESD_TYPE_CRIT, NULL, - file_read_error_message(err), cfile.filename); + cf_read_error_message(err, err_info), cfile.filename); return NULL; } @@ -2384,7 +2385,7 @@ main(int argc, char *argv[]) } /* Read the capture file. */ - switch (cf_read(&cfile, &err)) { + switch (cf_read(&cfile)) { case READ_SUCCESS: case READ_ERROR: diff --git a/gtk/menu.c b/gtk/menu.c index 0d9ca61f41..f0262e22b9 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.146 2004/01/23 16:10:09 ulfl Exp $ + * $Id: menu.c,v 1.147 2004/01/25 21:55:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -766,20 +766,19 @@ void menu_open_recent_file_cmd_cb(GtkWidget *w, gpointer unused _U_) { GtkWidget *submenu_recent_files; - int err; GtkWidget *menu_item_child; gchar *cf_name; - + int err; submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH); - /* get capture filename from the menu item label */ + /* get capture filename from the menu item label */ menu_item_child = (GTK_BIN(w))->child; gtk_label_get(GTK_LABEL(menu_item_child), &cf_name); /* open and read the capture file (this will close an existing file) */ if ((err = cf_open(cf_name, FALSE, &cfile)) == 0) { - cf_read(&cfile, &err); + cf_read(&cfile); } else { /* the capture file isn't existing any longer, remove menu item */ /* XXX: ask user to remove item, it's maybe only a temporary problem */ diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index b670148ed0..cdf2917f56 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -1,7 +1,7 @@ /* rtp_analysis.c * RTP analysis addition for ethereal * - * $Id: rtp_analysis.c,v 1.26 2004/01/25 02:14:05 guy Exp $ + * $Id: rtp_analysis.c,v 1.27 2004/01/25 21:55:11 guy Exp $ * * Copyright 2003, Alcatel Business Systems * By Lars Ruoff <lars.ruoff@gmx.net> @@ -2204,6 +2204,7 @@ void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_) capture_file *cf; epan_dissect_t *edt; gint err; + gchar *err_info; gboolean frame_matched; frame_data *fdata; GList *strinfo_list; @@ -2226,9 +2227,10 @@ void rtp_analysis_cb(GtkWidget *w _U_, gpointer data _U_) return; /* if we exit here it's an error */ /* dissect the current frame */ - if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header, cf->pd, fdata->cap_len, &err)) { + if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header, + cf->pd, fdata->cap_len, &err, &err_info)) { simple_dialog(ESD_TYPE_WARN | ESD_TYPE_MODAL, NULL, - file_read_error_message(err), cf->filename); + cf_read_error_message(err, err_info), cf->filename); return; } edt = epan_dissect_new(TRUE, FALSE); diff --git a/gtk/tcp_graph.c b/gtk/tcp_graph.c index f477262839..f33d91754b 100644 --- a/gtk/tcp_graph.c +++ b/gtk/tcp_graph.c @@ -3,7 +3,7 @@ * By Pavel Mores <pvl@uh.cz> * Win32 port: rwh@unifiedtech.com * - * $Id: tcp_graph.c,v 1.46 2004/01/21 21:19:34 ulfl Exp $ + * $Id: tcp_graph.c,v 1.47 2004/01/25 21:55:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1783,6 +1783,7 @@ static void graph_segment_list_get (struct graph *g) struct segment current; int condition; int err; + gchar *err_info; debug(DBS_FENTRY) puts ("graph_segment_list_get()"); get_headers (cfile.current_frame, cfile.pd, ¤t); @@ -1793,10 +1794,10 @@ static void graph_segment_list_get (struct graph *g) for (ptr=cfile.plist; ptr; ptr=ptr->next) { if (!wtap_seek_read (cfile.wth, ptr->file_off, &pseudo_header, - pd, ptr->cap_len, &err)) { + pd, ptr->cap_len, &err, &err_info)) { simple_dialog(ESD_TYPE_CRIT, NULL, - file_read_error_message(err), - cfile.filename); + cf_read_error_message(err, err_info), + cfile.filename); break; } if (!segment) |