[PATCH 02/12] regedit: Use wide character string literals in edit.c
Hugh McMaster
hugh.mcmaster at outlook.com
Thu Apr 14 08:01:33 CDT 2022
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/edit.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c
index 3f99626dd23..b808c38c51c 100644
--- a/programs/regedit/edit.c
+++ b/programs/regedit/edit.c
@@ -85,15 +85,12 @@ static void WINAPIV error_code_messagebox(HWND hwnd, unsigned int msg_id, ...)
static BOOL change_dword_base(HWND hwndDlg, BOOL toHex)
{
- static const WCHAR percent_u[] = {'%','u',0};
- static const WCHAR percent_x[] = {'%','x',0};
-
WCHAR buf[128];
DWORD val;
if (!GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf))) return FALSE;
- if (!swscanf(buf, toHex ? percent_u : percent_x, &val)) return FALSE;
- wsprintfW(buf, toHex ? percent_x : percent_u, val);
+ if (!swscanf(buf, toHex ? L"%u" : L"%x", &val)) return FALSE;
+ wsprintfW(buf, toHex ? L"%x" : L"%u", val);
return SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf);
}
@@ -281,10 +278,9 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
else error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED);
}
} else if ( type == REG_DWORD ) {
- static const WCHAR x[] = {'%','x',0};
DWORD value = *((DWORD*)stringValueData);
stringValueData = heap_xrealloc(stringValueData, 64);
- wsprintfW(stringValueData, x, value);
+ wsprintfW(stringValueData, L"%x", value);
if (DialogBoxW(0, MAKEINTRESOURCEW(IDD_EDIT_DWORD), hwnd, modify_dlgproc) == IDOK) {
DWORD val;
CHAR* valueA = GetMultiByteString(stringValueData);
--
2.35.2
More information about the wine-devel
mailing list