From a5cea74034a8e029bfdf0f2b82ea8800bf5bd206 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 29 Oct 2021 09:26:28 +0200 Subject: Fix misuses of NULL across Windows-only code ...which defines NULL as a plain 0 integer literal instead of the GNU __null extension, so clang-cl's -Wnull-conversion cannot kick in. These findings are from an experimental build done with clang-cl and a modified > --- a/clang/lib/Headers/stddef.h > +++ b/clang/lib/Headers/stddef.h > @@ -83,6 +83,10 @@ typedef __WCHAR_TYPE__ wchar_t; > # if !defined(__MINGW32__) && !defined(_MSC_VER) > # define NULL __null > # else > -# define NULL 0 > +# if __cplusplus >= 201103L > +# define NULL nullptr > +# else > +# define NULL 0 > +# endif > # endif > #else > # define NULL ((void*)0) However, that build also ran into lots of places where 3rd-party code in external/ and Windows system headers caused issues when NULL is nullptr (which I worked around with various hacky patches for that build), so this is unfortunately not something that can easily be enabled generally. Change-Id: I10674464498a9bc63578d9e6cc32ddde23ab4f30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124419 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- setup_native/source/win32/customactions/sellang/sellang.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'setup_native/source') diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx index 35022ac7dd50..594bd70bc77c 100644 --- a/setup_native/source/win32/customactions/sellang/sellang.cxx +++ b/setup_native/source/win32/customactions/sellang/sellang.cxx @@ -251,7 +251,7 @@ extern "C" __declspec(dllexport) UINT __stdcall SelectLanguage( MSIHANDLE handle return ERROR_SUCCESS; } - if (MsiViewExecute(view, NULL) != ERROR_SUCCESS) { + if (MsiViewExecute(view, 0) != ERROR_SUCCESS) { MsiCloseHandle(view); MsiCloseHandle(database); return ERROR_SUCCESS; @@ -287,7 +287,7 @@ extern "C" __declspec(dllexport) UINT __stdcall SelectLanguage( MSIHANDLE handle &view) == ERROR_SUCCESS) { - if (MsiViewExecute(view, NULL) == ERROR_SUCCESS) { + if (MsiViewExecute(view, 0) == ERROR_SUCCESS) { while (ndicts < MAX_LANGUAGES && MsiViewFetch(view, &record) == ERROR_SUCCESS) { -- cgit