PATCH: Fix format strings in programs/wordpad/wordpad.c

Gerald Pfeifer gerald at pfeifer.com
Wed Oct 11 03:16:20 CDT 2006


The patch below address the following issues:

  wordpad.c: In function `OnCreate':
  wordpad.c:140: warning: long unsigned int format, DWORD arg (arg 3)
  wordpad.c: In function `OnNotify':
  wordpad.c:194: warning: long int format, LONG arg (arg 3)
  wordpad.c:194: warning: long int format, LONG arg (arg 4)
  wordpad.c: In function `OnCommand':
  wordpad.c:315: warning: long int format, LONG arg (arg 3)
  wordpad.c:315: warning: long int format, LONG arg (arg 4)

Tested on FreeBSD 5.4 with GCC 3.4.

Gerald

ChangeLog:
Fix fprintf and sprintf format strings.

Index: wordpad.c
===================================================================
RCS file: /home/wine/wine/programs/wordpad/wordpad.c,v
retrieving revision 1.5
diff -u -3 -p -r1.5 wordpad.c
--- wordpad.c	9 Aug 2006 11:04:28 -0000	1.5
+++ wordpad.c	11 Oct 2006 08:13:57 -0000
@@ -137,7 +137,7 @@ static LRESULT OnCreate( HWND hWnd, WPAR
       0, 0, 1000, 100, hWnd, (HMENU)IDC_EDITOR, hInstance, NULL);
     if (!hEditorWnd)
     {
-        fprintf(stderr, "Error code %lu\n", GetLastError());
+        fprintf(stderr, "Error code %u\n", GetLastError());
         return -1;
     }
     assert(hEditorWnd);
@@ -189,9 +189,9 @@ static LRESULT OnNotify( HWND hWnd, WPAR
         SELCHANGE *pSC = (SELCHANGE *)lParam;
         char buf[128];
 
-        sprintf( buf,"selection = %ld..%ld, line count=%ld\n",
+        sprintf( buf,"selection = %d..%d, line count=%ld\n",
                  pSC->chrg.cpMin, pSC->chrg.cpMax,
-        SendMessage(hwndEditor, EM_GETLINECOUNT, 0, 0));
+                 SendMessage(hwndEditor, EM_GETLINECOUNT, 0, 0));
         SetWindowText(GetDlgItem(hWnd, IDC_STATUSBAR), buf);
         SendMessage(hWnd, WM_USER, 0, 0);
         return 1;
@@ -312,7 +312,7 @@ static LRESULT OnCommand( HWND hWnd, WPA
         SendMessage(hwndEditor, EM_EXGETSEL, 0, (LPARAM)&range);
         data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data) * (range.cpMax-range.cpMin+1));
         SendMessage(hwndEditor, EM_GETSELTEXT, 0, (LPARAM)data);
-        sprintf(buf, "Start = %ld, End = %ld", range.cpMin, range.cpMax);
+        sprintf(buf, "Start = %d, End = %d", range.cpMin, range.cpMax);
         MessageBoxA(hWnd, buf, "Editor", MB_OK);
         MessageBoxW(hWnd, data, xszAppTitle, MB_OK);
         HeapFree( GetProcessHeap(), 0, data);



More information about the wine-patches mailing list