diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-01 10:27:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-01 13:25:04 +0200 |
commit | ead19f4c62c8d74292a7ba589df2ca118cea3240 (patch) | |
tree | 69fa5d9bf938e7e1532b75183730c7800cf793ae /editeng | |
parent | 1d95bd8e5fcdcc241f4c945a4f01486df8e61f88 (diff) |
WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: Ic2231df89b900c17beac4627e3573b45aef0bc26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166954
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editundo.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/eertfpar.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 8 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 7 | ||||
-rw-r--r-- | editeng/source/outliner/outlundo.cxx | 4 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 8 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 4 |
11 files changed, 24 insertions, 21 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index f94bc2c7ea14..e9d74e779212 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -473,7 +473,7 @@ void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox) for ( size_t nView = 0; nView < pEE->GetViewCount(); nView++ ) { EditView* pV = pEE->GetView( nView ); - DBG_ASSERT( pV, "View not found!" ); + assert(pV && "View not found!"); fprintf( fp, "\nView %zu: Focus=%i", nView, pV->GetWindow()->HasFocus() ); tools::Rectangle aR( pV->GetOutputArea() ); fprintf( fp, "\n OutputArea: nX=%" SAL_PRIdINT64 ", nY=%" SAL_PRIdINT64 ", dX=%" SAL_PRIdINT64 ", dY=%" SAL_PRIdINT64 ", MapMode = %i", diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 7ff299e7efbd..e6678e78f681 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -204,7 +204,9 @@ void EditUndoDelContent::Redo() ? pEE->GetEditDoc().GetObject(nNode) : pEE->GetEditDoc().GetObject(nNode - 1); - DBG_ASSERT(pCheckNode && pCheckNode != mpContentNode.get(), "?! RemoveContent !? "); + assert(pCheckNode); + + DBG_ASSERT(pCheckNode != mpContentNode.get(), "?! RemoveContent !? "); EditPaM aPaM(pCheckNode, pCheckNode->Len()); diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 557081f8496f..024e10a5fad7 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -116,7 +116,7 @@ SvParserState EditRTFParser::CallParser() ContentNode* pCurNode = aCurSel.Max().GetNode(); sal_Int32 nPara = mpEditEngine->GetEditDoc().GetPos(pCurNode); ContentNode* pPrevNode = mpEditEngine->GetEditDoc().GetObject(nPara-1); - DBG_ASSERT( pPrevNode, "Invalid RTF-Document?!" ); + assert(pPrevNode && "Invalid RTF-Document?!"); EditSelection aSel; aSel.Min() = EditPaM( pPrevNode, pPrevNode->Len() ); aSel.Max() = EditPaM( pCurNode, 0 ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b03f4d27afef..f548e2423490 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4271,7 +4271,7 @@ void ImpEditEngine::InsertContent(std::unique_ptr<ContentNode> pNode, sal_Int32 EditPaM ImpEditEngine::SplitContent( sal_Int32 nNode, sal_Int32 nSepPos ) { ContentNode* pNode = maEditDoc.GetObject( nNode ); - DBG_ASSERT( pNode, "Invalid Node in SplitContent" ); + assert(pNode && "Invalid Node in SplitContent"); DBG_ASSERT( IsInUndo(), "SplitContent only for Undo()!" ); DBG_ASSERT( nSepPos <= pNode->Len(), "Index out of range: SplitContent" ); EditPaM aPaM( pNode, nSepPos ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 121259f7e394..432bb29138ea 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -147,8 +147,10 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) pPool = pPool->GetSecondaryPool(); } - DBG_ASSERT(pPool && pPool->GetName() == "EditEngineItemPool", - "ReadRTF: no EditEnginePool!"); + assert(pPool && "ReadRTF: no EditEnginePool!"); + + DBG_ASSERT(pPool->GetName() == "EditEngineItemPool", + "ReadRTF: wrong EditEnginePool!"); EditRTFParserRef xPrsr = new EditRTFParser(rInput, aSel, *pPool, mpEditEngine); SvParserState eState = xPrsr->CallParser(); @@ -217,7 +219,7 @@ ErrCode ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) for ( sal_Int32 nNode = nStartNode; nNode <= nEndNode; nNode++ ) { ContentNode* pNode = maEditDoc.GetObject( nNode ); - DBG_ASSERT( pNode, "Node not found: Search&Replace" ); + assert(pNode && "Node not found: Search&Replace"); sal_Int32 nStartPos = 0; sal_Int32 nEndPos = pNode->Len(); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 671ecd017cfd..4a71d5b35b77 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -396,7 +396,7 @@ void Outliner::SetToEmptyText() void Outliner::SetText( const OUString& rText, Paragraph* pPara ) { - DBG_ASSERT(pPara,"SetText:No Para"); + assert(pPara && "SetText:No Para"); const sal_Int32 nPara = pParaList->GetAbsPos( pPara ); @@ -810,7 +810,8 @@ bool Outliner::Collapse( Paragraph const * pPara ) vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const { const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); - DBG_ASSERT( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ), "ImpCalcBulletFont: Missing or BitmapBullet!" ); + assert(pFmt && "ImpCalcBulletFont: Missing!"); + DBG_ASSERT(( pFmt->GetNumberingType() != SVX_NUM_BITMAP ) && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ), "ImpCalcBulletFont: BitmapBullet!" ); vcl::Font aStdFont; if ( !pEditEngine->IsFlatMode() ) @@ -1380,7 +1381,7 @@ Size Outliner::ImplGetBulletSize( sal_Int32 nPara ) if( pPara->aBulSize.Width() == -1 ) { const SvxNumberFormat* pFmt = GetNumberFormat( nPara ); - DBG_ASSERT( pFmt, "ImplGetBulletSize - no Bullet!" ); + assert(pFmt && "ImplGetBulletSize - no Bullet!"); if ( pFmt->GetNumberingType() == SVX_NUM_NUMBER_NONE ) { diff --git a/editeng/source/outliner/outlundo.cxx b/editeng/source/outliner/outlundo.cxx index c2db1a77f353..799d33e29018 100644 --- a/editeng/source/outliner/outlundo.cxx +++ b/editeng/source/outliner/outlundo.cxx @@ -127,15 +127,13 @@ OLUndoExpand::OLUndoExpand(Outliner* pOut, sal_uInt16 _nId ) DBG_ASSERT(pOut,"Undo:No Outliner"); } - OLUndoExpand::~OLUndoExpand() { } - void OLUndoExpand::Restore( bool bUndo ) { - DBG_ASSERT(pOutliner,"Undo:No Outliner"); + assert(pOutliner && "Undo:No Outliner"); DBG_ASSERT(pOutliner->pEditEngine,"Outliner already deleted"); Paragraph* pPara; diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index cd01503731eb..4bcd01905283 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -836,7 +836,7 @@ sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected ) for ( sal_Int32 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ ) { Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara ); - DBG_ASSERT(pPara, "ImpCalcSelectedPages: invalid Selection? "); + assert(pPara && "ImpCalcSelectedPages: invalid Selection?"); if( pPara->HasFlag(ParaFlag::ISPAGE) ) { nPages++; diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 20d5df281bce..1877d068e0e0 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -1128,21 +1128,21 @@ bool SvxAccessibleTextEditViewAdapter::IsValid() const Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); return mpViewForwarder->LogicToPixel(rPoint, rMapMode); } Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); return mpViewForwarder->PixelToLogic(rPoint, rMapMode); } bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); ESelection aSelection; @@ -1167,7 +1167,7 @@ bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel ) { - DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder"); + assert(mpViewForwarder && "SvxAccessibleTextEditViewAdapter: no forwarder"); SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index fa2fa96118bf..6d088245f142 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -209,7 +209,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES for (auto const& attrib : aAttribs) { - DBG_ASSERT(attrib.pAttr, "GetCharAttribs gives corrupt data"); + assert(attrib.pAttr && "GetCharAttribs gives corrupt data"); const bool bEmptyPortion = attrib.nStart == attrib.nEnd; if((!bEmptyPortion && attrib.nStart >= nEndPos) || diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index b5f329e62050..f4ad4096d875 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -216,7 +216,7 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase(const SvxEditSource* pSource, const Svx { SolarMutexGuard aGuard; - DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!"); + assert(pSource && "SvxUnoTextRangeBase: I need a valid SvxEditSource!"); mpEditSource = pSource->Clone(); if (mpEditSource != nullptr) @@ -1435,7 +1435,7 @@ bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept { if ( !pForwarder ) pForwarder = mpEditSource->GetTextForwarder(); // first here, it is necessary... - + assert(pForwarder); --nNewPar; nCount -= nNewPos + 1; nNewPos = pForwarder->GetTextLen( nNewPar ); |