summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-04-01 21:17:50 +0000
committerGuy Harris <guy@alum.mit.edu>2013-04-01 21:17:50 +0000
commitb1ecd8d217502b6223ffed2ea0d0edabb5a9f81f (patch)
tree26c9b757d7e493fc8a2bc455062bdae3db75df34 /ui
parent82a602d697b03314a11b3fd914dc7173fe18b293 (diff)
downloadwireshark-b1ecd8d217502b6223ffed2ea0d0edabb5a9f81f.tar.gz
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
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/capture_file_dlg.c14
-rw-r--r--ui/qt/capture_file_dialog.cpp7
-rw-r--r--ui/win32/file_dlg_win32.c7
3 files changed, 4 insertions, 24 deletions
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
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 2e2a992263..a62d0ad9c3 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -136,7 +136,6 @@ check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *
return win32_check_save_as_with_comments(parent->effectiveWinId(), cf, file_type);
#else // Q_WS_WIN
guint32 comment_types;
- GArray *savable_file_types;
QMessageBox msg_dialog;
int response;
@@ -152,11 +151,7 @@ check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *
/* 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)) {
QPushButton *default_button;
/* Yes. Offer the user a choice of "Save in a format that
supports comments", "Discard comments and save in the
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index e1fcb8c3f6..08e718c0fa 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -238,7 +238,6 @@ check_savability_t
win32_check_save_as_with_comments(HWND parent, capture_file *cf, int file_type)
{
guint32 comment_types;
- GArray *savable_file_types;
gint response;
/* What types of comments do we have? */
@@ -253,11 +252,7 @@ win32_check_save_as_with_comments(HWND parent, 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(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
format you selected", or "Cancel", meaning "don't bother