[MSPAINT] Don't use SIZEOF on a pointer
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 27 Apr 2019 16:53:59 +0000 (18:53 +0200)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 20 Jul 2019 11:56:18 +0000 (13:56 +0200)
Fixes GCC 8 warning:
base/applications/mspaint/definitions.h:16:31: error: division 'sizeof (LPWSTR {aka wchar_t*}) / sizeof (WCHAR {aka wchar_t})' does not compute the number of array elements [-Werror=sizeof-pointer-div]
 #define SIZEOF(a)  (sizeof(a) / sizeof((a)[0]))
                     ~~~~~~~~~~^~~~~~~~~~~~~~~~
base/applications/mspaint/main.cpp:134:55: note: in expansion of macro 'SIZEOF'
                 lstrcpyn(pon->lpOFN->lpstrFile, Path, SIZEOF(pon->lpOFN->lpstrFile));
                                                       ^~~~~~

base/applications/mspaint/main.cpp

index 6b0d512..381b193 100644 (file)
@@ -131,7 +131,7 @@ OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                 *pch = 0;
                 FileExtFromFilter(pch, pchTitle, pon->lpOFN);
                 SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)pchTitle);
-                lstrcpyn(pon->lpOFN->lpstrFile, Path, SIZEOF(pon->lpOFN->lpstrFile));
+                lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile);
             }
         }
         break;