From 49fcee3fcb997036f8677af081a5cbecab7c07e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=94=D0=BE=D0=BD=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 7 Dec 2016 01:14:39 +0300 Subject: Qt: don't append a second extension to save file names When checking if the file already has one of the possible extensions, MainWindow::fileAddExtension reuses file_suffix between iterations and appends to it each time, so it ends up checking for the wrong suffix for all extensions except the first one. Scope file_suffix to the for loop to fix that. Change-Id: Idbc5a619a4793d8c477bfd88305cdb44ea844e13 Reviewed-on: https://code.wireshark.org/review/19123 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- ui/qt/main_window.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui/qt') diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 506907917d..d193dde993 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -1495,7 +1495,6 @@ void MainWindow::exportDissections(export_type_e export_type) { void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compressed) { QString file_name_lower; - QString file_suffix; GSList *extensions_list; gboolean add_extension; @@ -1516,7 +1515,7 @@ void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compre /* OK, see if the file has one of those extensions. */ for (extension = extensions_list; extension != NULL; extension = g_slist_next(extension)) { - file_suffix += tr(".") + (char *)extension->data; + QString file_suffix = tr(".") + (char *)extension->data; if (file_name_lower.endsWith(file_suffix)) { /* * The file name has one of the extensions for -- cgit v1.2.1