binaryurp/source/writer.cxx | 2 +- comphelper/source/misc/anytostring.cxx | 2 +- connectivity/source/parse/sqlnode.cxx | 4 +--- cppu/source/uno/lbenv.cxx | 8 +++----- cppu/source/uno/lbmap.cxx | 2 +- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 4 ++-- editeng/source/editeng/impedit2.cxx | 2 +- filter/source/msfilter/eschesdo.cxx | 7 ++----- jvmaccess/source/virtualmachine.cxx | 2 +- registry/source/regkey.cxx | 2 +- sal/osl/unx/socket.c | 5 ++--- sal/rtl/byteseq.cxx | 3 +-- sc/source/ui/app/uiitems.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 2 +- sot/source/sdstor/stgavl.cxx | 11 +++++------ stoc/source/corereflection/criface.cxx | 2 +- svtools/source/contnr/treelist.cxx | 2 +- svtools/source/contnr/treelistbox.cxx | 9 +++------ svtools/source/uno/unoevent.cxx | 2 +- svx/source/svdraw/svdedtv.cxx | 4 ++-- svx/source/svdraw/svdotext.cxx | 2 +- sw/source/core/crsr/trvltbl.cxx | 2 +- tools/source/inet/inetmime.cxx | 2 +- vcl/generic/print/genpspgraphics.cxx | 6 +++--- 24 files changed, 38 insertions(+), 51 deletions(-)
New commits: commit ee42c384009cfb21375d0ea01af7d712ee80158a Author: Caolán McNamara <caol...@redhat.com> Date: Mon Jul 7 10:27:21 2014 +0100 coverity#1213080 Explicit null dereferenced Change-Id: I8f696307164c30d1fd2b1214171982da426cf9b8 diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 0805216..71d0c06 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -80,7 +80,7 @@ bool SwCrsrShell::GoNextCell( bool bAppendLine ) { if( pCrsr->HasMark() || !bAppendLine ) bRet = false; - else + else if (pTblNd) { // if there is no list anymore then create new one if ( !pTableBox ) commit 0d78ad871e85a74a2a7eac2f2a2ff94776f35e77 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Jul 7 10:15:32 2014 +0100 DBG_ASSERT->assert when followed by dereference Change-Id: Ic1c999ffdc391ea01be5711721e7c9e63179473e diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx index a47abf8..84edbd4 100644 --- a/binaryurp/source/writer.cxx +++ b/binaryurp/source/writer.cxx @@ -221,7 +221,7 @@ void Writer::sendRequest( typelib_InterfaceMethodTypeDescription * mtd = reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( member.get()); - OSL_ASSERT(mtd->pInterface != 0); + assert(mtd->pInterface != 0); if (!t.is()) { t = css::uno::TypeDescription(&mtd->pInterface->aBase); } diff --git a/comphelper/source/misc/anytostring.cxx b/comphelper/source/misc/anytostring.cxx index 254c743..50dc185 100644 --- a/comphelper/source/misc/anytostring.cxx +++ b/comphelper/source/misc/anytostring.cxx @@ -61,7 +61,7 @@ void appendValue( OUStringBuffer & buf, buf.append( "void" ); return; } - OSL_ASSERT( val != 0 ); + assert(val != 0); if (prependType && typeRef->eTypeClass != typelib_TypeClass_STRING && diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index fa7f395..a80e8d4 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1993,10 +1993,8 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition, bool case SQL_NODE_NOTEQUAL: pNewComparison = new OSQLParseNode(OUString("="),SQL_NODE_EQUAL,SQL_EQUAL); break; - default: - assert(false && "OSQLParseNode::negateSearchCondition: unexpected node type!"); - break; } + assert(pNewComparison && "OSQLParseNode::negateSearchCondition: unexpected node type!"); pSearchCondition->replace(pComparison, pNewComparison); delete pComparison; } diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index b282820..c38a9b7 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -1006,7 +1006,7 @@ inline void EnvironmentsData::getRegisteredEnvironments( uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc, const OUString & rEnvDcp ) { - OSL_ENSURE( pppEnvs && pnLen && memAlloc, "### null ptr!" ); + assert(pppEnvs && pnLen && memAlloc && "### null ptr!"); // max size uno_Environment ** ppFound = (uno_Environment **)alloca( @@ -1144,7 +1144,7 @@ CPPU_DLLPUBLIC void SAL_CALL uno_createEnvironment( uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext ) SAL_THROW_EXTERN_C() { - OSL_ENSURE( ppEnv, "### null ptr!" ); + assert(ppEnv && "### null ptr!"); if (*ppEnv) (*(*ppEnv)->release)( *ppEnv ); @@ -1152,12 +1152,11 @@ CPPU_DLLPUBLIC void SAL_CALL uno_createEnvironment( *ppEnv = initDefaultEnvironment( rEnvDcp, pContext ); } - CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment( uno_Environment ** ppEnv, rtl_uString * pEnvDcp, void * pContext ) SAL_THROW_EXTERN_C() { - OSL_ENSURE( ppEnv, "### null ptr!" ); + assert(ppEnv && "### null ptr!"); OUString const & rEnvDcp = OUString::unacquired( &pEnvDcp ); EnvironmentsData & rData = theEnvironmentsData::get(); @@ -1175,7 +1174,6 @@ CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment( } } - CPPU_DLLPUBLIC void SAL_CALL uno_getRegisteredEnvironments( uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc, rtl_uString * pEnvDcp ) diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index 43c5d4a..162f438 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -631,7 +631,7 @@ void SAL_CALL uno_getMappingByName( rtl_uString * pAddPurpose ) SAL_THROW_EXTERN_C() { - OSL_ENSURE( ppMapping && pFrom && pTo, "### null ptr!" ); + assert(ppMapping && pFrom && pTo && "### null ptr!"); if (*ppMapping) { (*(*ppMapping)->release)( *ppMapping ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 199355e..68b3321 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -49,7 +49,7 @@ namespace unopkg { OUString toString( OptionInfo const * info ) { - OSL_ASSERT( info != 0 ); + assert(info != 0); OUStringBuffer buf; buf.appendAscii("--"); buf.appendAscii(info->m_name); @@ -98,7 +98,7 @@ OptionInfo const * getOptionInfo( bool isOption( OptionInfo const * option_info, sal_uInt32 * pIndex ) { - OSL_ASSERT( option_info != 0 ); + assert(option_info != 0); if (osl_getCommandArgCount() <= *pIndex) return false; diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 2184d8f..a1bac55 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3223,7 +3223,7 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int3 if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { const EditLine* pLine = pPPortion->GetLines()[nLine]; - OSL_ENSURE( pLine, "Line not found: GetLineBoundaries" ); + assert(pLine && "Line not found: GetLineBoundaries"); rStart = pLine->GetStart(); rEnd = pLine->GetEnd(); } diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 35fd730..bc31462 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -960,22 +960,19 @@ void ImplEscherExSdr::ImplFlushSolverContainer() } } - void ImplEscherExSdr::ImplWriteCurrentPage() { - DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer" ); + assert(mpSolverContainer && "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer"); ImplWritePage( *mpSolverContainer, NORMAL ); ImplExitPage(); } - sal_uInt32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj , bool ooxmlExport ) { - DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteShape: no SolverContainer" ); + assert(mpSolverContainer && "ImplEscherExSdr::ImplWriteShape: no SolverContainer"); return ImplWriteShape( rObj, *mpSolverContainer, NORMAL, ooxmlExport ); } - void EscherEx::AddSdrPage( const SdrPage& rPage ) { if ( mpImplEscherExSdr->ImplInitPage( rPage ) ) diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx index 23192ab..69bcf5f 100644 --- a/jvmaccess/source/virtualmachine.cxx +++ b/jvmaccess/source/virtualmachine.cxx @@ -82,7 +82,7 @@ VirtualMachine::~VirtualMachine() JNIEnv * VirtualMachine::attachThread(bool * pAttached) const { - OSL_ENSURE(pAttached != 0, "bad parameter"); + assert(pAttached != 0 && "bad parameter"); JNIEnv * pEnv; jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion); if (n != JNI_OK && n != JNI_EDETACHED) { diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx index 89bf17b..21698c1 100644 --- a/registry/source/regkey.cxx +++ b/registry/source/regkey.cxx @@ -459,7 +459,7 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey, sal_Int32** pValueList, sal_uInt32* pLen) { - OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getLongListValue(): invalid parameter"); + assert((pValueList != 0) && (pLen != 0) && "registry::getLongListValue(): invalid parameter"); *pValueList = 0, *pLen = 0; ORegKey* pKey = static_cast< ORegKey* >(hKey); diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index fb6ced2..618bd7a 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -25,7 +25,7 @@ #include <osl/signal.h> #include <rtl/alloc.h> - +#include <assert.h> #include <ctype.h> #include <sal/types.h> @@ -552,8 +552,7 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr ( struct sockaddr* pAddr1 = NULL; struct sockaddr* pAddr2 = NULL; - OSL_ASSERT(Addr1); - OSL_ASSERT(Addr2); + assert(Addr1 && Addr2); pAddr1 = &(Addr1->m_sockaddr); pAddr2 = &(Addr2->m_sockaddr); diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx index 5fd6022..f0f1901 100644 --- a/sal/rtl/byteseq.cxx +++ b/sal/rtl/byteseq.cxx @@ -216,8 +216,7 @@ void SAL_CALL rtl_byte_sequence_assign( sal_Sequence **ppSequence , sal_Sequence sal_Bool SAL_CALL rtl_byte_sequence_equals( sal_Sequence *pSequence1 , sal_Sequence *pSequence2 ) SAL_THROW_EXTERN_C() { - OSL_ASSERT( pSequence1 ); - OSL_ASSERT( pSequence2 ); + assert(pSequence1 && pSequence2); if (pSequence1 == pSequence2) { return sal_True; diff --git a/sc/source/ui/app/uiitems.cxx b/sc/source/ui/app/uiitems.cxx index 6a7e088..9b12278 100644 --- a/sc/source/ui/app/uiitems.cxx +++ b/sc/source/ui/app/uiitems.cxx @@ -456,7 +456,7 @@ ScPivotItem::ScPivotItem( const ScPivotItem& rItem ) : aDestRange ( rItem.aDestRange ), bNewSheet ( rItem.bNewSheet ) { - OSL_ENSURE(rItem.pSaveData, "pSaveData"); + assert(rItem.pSaveData && "pSaveData"); pSaveData = new ScDPSaveData(*rItem.pSaveData); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a65f0e6..57de550 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2370,7 +2370,7 @@ void SfxViewFrame::StateView_Impl return; const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges, "Set with no Range"); + assert(pRanges && "Set with no Range"); while ( *pRanges ) { for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx index 3cb48c2..93869ac 100644 --- a/sot/source/sdstor/stgavl.cxx +++ b/sot/source/sdstor/stgavl.cxx @@ -131,7 +131,7 @@ short StgAvlNode::Adjust( StgAvlNode** pHeavy, StgAvlNode* pNew ) StgAvlNode* StgAvlNode::RotLL() { - OSL_ENSURE( pLeft, "The pointer is not allowed to be NULL!" ); + assert(pLeft && "The pointer is not allowed to be NULL!"); StgAvlNode *pHeavy = pLeft; pLeft = pHeavy->pRight; pHeavy->pRight = this; @@ -172,10 +172,9 @@ StgAvlNode* StgAvlNode::RotLR() } // perform RR rotation and return new root - StgAvlNode* StgAvlNode::RotRR() { - OSL_ENSURE( pRight, "The pointer is not allowed to be NULL!" ); + assert(pRight && "The pointer is not allowed to be NULL!" ); StgAvlNode* pHeavy = pRight; pRight = pHeavy->pLeft; pHeavy->pLeft = this; @@ -184,10 +183,9 @@ StgAvlNode* StgAvlNode::RotRR() } // perform the RL rotation and return the new root - StgAvlNode* StgAvlNode::RotRL() { - OSL_ENSURE( pRight && pRight->pLeft, "The pointer is not allowed to be NULL!" ); + assert(pRight && pRight->pLeft && "The pointer is not allowed to be NULL!"); StgAvlNode* pHeavy = pRight; StgAvlNode* pNewRoot = pHeavy->pLeft; pHeavy->pLeft = pNewRoot->pRight; @@ -297,7 +295,8 @@ bool StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns ) short nRes = (*pRoot)->Locate( pIns, &pPivot, &pParent, &pPrev ); if( !nRes ) return false; - OSL_ENSURE( pPivot && pPrev, "The pointers may not be NULL!" ); + + assert(pPivot && pPrev && "The pointers may not be NULL!"); // add new node if( nRes < 0 ) diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index 84fe1c0..6e57ee6 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -817,7 +817,7 @@ void InterfaceIdlClassImpl::initMembers() typelib_TypeDescription * pTD = 0; typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] ); - OSL_ENSURE( pTD, "### cannot get type description!" ); + assert(pTD && "### cannot get type description!"); pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName; pSortedMemberInit[nIndex].second = pTD; } diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 362f93b..a8830a6 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -596,7 +596,7 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvTreeListEntry* p sal_uLong SvTreeList::GetVisibleCount( SvListView* pView ) const { - DBG_ASSERT(pView,"GetVisCount:No View"); + assert(pView && "GetVisCount:No View"); if( !pView->HasViewData() ) return 0; if ( pView->nVisibleCount ) diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 5d0eadf..2f6bc55 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -3813,22 +3813,19 @@ void SvTreeListBox::ExcecuteContextMenuAction( sal_uInt16 ) void SvTreeListBox::EnableContextMenuHandling( void ) { - DBG_ASSERT( pImp, "-SvTreeListBox::EnableContextMenuHandling(): No implementation!" ); - + assert(pImp && "-SvTreeListBox::EnableContextMenuHandling(): No implementation!"); pImp->bContextMenuHandling = true; } void SvTreeListBox::EnableContextMenuHandling( bool b ) { - DBG_ASSERT( pImp, "-SvTreeListBox::EnableContextMenuHandling(): No implementation!" ); - + assert(pImp && "-SvTreeListBox::EnableContextMenuHandling(): No implementation!"); pImp->bContextMenuHandling = b; } bool SvTreeListBox::IsContextMenuHandlingEnabled( void ) const { - DBG_ASSERT( pImp, "-SvTreeListBox::IsContextMenuHandlingEnabled(): No implementation!" ); - + assert(pImp && "-SvTreeListBox::IsContextMenuHandlingEnabled(): No implementation!"); return pImp->bContextMenuHandling; } diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 627ea8f..a448ff7 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -53,7 +53,7 @@ SvBaseEventDescriptor::SvBaseEventDescriptor( const SvEventDescription* pSupport mpSupportedMacroItems(pSupportedMacroItems), mnMacroItems(0) { - DBG_ASSERT(pSupportedMacroItems != NULL, "Need a list of supported events!"); + assert(pSupportedMacroItems != NULL && "Need a list of supported events!"); for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != 0; mnMacroItems++) ; } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index ab38de0..0c6e8ca 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1917,7 +1917,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus ) } else if (IsAutoFit() && !mbInDownScale) { - OSL_ASSERT(pEdtOutl); + assert(pEdtOutl); mbInDownScale = true; // sucks that we cannot disable paints via diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index ff67d01..9f69e72 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -2872,7 +2872,7 @@ void INetMIMEOutputSink::writeSequence(const sal_uInt32 * pBegin, void INetMIMEOutputSink::writeSequence(const sal_Unicode * pBegin, const sal_Unicode * pEnd) { - DBG_ASSERT(pBegin && pBegin <= pEnd, + assert(pBegin && pBegin <= pEnd && "INetMIMEOutputSink::writeSequence(): Bad sequence"); sal_Char * pBufferBegin = new sal_Char[pEnd - pBegin]; diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index 1678852..d4072ed 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -86,10 +86,10 @@ private: virtual sal_uInt32 GetDepth () const SAL_OVERRIDE; }; -SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) : - mpBmpBuffer (pBuffer) +SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer) + : mpBmpBuffer(pBuffer) { - DBG_ASSERT (mpBmpBuffer, "SalPrinterBmp::SalPrinterBmp () can't acquire Bitmap"); + assert(mpBmpBuffer && "SalPrinterBmp::SalPrinterBmp () can't acquire Bitmap"); // calibrate scanline buffer if( BMP_SCANLINE_ADJUSTMENT( mpBmpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) commit 807b696c5c15dc2d8255116305fd28ba60f201c0 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Jul 7 10:03:58 2014 +0100 clang scan-build: Dereference of null pointer Change-Id: I7d47d4465bca247d52899239b3d2112790eca579 diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 4c2d3a7..9daebbe 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -989,12 +989,12 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO if(IsTextEdit()) { #ifdef DBG_UTIL - if(pOldObj && dynamic_cast< SdrTextObj* >(pOldObj) && static_cast< SdrTextObj* >(pOldObj)->IsTextEditActive()) + if(dynamic_cast< SdrTextObj* >(pOldObj) && static_cast< SdrTextObj* >(pOldObj)->IsTextEditActive()) { OSL_ENSURE(false, "OldObject is in TextEdit mode, this has to be ended before replacing it usnig SdrEndTextEdit (!)"); } - if(pNewObj && dynamic_cast< SdrTextObj* >(pNewObj) && static_cast< SdrTextObj* >(pNewObj)->IsTextEditActive()) + if(dynamic_cast< SdrTextObj* >(pNewObj) && static_cast< SdrTextObj* >(pNewObj)->IsTextEditActive()) { OSL_ENSURE(false, "NewObject is in TextEdit mode, this has to be ended before replacing it usnig SdrEndTextEdit (!)"); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits