diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-01-23 21:57:45 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-01-23 21:57:45 +0000 |
commit | bb98263aa4f10258e01e0edf68846965242d0bd4 (patch) | |
tree | 6943b1996eb8a66304d394161d57a4947be0057c | |
parent | 4e30aece3a3c90d21ca1364a9d0ca150eef6784c (diff) |
Have wtap_file_extension_default_string() return the extension in the
sense of "what follows the last . in the file name", i.e. not including
the ".".
svn path=/trunk/; revision=40674
-rw-r--r-- | ui/win32/file_dlg_win32.c | 2 | ||||
-rw-r--r-- | wiretap/file_access.c | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index dfc6c8e1c3..34182ff8f7 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -323,7 +323,7 @@ win32_save_as_file(HWND h_wnd, action_after_save_e action_after_save, gpointer a file_last_dot = strrchr(file_name8->str,'.'); if(file_last_dot == NULL || strlen(file_name8->str)-(file_last_dot-file_name8->str) > 5+1) { if(wtap_file_extension_default_string(filetype) != NULL) { - file_name8 = g_string_append(file_name8, wtap_file_extension_default_string(filetype)); + file_name8 = g_string_append_printf(file_name8, ".%s", wtap_file_extension_default_string(filetype)); } } diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 3e876aa7aa..92b31b572a 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -794,13 +794,18 @@ void wtap_free_file_extensions_list(GSList *extensions) g_slist_free(extensions); } -/* Return the default file extension to use with the specified file type. */ +/* Return the default file extension to use with the specified file type; + that's just the extension, without any ".". */ const char *wtap_file_extension_default_string(int filetype) { if (filetype < 0 || filetype >= wtap_num_file_types) return NULL; - else - return dump_open_table[filetype].file_extension_default; + else { + /* + * XXX - skip past the ".". + */ + return dump_open_table[filetype].file_extension_default + 1; + } } gboolean wtap_dump_can_open(int filetype) |