Have wtap_file_extension_default_string() return the extension in the
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Jan 2012 21:57:45 +0000 (21:57 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Jan 2012 21:57:45 +0000 (21:57 +0000)
sense of "what follows the last . in the file name", i.e. not including
the ".".

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40674 f5534014-38df-0310-8fa8-9805f1628bb7

ui/win32/file_dlg_win32.c
wiretap/file_access.c

index dfc6c8e1c3b3b26479eb9f61cf707c5b45a9d3a4..34182ff8f747deceab6f82d697c8149f43ec465d 100644 (file)
@@ -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));
             }
         }
 
index 3e876aa7aa3733ba56f65387bfaacaa953a31f06..92b31b572a21e1a9db9b6cc3b67939e669563022 100644 (file)
@@ -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)