From 172888ac324cfe0af8a7b7deb55f85ca431aabd3 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 9 Feb 2024 17:00:42 +0000 Subject: [PATCH] [dos] fix a CodeQL warning and harmonize code --- src/dos_locale.c | 56 ++++++++++++++++++++++++------------------------ src/rufus.rc | 10 ++++----- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/dos_locale.c b/src/dos_locale.c index 8a4dace9..4260b604 100644 --- a/src/dos_locale.c +++ b/src/dos_locale.c @@ -1,7 +1,7 @@ /* * Rufus: The Reliable USB Formatting Utility * DOS keyboard locale setup - * Copyright © 2011-2021 Pete Batard + * Copyright © 2011-2024 Pete Batard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -197,8 +197,8 @@ static kb_list fd_kb_list[] = { static int ms_get_kbdrv(const char* kb) { unsigned int i, j; - for (i=0; i= 0); - uprintf("Will use DOS keyboard '%s' [%s]\n", kb, kb_to_hr(kb)); + uprintf("Will use DOS keyboard '%s' [%s]", kb, kb_to_hr(kb)); // Now get a codepage cp = GetOEMCP(); @@ -994,16 +994,16 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) (char*)&actual_cp, sizeof(actual_cp))) cp = actual_cp; } - egadrv = bFreeDOS?fd_get_ega(cp):ms_get_ega(cp); + egadrv = bFreeDOS ? fd_get_ega(cp) : ms_get_ega(cp); if (egadrv == NULL) { // We need to use the fallback CP from the keyboard we got above, as 437 is not always available - uprintf("Unable to find an EGA file with codepage %d [%s]\n", cp, cp_to_hr(cp)); + uprintf("Unable to find an EGA file with codepage %d [%s]", cp, cp_to_hr(cp)); cp = kbdrv_data[kbdrv].default_cp; - egadrv = bFreeDOS?"ega.cpx":"ega.cpi"; + egadrv = bFreeDOS ? "ega.cpx" : "ega.cpi"; } else if (bFreeDOS) { cp = fd_upgrade_cp(cp); } - uprintf("Will use codepage %d [%s]\n", cp, cp_to_hr(cp)); + uprintf("Will use codepage %d [%s]", cp, cp_to_hr(cp)); if ((cp == 437) && (strcmp(kb, "us") == 0)) { // Nothing much to do if US/US - just notify in autoexec.bat @@ -1011,14 +1011,14 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) static_strcat(filename, "\\AUTOEXEC.BAT"); fd = fopen(filename, "w+"); if (fd == NULL) { - uprintf("Unable to create 'AUTOEXEC.BAT': %s.\n", WindowsErrorString()); + uprintf("Unable to create 'AUTOEXEC.BAT': %s", WindowsErrorString()); return FALSE; } fprintf(fd, "@echo off\n"); fprintf(fd, "set PATH=.;\\;\\LOCALE\n"); fprintf(fd, "echo Using %s keyboard with %s codepage [%d]\n", kb_to_hr("us"), cp_to_hr(437), 437); fclose(fd); - uprintf("Successfully wrote 'AUTOEXEC.BAT'\n"); + uprintf("Successfully wrote 'AUTOEXEC.BAT'"); return TRUE; } @@ -1027,7 +1027,7 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) static_strcat(filename, "\\CONFIG.SYS"); fd = fopen(filename, "w+"); if (fd == NULL) { - uprintf("Unable to create 'CONFIG.SYS': %s.\n", WindowsErrorString()); + uprintf("Unable to create 'CONFIG.SYS': %s.", WindowsErrorString()); return FALSE; } if (bFreeDOS) { @@ -1045,14 +1045,14 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) bFreeDOS?"MENU ":"MENUITEM=", bFreeDOS?')':',', kb_to_hr("us"), cp_to_hr(437), 437); fprintf(fd, "%s", bFreeDOS?"MENU\n12?\n":"[1]\ndevice=\\locale\\display.sys con=(ega,,1)\n[2]\n"); fclose(fd); - uprintf("Successfully wrote 'CONFIG.SYS'\n"); + uprintf("Successfully wrote 'CONFIG.SYS'"); // AUTOEXEC.BAT static_strcpy(filename, path); static_strcat(filename, "\\AUTOEXEC.BAT"); fd = fopen(filename, "w+"); if (fd == NULL) { - uprintf("Unable to create 'AUTOEXEC.BAT': %s.\n", WindowsErrorString()); + uprintf("Unable to create 'AUTOEXEC.BAT': %s", WindowsErrorString()); return FALSE; } fprintf(fd, "@echo off\n"); @@ -1066,7 +1066,7 @@ BOOL SetDOSLocale(const char* path, BOOL bFreeDOS) fprintf(fd, "keyb %s,,\\locale\\%s\n", kb, kbdrv_data[kbdrv].name); fprintf(fd, ":2\n"); fclose(fd); - uprintf("Successfully wrote 'AUTOEXEC.BAT'\n"); + uprintf("Successfully wrote 'AUTOEXEC.BAT'"); return TRUE; } diff --git a/src/rufus.rc b/src/rufus.rc index 46642bd6..6e05a6cc 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 4.5.2111" +CAPTION "Rufus 4.5.2112" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -392,8 +392,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,5,2111,0 - PRODUCTVERSION 4,5,2111,0 + FILEVERSION 4,5,2112,0 + PRODUCTVERSION 4,5,2112,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +411,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "4.5.2111" + VALUE "FileVersion", "4.5.2112" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2024 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-4.5.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "4.5.2111" + VALUE "ProductVersion", "4.5.2112" END END BLOCK "VarFileInfo"