From 366d08f2f6d4de922f6099c62bb81b49d89e0a68 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 8 Apr 2020 12:36:53 +0200 Subject: new loplugin:simplifypointertobool Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/core/access/accmap.cxx | 2 +- sw/source/core/doc/docbm.cxx | 4 +--- sw/source/core/txtnode/ndtxt.cxx | 2 +- sw/source/core/undo/unattr.cxx | 2 +- sw/source/core/undo/unsect.cxx | 2 +- sw/source/core/view/vnew.cxx | 2 +- sw/source/filter/ww8/ww8par.cxx | 4 ++-- sw/source/filter/ww8/ww8par2.cxx | 2 +- sw/source/filter/ww8/ww8par6.cxx | 2 +- sw/source/uibase/app/docsh.cxx | 2 +- sw/source/uibase/app/docst.cxx | 2 +- sw/source/uibase/dbui/dbmgr.cxx | 2 +- sw/source/uibase/uiview/pview.cxx | 2 +- sw/source/uibase/uiview/viewmdi.cxx | 2 +- sw/source/uibase/uno/unoatxt.cxx | 2 +- 15 files changed, 16 insertions(+), 18 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index ebe72049816e..fe2c2e1b0426 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2775,7 +2775,7 @@ void SwAccessibleMap::InvalidateFocus() if(GetShell()->IsPreview()) { uno::Reference xAcc = GetDocumentView_( true ); - if (xAcc.get()) + if (xAcc) { SwAccessiblePreview *pAccPreview = static_cast(xAcc.get()); if (pAccPreview) diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index e59e285d9334..c76e4417c020 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -651,9 +651,7 @@ namespace sw::mark pMark = std::make_unique( rPaM, rName ); break; } - assert(pMark.get() && - "MarkManager::makeMark(..)" - " - Mark was not created."); + assert(pMark && "MarkManager::makeMark(..) - Mark was not created."); if(pMark->GetMarkPos() != pMark->GetMarkStart()) pMark->Swap(); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d59a106f47b8..d0f6ea3d94e5 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3123,7 +3123,7 @@ OUString SwTextNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, const unsigned int _nRestrictToThisLevel, SwRootFrame const*const pLayout) const { - if (GetDoc()->IsClipBoard() && m_pNumStringCache.get()) + if (GetDoc()->IsClipBoard() && m_pNumStringCache) { // #i111677# do not expand number strings in clipboard documents return *m_pNumStringCache; diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 83fbf59f216c..efc6999fb7c4 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -773,7 +773,7 @@ void SwUndoAttr::RedoImpl(::sw::UndoRedoContext & rContext) } } - if ( m_pRedlineData.get() && + if ( m_pRedlineData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ) { RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags::Ignore ); diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 71c54b541fa0..ae2ba60a31c8 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -221,7 +221,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) SwSectionNode *const pSectNd = rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode(); - if (m_pRedlData.get() && + if (m_pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags())) { RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index e5d12627ebae..9c55d12654e7 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -289,7 +289,7 @@ SwViewShell::~SwViewShell() // i#9684 Stopping the animated graphics is not // necessary during printing or pdf export, because the animation // has not been started in this case. - if( mxDoc.get() && GetWin() ) + if( mxDoc && GetWin() ) { SwNodes& rNds = mxDoc->GetNodes(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 514a5ec9e3d1..082f778dc984 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -336,12 +336,12 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS xTextMark.reset(new OUString(read_uInt32_lenPrefixed_uInt16s_ToOUString(rStrm))); } - if (!xLongName && xShortName.get()) + if (!xLongName && xShortName) { xLongName.reset( new OUString ); *xLongName += *xShortName; } - else if (!xLongName && xTextMark.get()) + else if (!xLongName && xTextMark) xLongName.reset( new OUString ); if (xLongName) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index dee7e04a6ad1..cfae69f622be 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2761,7 +2761,7 @@ void WW8TabDesc::ParkPaM() void WW8TabDesc::MoveOutsideTable() { - OSL_ENSURE(m_xTmpPos.get() && m_pIo, "I've forgotten where the table is anchored"); + OSL_ENSURE(m_xTmpPos && m_pIo, "I've forgotten where the table is anchored"); if (m_xTmpPos && m_pIo) *m_pIo->m_pPaM->GetPoint() = *m_xTmpPos; } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 2d7de4556b66..7fd6ed3abc57 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -848,7 +848,7 @@ void wwSectionManager::CreateSep(const long nTextPos) if (!pSep) return; - if (!maSegments.empty() && mrReader.m_pLastAnchorPos.get() && *mrReader.m_pLastAnchorPos == *mrReader.m_pPaM->GetPoint()) + if (!maSegments.empty() && mrReader.m_pLastAnchorPos && *mrReader.m_pLastAnchorPos == *mrReader.m_pPaM->GetPoint()) { bool insert = true; SwPaM pam( *mrReader.m_pLastAnchorPos ); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index e86630a86ece..aeb522be5fc9 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -273,7 +273,7 @@ bool SwDocShell::Save() CalcLayoutForOLEObjects(); // format for OLE objects // #i62875# // reset compatibility flag , if possible - if (m_pWrtShell && m_xDoc.get() && + if (m_pWrtShell && m_xDoc && m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) && docfunc::AllDrawObjsOnPage(*m_xDoc)) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 1d21764c7a0c..6886b548ba56 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -309,7 +309,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) false, &pItem )) sParent = static_cast(pItem)->GetValue(); - if (sName.isEmpty() && m_xBasePool.get()) + if (sName.isEmpty() && m_xBasePool) sName = SfxStyleDialogController::GenerateUnusedName(*m_xBasePool, nFamily); Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq, nSlot); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 19ae175bc319..282f726996aa 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1587,7 +1587,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, if( IsMergeOk() && bMT_FILE ) { // save merged document - assert( aTempFile.get() ); + assert( aTempFile ); INetURLObject aTempFileURL; if (sDescriptorPrefix.isEmpty() || !rMergeDescriptor.bPrefixIsFilename) aTempFileURL.SetURL( aTempFile->GetURL() ); diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index a5eee7c4c96f..fae7d9cefc01 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1238,7 +1238,7 @@ void SwPagePreview::CreateScrollbar( bool bHori ) vcl::Window *pMDI = &GetViewFrame()->GetWindow(); VclPtr& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar; - assert(!ppScrollbar.get()); //check beforehand! + assert(!ppScrollbar); //check beforehand! ppScrollbar = VclPtr::Create( pMDI, bHori ); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index dbbfc6112146..12606618f8e2 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -298,7 +298,7 @@ void SwView::CreateScrollbar( bool bHori ) vcl::Window *pMDI = &GetViewFrame()->GetWindow(); VclPtr& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar; - assert(!ppScrollbar.get()); //check beforehand! + assert(!ppScrollbar); //check beforehand! ppScrollbar = VclPtr::Create( pMDI, bHori ); UpdateScrollbars(); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 39315dfd72fe..2a13d735b3bc 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -919,7 +919,7 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR } std::unique_ptr pBlock(pGlossaries->GetGroupDoc(sGroupName)); - const bool bResult = pBlock.get() && !pBlock->GetError() + const bool bResult = pBlock && !pBlock->GetError() && pDoc->InsertGlossary( *pBlock, sEntryName, InsertPaM); if(!bResult) -- cgit