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 <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compressed) {
QString file_name_lower;
- QString file_suffix;
GSList *extensions_list;
gboolean add_extension;
/* 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