diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-03-20 15:28:44 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-03-20 19:14:43 +0100 |
commit | 3ca8fe5c0d51e6728dae949a143e63291d7043bc (patch) | |
tree | 1935be0813aaf939c13d31c42a779ca336868764 /shell | |
parent | 337049d4642be4349dd8af3021e05165572d0bfa (diff) |
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 <mike.kaganski@collabora.com>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
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<LPWSTR>(RT_RCDATA)); DWORD size = SizeofResource(g_hModule, hrc); HGLOBAL hglob = LoadResource(g_hModule, hrc); char* data = static_cast<char*>(LockResource(hglob)); |