https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cdca4e903603a024d495bdc343a7f397aa7bd14f

commit cdca4e903603a024d495bdc343a7f397aa7bd14f
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sat Apr 27 18:53:59 2019 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Jul 20 13:56:18 2019 +0200

    [MSPAINT] Don't use SIZEOF on a pointer
    
    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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/applications/mspaint/main.cpp 
b/base/applications/mspaint/main.cpp
index 6b0d512cf4e..381b193158b 100644
--- a/base/applications/mspaint/main.cpp
+++ b/base/applications/mspaint/main.cpp
@@ -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;

Reply via email to