diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-10-16 23:32:24 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-10-16 23:32:24 +0000 |
commit | 727ad67453a879a58ab46adeee058d2acbbe5c13 (patch) | |
tree | 9fe0f60bac0ddcee9a3c48d3ff0ca8003b3ca707 /gtk/file_dlg.c | |
parent | de1bcd5d88f4ecd85df770ef5a7a0357b539ee4f (diff) | |
download | wireshark-727ad67453a879a58ab46adeee058d2acbbe5c13.tar.gz wireshark-727ad67453a879a58ab46adeee058d2acbbe5c13.tar.bz2 wireshark-727ad67453a879a58ab46adeee058d2acbbe5c13.zip |
Remove the fixed maximum number of subranges in a range_t; dynamically
allocate them to be large enough.
Add checks that the numbers in the range fit in a guint32.
Check the validity of a range before saving or printing, and report
errors in an alert box.
Clean up white space.
svn path=/trunk/; revision=12320
Diffstat (limited to 'gtk/file_dlg.c')
-rw-r--r-- | gtk/file_dlg.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c index 565754d722..535e84e9fc 100644 --- a/gtk/file_dlg.c +++ b/gtk/file_dlg.c @@ -1385,6 +1385,24 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) { return; } + /* Check whether the range is valid. */ + if (!range_check_validity(&range)) { + /* The range isn't valid; don't dismiss the open dialog box, + just leave it around so that the user can, after they + dismiss the alert box popped up for the error, try again. */ + g_free(cf_name); +#if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2 + /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), + * as this will prevent the user from closing the now existing error + * message, simply close the dialog (this is the best we can do here). */ + if (file_save_as_w) + window_destroy(GTK_WIDGET (fs)); +#else + gtk_widget_show(GTK_WIDGET (fs)); +#endif + return; + } + /* don't show the dialog while saving */ gtk_widget_hide(GTK_WIDGET (fs)); @@ -1396,9 +1414,9 @@ file_save_as_ok_cb(GtkWidget *w _U_, gpointer fs) { dismiss the alert box popped up for the error, try again. */ g_free(cf_name); #if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 4) || GTK_MAJOR_VERSION > 2 - /* as we cannot start a new event loop (using gtk_dialog_run()), as this - * will prevent the user from closing the now existing error message, - * simply close the dialog (this is the best we can do here). */ + /* XXX - as we cannot start a new event loop (using gtk_dialog_run()), + * as this will prevent the user from closing the now existing error + * message, simply close the dialog (this is the best we can do here). */ if (file_save_as_w) window_destroy(GTK_WIDGET (fs)); #else |