[Libreoffice-commits] core.git: shell/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 20 18:15:08 UTC 2020
shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 3ca8fe5c0d51e6728dae949a143e63291d7043bc
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Mar 20 15:28:44 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Mar 20 19:14:43 2020 +0100
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 at collabora.com>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Jenkins
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));
More information about the Libreoffice-commits
mailing list