aboutsummaryrefslogtreecommitdiffstats
path: root/ui/win32
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-01-22 11:37:33 +0000
committerGuy Harris <guy@alum.mit.edu>2012-01-22 11:37:33 +0000
commit340d882fba1ebe5af26ccf6e00494307c16e20ac (patch)
treed92296b7ae749c3a97eb6c6166eb42c5c99b32ae /ui/win32
parentc585d8de24fe85f19e10231cd08914576f6c28ba (diff)
All valid file types should have file type strings (and, currently, they
all do); get rid of the test for a null return from wtap_file_type_string().) If wtap_get_file_extensions_list() returns NULL, include the file type in the list of filters, and use "*.*" as the filter. That way the list of filters will include all file types, even if you can't really ask only for files of that type (actually, you can't really ask only for files of *any* type unless you're running under a desktop environment where file types are specified by, for example, looking for magic numbers, as there's no guarantee that, for example, a pcap file will have an extension at all, given that it might come from a command-line tool that doesn't default to any extension). svn path=/trunk/; revision=40650
Diffstat (limited to 'ui/win32')
-rw-r--r--ui/win32/file_dlg_win32.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 06d4bd7980..dfc6c8e1c3 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -1471,21 +1471,27 @@ build_file_type_list(gboolean save, int *item_to_select) {
}
/* OK, we can write it out in this type. */
- if(wtap_file_type_string(ft) == NULL)
- continue;
extensions_list = wtap_get_file_extensions_list(ft);
- if (extensions_list == NULL)
- continue;
-
- /* Construct the list of patterns. */
- g_string_printf(pattern_str, "");
- sep = '\0';
- for (extension = extensions_list; extension != NULL;
- extension = g_slist_next(extension)) {
- if (sep != '\0')
- g_string_append_c(pattern_str, sep);
- g_string_append_printf(pattern_str, "*.%s", (char *)extension->data);
- sep = ';';
+ if (extensions_list == NULL) {
+ /* This file type doesn't have any particular extension
+ conventionally used for it, so we'll just use "*.*"
+ as the pattern; on Windows, that matches all file names
+ - even those with no extension - so we don't need to
+ worry about compressed file extensions. (It does not
+ do so on UN*X; the right pattern on UN*X would just
+ be "*".) */
+ g_string_printf(pattern_str, "*.*");
+ } else {
+ /* Construct the list of patterns. */
+ g_string_printf(pattern_str, "");
+ sep = '\0';
+ for (extension = extensions_list; extension != NULL;
+ extension = g_slist_next(extension)) {
+ if (sep != '\0')
+ g_string_append_c(pattern_str, sep);
+ g_string_append_printf(pattern_str, "*.%s", (char *)extension->data);
+ sep = ';';
+ }
}
/* Construct the description. */