PATCH: programs/regedit format specifyer fixes

Gerald Pfeifer pfeifer at dbai.tuwien.ac.at
Mon Oct 9 11:38:30 CDT 2006


I started getting the following warning about a week ago:

  edit.c:110: warning: long int format, DWORD arg (arg 3)
  edit.c:110: warning: long unsigned int format, DWORD arg (arg 3)
  edit.c:311: warning: long int format, DWORD arg (arg 3)
  edit.c:311: warning: long unsigned int format, DWORD arg (arg 3)
  regedit.c:181: warning: long int format, DWORD arg (arg 5)

The following patch addresses these.

Gerald

ChangeLog:
Fix format specifiers for _stscanf and fprintf.

Index: edit.c
===================================================================
RCS file: /home/wine/wine/programs/regedit/edit.c,v
retrieving revision 1.21
diff -u -3 -p -r1.21 edit.c
--- edit.c	23 May 2006 12:49:20 -0000	1.21
+++ edit.c	9 Oct 2006 16:34:51 -0000
@@ -107,7 +107,7 @@ static BOOL change_dword_base(HWND hwndD
     DWORD val;
 
     if (!GetDlgItemText(hwndDlg, IDC_VALUE_DATA, buf, COUNT_OF(buf))) return FALSE;
-    if (!_stscanf(buf, toHex ? "%ld" : "%lx", &val)) return FALSE;
+    if (!_stscanf(buf, toHex ? "%d" : "%x", &val)) return FALSE;
     wsprintf(buf, toHex ? "%lx" : "%ld", val);
     return SetDlgItemText(hwndDlg, IDC_VALUE_DATA, buf);    
 }
@@ -308,7 +308,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoo
 	wsprintf(stringValueData, isDecimal ? "%ld" : "%lx", *((DWORD*)stringValueData));
 	if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_DWORD), hwnd, modify_dlgproc) == IDOK) {
 	    DWORD val;
-	    if (_stscanf(stringValueData, isDecimal ? "%ld" : "%lx", &val)) {
+	    if (_stscanf(stringValueData, isDecimal ? "%d" : "%x", &val)) {
 		lRet = RegSetValueEx(hKey, valueName, 0, type, (BYTE*)&val, sizeof(val));
 		if (lRet == ERROR_SUCCESS) result = TRUE;
 		else error_code_messagebox(hwnd, lRet);
Index: regedit.c
===================================================================
RCS file: /home/wine/wine/programs/regedit/regedit.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 regedit.c
--- regedit.c	23 May 2006 12:49:20 -0000	1.13
+++ regedit.c	9 Oct 2006 16:34:51 -0000
@@ -177,7 +177,7 @@ BOOL PerformRegAction(REGEDIT_ACTION act
                 }
                 if (size==0)
                 {
-                    fprintf(stderr,"%s: File not found \"%s\" (%ld)\n",
+                    fprintf(stderr,"%s: File not found \"%s\" (%d)\n",
                             getAppName(),filename,GetLastError());
                     exit(1);
                 }



More information about the wine-patches mailing list