cli_ure/source/climaker/climaker_emit.cxx | 2 +- cli_ure/source/uno_bridge/cli_bridge.cxx | 22 +++++++++++----------- cli_ure/source/uno_bridge/cli_data.cxx | 3 ++- cli_ure/source/uno_bridge/cli_proxy.cxx | 2 +- vcl/win/gdi/salgdi2.cxx | 2 ++ vcl/win/window/salframe.cxx | 24 +++++++++++++----------- 6 files changed, 30 insertions(+), 25 deletions(-)
New commits: commit 12099436f782ec27b1dd8eb4b7dd3baf34d55168 Author: Caolán McNamara <[email protected]> AuthorDate: Sat May 11 20:10:26 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun May 12 12:49:33 2024 +0200 WaE: C6011 Dereferencing NULL pointer warnings Change-Id: I2fddf8ae5803041344fe63c4375fe5a3ee46fed9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167520 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx index d5f1a56d7e9f..1bec774f5ff4 100644 --- a/cli_ure/source/climaker/climaker_emit.cxx +++ b/cli_ure/source/climaker/climaker_emit.cxx @@ -928,7 +928,7 @@ Assembly ^ TypeEmitter::type_resolve( xReturnStruct->getTypeArguments(); if (seq_type_args.getLength() != 0) { - //get th ctor of the attribute + //get the ctor of the attribute array< ::System::Type^>^ arCtor = {::System::Type::GetType("System.Type[]")}; //Get the arguments for the attribute's ctor int numTypes = seq_type_args.getLength(); diff --git a/cli_ure/source/uno_bridge/cli_bridge.cxx b/cli_ure/source/uno_bridge/cli_bridge.cxx index d9b4cdd0bda4..95e92e548f2b 100644 --- a/cli_ure/source/uno_bridge/cli_bridge.cxx +++ b/cli_ure/source/uno_bridge/cli_bridge.cxx @@ -62,14 +62,14 @@ void SAL_CALL Mapping_cli2uno( uno_Interface ** ppUnoI = (uno_Interface **)ppOut; intptr_t cliI = (intptr_t)pIn; - OSL_ENSURE( ppUnoI && td, "### null ptr!" ); - - if (0 != *ppUnoI) - { - uno_Interface * pUnoI = *(uno_Interface **)ppUnoI; - (*pUnoI->release)( pUnoI ); - *ppUnoI = 0; - } + assert(ppUnoI && td && "### null ptr!"); + + if (0 != *ppUnoI) + { + uno_Interface * pUnoI = *(uno_Interface **)ppUnoI; + (*pUnoI->release)( pUnoI ); + *ppUnoI = 0; + } try { Mapping const * that = static_cast< Mapping const * >( mapping ); @@ -95,7 +95,7 @@ void SAL_CALL Mapping_uno2cli( { try { - OSL_ENSURE( td && ppOut, "### null ptr!" ); + assert(td && ppOut && "### null ptr!"); OSL_ENSURE( (sizeof(System::Char) == sizeof(sal_Unicode)) && (sizeof(System::Boolean) == sizeof(sal_Bool)) && (sizeof(System::SByte) == sizeof(sal_Int8)) @@ -204,7 +204,7 @@ Bridge::Bridge( m_uno_cli_env( uno_cli_env ), m_registered_cli2uno( registered_cli2uno ) { - OSL_ASSERT( 0 != m_uno_cli_env && 0 != m_uno_env ); + assert(m_uno_cli_env && m_uno_env); (*((uno_Environment *)m_uno_env)->acquire)( (uno_Environment *)m_uno_env ); (*m_uno_cli_env->acquire)( m_uno_cli_env ); @@ -276,7 +276,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo ) SAL_THROW_EXTERN_C() { - OSL_ASSERT( 0 != ppMapping && 0 != pFrom && 0 != pTo ); + assert(ppMapping && pFrom && pTo); if (*ppMapping) { (*(*ppMapping)->release)( *ppMapping ); diff --git a/cli_ure/source/uno_bridge/cli_data.cxx b/cli_ure/source/uno_bridge/cli_data.cxx index 72b39df4884f..c6db58c2bb3d 100644 --- a/cli_ure/source/uno_bridge/cli_data.cxx +++ b/cli_ure/source/uno_bridge/cli_data.cxx @@ -708,7 +708,7 @@ OUString mapCliTypeName(System::String^ typeName) */ inline System::String^ mapUnoString( rtl_uString const * data) { - OSL_ASSERT(data); + assert(data); return gcnew System::String((__wchar_t*) data->buffer, 0, data->length); } @@ -1593,6 +1593,7 @@ void Bridge::map_to_cli( ctorInfo = arCtorInfo[i]; break; } + assert(arParamInfo); OSL_ASSERT(arParamInfo[0]->ParameterType->Equals(System::String::typeid) && arParamInfo[1]->ParameterType->Equals(System::Object::typeid) && arParamInfo[0]->Position == 0 diff --git a/cli_ure/source/uno_bridge/cli_proxy.cxx b/cli_ure/source/uno_bridge/cli_proxy.cxx index 22c47817748f..35d9a02cbd44 100644 --- a/cli_ure/source/uno_bridge/cli_proxy.cxx +++ b/cli_ure/source/uno_bridge/cli_proxy.cxx @@ -419,7 +419,7 @@ srrm::IMessage^ UnoInterfaceProxy::Invoke(srrm::IMessage^ callmsg) System::Type^ typeBeingCalled = loadCliType(sTypeName); UnoInterfaceInfo^ info = findInfo( typeBeingCalled ); - OSL_ASSERT( nullptr != info ); + assert(info); // ToDo do without string conversion, an OUString is not needed here // get the type description of the call commit d4a110f8c274731959868c1f899360cc69694a71 Author: Caolán McNamara <[email protected]> AuthorDate: Sat May 11 19:48:37 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun May 12 12:49:22 2024 +0200 WaE: C6011 Dereferencing NULL pointer warnings Change-Id: I85aa6c2f100823d1d39e24ab3ffcb0c44f66354e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167519 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx index 277fbc3b9f98..ba4afc157bc3 100644 --- a/vcl/win/gdi/salgdi2.cxx +++ b/vcl/win/gdi/salgdi2.cxx @@ -162,6 +162,7 @@ void convertToWinSalBitmap(SalBitmap& rSalBitmap, WinSalBitmap& rWinSalBitmap) void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) { + assert(&rSalBitmap && "msvc -analyze gets confused here"); if (dynamic_cast<const WinSalBitmap*>(&rSalBitmap) == nullptr #if HAVE_FEATURE_SKIA && dynamic_cast<WinSkiaSalGraphicsImpl*>(mpImpl.get()) == nullptr @@ -183,6 +184,7 @@ void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSSalBitmap, const SalBitmap& rSTransparentBitmap ) { + assert(&rSSalBitmap && "msvc -analyze gets confused here"); if (dynamic_cast<const WinSalBitmap*>(&rSSalBitmap) == nullptr #if HAVE_FEATURE_SKIA && dynamic_cast<WinSkiaSalGraphicsImpl*>(mpImpl.get()) == nullptr diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 926694ccbb5b..288b561970f0 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -4896,20 +4896,22 @@ static LRESULT ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) if( hDrawDIB ) { - PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( hDrawDIB )); - PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize + - WinSalBitmap::ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD ); + if (PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( hDrawDIB ))) + { + PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize + + WinSalBitmap::ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD ); - HBITMAP hBmp = CreateDIBitmap( pDI->hDC, &pBI->bmiHeader, CBM_INIT, pBits, pBI, DIB_RGB_COLORS ); - GlobalUnlock( hDrawDIB ); + HBITMAP hBmp = CreateDIBitmap( pDI->hDC, &pBI->bmiHeader, CBM_INIT, pBits, pBI, DIB_RGB_COLORS ); + GlobalUnlock( hDrawDIB ); - HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) ); - DrawStateW( pDI->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hBmp), WPARAM(0), - x, y+(lineHeight-bmpSize.Height())/2, bmpSize.Width(), bmpSize.Height(), - DST_BITMAP | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) ); + HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) ); + DrawStateW( pDI->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hBmp), WPARAM(0), + x, y+(lineHeight-bmpSize.Height())/2, bmpSize.Width(), bmpSize.Height(), + DST_BITMAP | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) ); - DeleteObject( hbrIcon ); - DeleteObject( hBmp ); + DeleteObject( hbrIcon ); + DeleteObject( hBmp ); + } } }
