From b1ecd8d217502b6223ffed2ea0d0edabb5a9f81f Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 1 Apr 2013 21:17:50 +0000 Subject: Add a wtap_dump_can_write() routine that indicates whether Wiretap supports writing files with a given set of encapsulations and comment types. Use it, rather than asking for a list of file formats that support the given set of encapsulation and comment types and checking whether we got back such a list, or duplicating its logic. Having file.c use it means that nobody's using wtap_dump_can_write_encaps() any more; get rid of it. Instead, have a private routine that checks whether a given file format supports a given set of encapsulations *and* comment types, and use that internally. svn path=/trunk/; revision=48690 --- ui/gtk/capture_file_dlg.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'ui/gtk/capture_file_dlg.c') diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index 573057d6d8..cabbd712e3 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -1291,7 +1291,6 @@ static check_savability_t check_save_with_comments(capture_file *cf) { guint32 comment_types; - GArray *savable_file_types; GtkWidget *msg_dialog; gint response; @@ -1307,11 +1306,7 @@ check_save_with_comments(capture_file *cf) /* No. Are there formats in which we can write this file that supports all the comments in this file? */ - savable_file_types = wtap_get_savable_file_types(cf->cd_t, cf->linktypes, - comment_types); - if (savable_file_types != NULL) { - g_array_free(savable_file_types, TRUE); - + if (wtap_dump_can_write(cf->linktypes, comment_types)) { /* Yes. Offer the user a choice of "Save in a format that supports comments", "Discard comments and save in the file's own format", or "Cancel", meaning "don't bother @@ -1577,7 +1572,6 @@ static check_savability_t gtk_check_save_as_with_comments(GtkWidget *w, capture_file *cf, int file_type) { guint32 comment_types; - GArray *savable_file_types; GtkWidget *msg_dialog; gint response; @@ -1593,11 +1587,7 @@ gtk_check_save_as_with_comments(GtkWidget *w, capture_file *cf, int file_type) /* No. Are there formats in which we can write this file that supports all the comments in this file? */ - savable_file_types = wtap_get_savable_file_types(file_type, cf->linktypes, - comment_types); - if (savable_file_types != NULL) { - g_array_free(savable_file_types, TRUE); - + if (wtap_dump_can_write(cf->linktypes, comment_types)) { /* Yes. Offer the user a choice of "Save in a format that supports comments", "Discard comments and save in the format you selected", or "Cancel", meaning "don't bother -- cgit v1.2.3