From 3ca8fe5c0d51e6728dae949a143e63291d7043bc Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 20 Mar 2020 15:28:44 +0100 Subject: Fix passing RT_RCDATA into FindResourceW RT_RCDATA is defined as MAKEINTRESOURCE(10) in WinUser.h, and MAKEINTRESOURCE is defined as MAKEINTRESOURCEA in WinUser.h absent a definition of UNICODE. 649854544e28f388774492f27eb1b75485202148 "WinAPI: Fix some leftovers having UNICODE-define-dependency" had changed this > - HRSRC hrc = FindResourceW(g_hModule, L"#2000", RT_RCDATA); > + HRSRC hrc = FindResourceW(g_hModule, L"#2000", MAKEINTRESOURCEW(RT_RCDATA)); before 558956dc811a1f0f07411e348f7081a467bbc3b5 "Drop UNICODE/_UNICODE defines" dropped defining UNICODE. But that change was technically wrong, as now flagged by LLVM 10 trunk clang-cl: > C:/lo-clang/core/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx(50,56): error: cast to smaller integer type 'unsigned short' from 'char *' [-Werror,-Wpointer-to-int-cast] > HRSRC hrc = FindResourceW(g_hModule, L"#2000", MAKEINTRESOURCEW(RT_RCDATA)); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\winuser.h(236,51): note: expanded from macro 'MAKEINTRESOURCEW' > #define MAKEINTRESOURCEW(i) ((LPWSTR)((ULONG_PTR)((WORD)(i)))) > ^~~~~~~~~ There appears to be no explicit define for MAKEINTRESOURCEW(10), and the fix presented here seems like a cleaner way than replacing the use of RC_RCDATA with MAKEINTRESOURCEW(10). Change-Id: I36f60a8647ac264085656fc9ec3b129c2d81f480 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90799 Reviewed-by: Mike Kaganski Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell/source') diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx index 484b7236f3e0..7cc013b87b91 100644 --- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx +++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx @@ -47,7 +47,7 @@ namespace internal id is 2000 */ static void LoadSignetImageFromResource(ZipFile::ZipContentBuffer_t& buffer) { - HRSRC hrc = FindResourceW(g_hModule, L"#2000", MAKEINTRESOURCEW(RT_RCDATA)); + HRSRC hrc = FindResourceW(g_hModule, L"#2000", reinterpret_cast(RT_RCDATA)); DWORD size = SizeofResource(g_hModule, hrc); HGLOBAL hglob = LoadResource(g_hModule, hrc); char* data = static_cast(LockResource(hglob)); -- cgit