diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-02 10:40:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-03 10:51:57 +0200 |
commit | 054c0e7177cbef26942f8ca7cb7b1422ceea721c (patch) | |
tree | 7390a1be5ee0797b7f43d7d433822315fd75c6dd /sc | |
parent | 0f499af8c2c22ccc8f1c19edeeb2bdac8cbcb7f0 (diff) |
loplugin:simplifypointertobool improve
to look for the
x.get() != null
pattern, which can be simplified to
x
I'll do the
x.get() == nullptr
pattern in a separate patch, to reduce the chances of a mistake
Change-Id: I45e0d178e75359857cdf50d712039cb526016555
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95354
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/qa/extras/scpdfexport.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/bugfix-test.cxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/copy_paste_test.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_formula.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/document10.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/excel/xilink.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/richstring.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/linkuno.cxx | 2 |
10 files changed, 13 insertions, 13 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6e277f10a284..03ea2b9d4336 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1357,7 +1357,7 @@ public: /// If set, joining cells into shared formula groups will be delayed until reset again /// (RegroupFormulaCells() will be called as needed). void DelayFormulaGrouping( bool delay ); - bool IsDelayedFormulaGrouping() const { return pDelayedFormulaGrouping.get() != nullptr; } + bool IsDelayedFormulaGrouping() const { return bool(pDelayedFormulaGrouping); } /// To be used only by SharedFormulaUtil::joinFormulaCells(). void AddDelayedFormulaGroupingCell( const ScFormulaCell* cell ); diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index 070721dcd091..7b9610061bdb 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -232,7 +232,7 @@ void ScPDFExportTest::testExportRange_Tdf120161() SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent); CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh.get() != nullptr); + CPPUNIT_ASSERT(xDocSh); // put some content into the first row with default font ScDocument& rDoc = xDocSh->GetDocument(); @@ -291,7 +291,7 @@ void ScPDFExportTest::testExportFitToPage_Tdf103516() SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent); CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh.get() != nullptr); + CPPUNIT_ASSERT(xDocSh); // put some content into the table ScDocument& rDoc = xDocSh->GetDocument(); diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index 2b2523319cec..bf09da9872f2 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -164,7 +164,7 @@ void ScFiltersTest::testTdf91979() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh.get() != nullptr); + CPPUNIT_ASSERT(xDocSh); // Get the document controller ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index e81c0eee0957..49d949b2035d 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -117,7 +117,7 @@ void ScCopyPasteTest::testCopyPasteXLS() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh.get() != nullptr); + CPPUNIT_ASSERT(xDocSh); // Get the document controller pViewShell = xDocSh->GetBestViewShell(false); @@ -185,7 +185,7 @@ void ScCopyPasteTest::testTdf84411() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh.get() != nullptr); + CPPUNIT_ASSERT(xDocSh); uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); CPPUNIT_ASSERT( xModel2.is() ); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 920350424fb8..eb8e0f555a52 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -6591,7 +6591,7 @@ void Test::testExternalRef() // have been cached. ScExternalRefCache::TableTypeRef pCacheTab = pRefMgr->getCacheTable( nFileId, aExtSh1Name, false); - CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 1 should exist.", pCacheTab.get() != nullptr); + CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 1 should exist.", pCacheTab); ScRange aCachedRange = getCachedRange(pCacheTab); CPPUNIT_ASSERT_MESSAGE("Unexpected cached data range.", aCachedRange.aStart.Col() == 0 && aCachedRange.aEnd.Col() == 1 && @@ -6603,7 +6603,7 @@ void Test::testExternalRef() // Sheet3's row 5 is not referenced; it should not be cached. pCacheTab = pRefMgr->getCacheTable(nFileId, aExtSh3Name, false); - CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 3 should exist.", pCacheTab.get() != nullptr); + CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 3 should exist.", pCacheTab); aCachedRange = getCachedRange(pCacheTab); CPPUNIT_ASSERT_MESSAGE("Unexpected cached data range.", aCachedRange.aStart.Col() == 0 && aCachedRange.aEnd.Col() == 1 && diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index b04ac76e06ab..85158474cb0a 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -383,7 +383,7 @@ void ScDocument::DelayFormulaGrouping( bool delay ) } else { - if( pDelayedFormulaGrouping.get() != nullptr && pDelayedFormulaGrouping->IsValid()) + if( pDelayedFormulaGrouping && pDelayedFormulaGrouping->IsValid()) RegroupFormulaCells( *pDelayedFormulaGrouping ); pDelayedFormulaGrouping.reset(); } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 3d95f28269c2..e8aedefa8f42 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -530,7 +530,7 @@ void XclExpHyperlink::SaveXml( XclExpXmlStream& rStrm ) FSNS( XML_r, XML_id ), !sId.isEmpty() ? sId.toUtf8().getStr() : nullptr, - XML_location, mxTextMark.get() != nullptr + XML_location, mxTextMark ? XclXmlUtils::ToOString( *mxTextMark ).getStr() : nullptr, // OOXTODO: XML_tooltip, from record HLinkTooltip 800h wzTooltip diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 0c2297cf8458..9d4e1c8342a3 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -545,7 +545,7 @@ bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl, bool XclImpExtName::HasFormulaTokens() const { - return (mxArray.get() != nullptr); + return bool(mxArray); } // Cached external cells ====================================================== diff --git a/sc/source/filter/inc/richstring.hxx b/sc/source/filter/inc/richstring.hxx index 71de809efeb7..3db609828a86 100644 --- a/sc/source/filter/inc/richstring.hxx +++ b/sc/source/filter/inc/richstring.hxx @@ -55,7 +55,7 @@ public: /** Returns the text data of this portion. */ const OUString& getText() const { return maText; } /** Returns true, if the portion contains font formatting. */ - bool hasFont() const { return mxFont.get() != nullptr; } + bool hasFont() const { return bool(mxFont); } /** Converts the portion and replaces or appends to the passed XText. */ void convert( diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index 29972fac20a6..b9d556c783a9 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -1541,7 +1541,7 @@ sal_Bool SAL_CALL ScExternalDocLinkObj::hasByName(const OUString &aName) // #i116940# be consistent with getByName: allow only table names which have a cache already ScExternalRefCache::TableTypeRef pTable = mpRefMgr->getCacheTable(mnFileId, aName, false); - return (pTable.get() != nullptr); + return bool(pTable); } sal_Int32 SAL_CALL ScExternalDocLinkObj::getCount() |