summaryrefslogtreecommitdiffstats
path: root/embedserv
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-10-29 09:26:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-10-29 13:26:12 +0200
commita5cea74034a8e029bfdf0f2b82ea8800bf5bd206 (patch)
tree9d87c2d78e9c5e16b83c445ce23ed2e0fc8df175 /embedserv
parentexternal/nss: More -Werror,-Wunknown-pragmas with clang-cl (diff)
downloadcore-a5cea74034a8e029bfdf0f2b82ea8800bf5bd206.tar.gz
core-a5cea74034a8e029bfdf0f2b82ea8800bf5bd206.zip
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 <sbergman@redhat.com>
Diffstat (limited to 'embedserv')
-rw-r--r--embedserv/source/embed/ed_idataobj.cxx2
-rw-r--r--embedserv/source/embed/ed_ipersiststr.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/embedserv/source/embed/ed_idataobj.cxx b/embedserv/source/embed/ed_idataobj.cxx
index ca482a421939..84886e63cb4a 100644
--- a/embedserv/source/embed/ed_idataobj.cxx
+++ b/embedserv/source/embed/ed_idataobj.cxx
@@ -34,7 +34,7 @@ using namespace ::com::sun::star;
sal_uInt64 EmbedDocument_Impl::getMetaFileHandle_Impl( bool isEnhMeta )
{
- sal_uInt64 pResult = NULL;
+ sal_uInt64 pResult = 0;
uno::Reference< datatransfer::XTransferable > xTransferable( m_pDocHolder->GetDocument(), uno::UNO_QUERY );
if ( xTransferable.is() )
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index df5f412593a4..c23141636de0 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -585,7 +585,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave,
if ( !fSameAsLoad && pStgSave != m_pMasterStorage )
{
OSL_ENSURE( m_pMasterStorage, "How could the document be initialized without storage!??" );
- HRESULT hr = m_pMasterStorage->CopyTo( NULL, nullptr, nullptr, pStgSave );
+ HRESULT hr = m_pMasterStorage->CopyTo( 0, nullptr, nullptr, pStgSave );
if ( FAILED( hr ) ) return E_FAIL;
STATSTG aStat;