diff options
44 files changed, 119 insertions, 134 deletions
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 9fad69016472..b9600216eb0e 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -842,7 +842,7 @@ void ObjectPage::DeleteCurrent() std::unique_ptr<weld::TreeIter> xCurEntry(m_xBasicBox->make_iterator()); if (!m_xBasicBox->get_cursor(xCurEntry.get())) xCurEntry.reset(); - DBG_ASSERT( xCurEntry.get(), "No current entry!" ); + DBG_ASSERT( xCurEntry, "No current entry!" ); EntryDescriptor aDesc( m_xBasicBox->GetEntryDescriptor( xCurEntry.get() ) ); const ScriptDocument& aDocument( aDesc.GetDocument() ); DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" ); diff --git a/canvas/source/cairo/cairo_canvascustomsprite.cxx b/canvas/source/cairo/cairo_canvascustomsprite.cxx index 0464a06d2b89..b885071787d5 100644 --- a/canvas/source/cairo/cairo_canvascustomsprite.cxx +++ b/canvas/source/cairo/cairo_canvascustomsprite.cxx @@ -42,7 +42,7 @@ namespace cairocanvas maSize( ::canvas::tools::roundUp( rSpriteSize.Width ), ::canvas::tools::roundUp( rSpriteSize.Height ) ) { - ENSURE_OR_THROW( rRefDevice.get(), + ENSURE_OR_THROW( rRefDevice, "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); SAL_INFO( "canvas.cairo", "sprite size: " << ::canvas::tools::roundUp( rSpriteSize.Width ) << ", " << ::canvas::tools::roundUp( rSpriteSize.Height )); diff --git a/canvas/source/cairo/cairo_spritehelper.cxx b/canvas/source/cairo/cairo_spritehelper.cxx index aafab160c51d..667f1ba249ba 100644 --- a/canvas/source/cairo/cairo_spritehelper.cxx +++ b/canvas/source/cairo/cairo_spritehelper.cxx @@ -45,7 +45,7 @@ namespace cairocanvas void SpriteHelper::init( const geometry::RealSize2D& rSpriteSize, const SpriteCanvasRef& rSpriteCanvas ) { - ENSURE_OR_THROW( rSpriteCanvas.get(), + ENSURE_OR_THROW( rSpriteCanvas, "SpriteHelper::init(): Invalid device, sprite canvas or surface" ); mpSpriteCanvas = rSpriteCanvas; diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx index c7ca59b28291..903a0edfc93b 100644 --- a/canvas/source/opengl/ogl_canvascustomsprite.cxx +++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx @@ -38,7 +38,7 @@ namespace oglcanvas mfAlpha(0.0), mfPriority(0.0) { - ENSURE_OR_THROW( rRefDevice.get(), + ENSURE_OR_THROW( rRefDevice, "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); ::canvas::tools::setIdentityAffineMatrix2D(maTransformation); diff --git a/canvas/source/opengl/ogl_textlayout.cxx b/canvas/source/opengl/ogl_textlayout.cxx index aa5a35296a97..89e7a16a681f 100644 --- a/canvas/source/opengl/ogl_textlayout.cxx +++ b/canvas/source/opengl/ogl_textlayout.cxx @@ -78,7 +78,7 @@ namespace oglcanvas { ::osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_THROW( mpFont.get(), + ENSURE_OR_THROW( mpFont, "TextLayout::queryTextBounds(): invalid font" ); // fake text bounds by either taking the advancement values, diff --git a/canvas/source/tools/canvascustomspritehelper.cxx b/canvas/source/tools/canvascustomspritehelper.cxx index ef02a9d5a418..156936a05e53 100644 --- a/canvas/source/tools/canvascustomspritehelper.cxx +++ b/canvas/source/tools/canvascustomspritehelper.cxx @@ -164,7 +164,7 @@ namespace canvas void CanvasCustomSpriteHelper::init( const geometry::RealSize2D& rSpriteSize, const SpriteSurface::Reference& rOwningSpriteCanvas ) { - ENSURE_OR_THROW( rOwningSpriteCanvas.get(), + ENSURE_OR_THROW( rOwningSpriteCanvas, "CanvasCustomSpriteHelper::init(): Invalid owning sprite canvas" ); mpSpriteCanvas = rOwningSpriteCanvas; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 07dc45574e64..981a442a2e6c 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -994,7 +994,7 @@ namespace vclcanvas const rendering::RenderState& renderState, ColorType eColorType ) const { - ENSURE_OR_THROW( mpOutDevProvider.get(), + ENSURE_OR_THROW( mpOutDevProvider, "outdev null. Are we disposed?" ); ::canvas::tools::verifyInput( renderState, @@ -1079,7 +1079,7 @@ namespace vclcanvas const rendering::RenderState& renderState, const uno::Reference< rendering::XCanvasFont >& xFont ) const { - ENSURE_OR_THROW( mpOutDevProvider.get(), + ENSURE_OR_THROW( mpOutDevProvider, "outdev null. Are we disposed?" ); OutputDevice& rOutDev( mpOutDevProvider->getOutDev() ); diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 81b79439a9ff..4e4c7168c3b3 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -798,7 +798,7 @@ void Chart2ExportTest::testEmbeddingsGrabBag() { aEmbeddingsList[j].Value >>= aEmbeddingXlsxStream; aEmbeddedfileName = aEmbeddingsList[j].Name; - CPPUNIT_ASSERT(aEmbeddingXlsxStream.get()); // Reference not empty + CPPUNIT_ASSERT(aEmbeddingXlsxStream); // Reference not empty CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(testEmbeddedFileNames[j]),aEmbeddedfileName); } } @@ -1536,7 +1536,7 @@ void Chart2ExportTest::testEmbeddingsOleObjectGrabBag() { aEmbeddingsList[j].Value >>= aEmbeddingXlsxStream; aEmbeddedfileName = aEmbeddingsList[j].Name; - CPPUNIT_ASSERT(aEmbeddingXlsxStream.get()); // Reference not empty + CPPUNIT_ASSERT(aEmbeddingXlsxStream); // Reference not empty CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(testEmbeddedFileNames[j]),aEmbeddedfileName); } } diff --git a/compilerplugins/clang/sharedvisitor/dummyplugin.hxx b/compilerplugins/clang/sharedvisitor/dummyplugin.hxx index b24157965df2..32e0e5e560ee 100644 --- a/compilerplugins/clang/sharedvisitor/dummyplugin.hxx +++ b/compilerplugins/clang/sharedvisitor/dummyplugin.hxx @@ -41,7 +41,6 @@ public: bool TraverseWhileStmt( WhileStmt* ) { return complain(); } bool TraverseDoStmt( DoStmt* ) { return complain(); } bool TraverseForStmt( ForStmt* ) { return complain(); } - bool TraverseParenExpr( ParenExpr* ) { return complain(); } bool TraverseUnaryLNot( UnaryOperator* ) { return complain(); } bool TraverseBinLAnd( BinaryOperator* ) { return complain(); } bool TraverseBinLOr( BinaryOperator* ) { return complain(); } diff --git a/compilerplugins/clang/simplifypointertobool.cxx b/compilerplugins/clang/simplifypointertobool.cxx index 4fc4901c3efe..46a80a770757 100644 --- a/compilerplugins/clang/simplifypointertobool.cxx +++ b/compilerplugins/clang/simplifypointertobool.cxx @@ -10,7 +10,6 @@ #include <algorithm> #include <cassert> #include <deque> -#include <stack> #include <string> #include <iostream> #include <fstream> @@ -234,28 +233,6 @@ public: return res; } - bool PreTraverseParenExpr(ParenExpr* expr) - { - parenExprs_.push(expr); - return true; - } - - bool PostTraverseParenExpr(ParenExpr*, bool) - { - assert(!parenExprs_.empty()); - parenExprs_.pop(); - return true; - } - - bool TraverseParenExpr(ParenExpr* expr) - { - auto res = PreTraverseParenExpr(expr); - assert(res); - res = FilteringRewritePlugin::TraverseParenExpr(expr); - PostTraverseParenExpr(expr, res); - return res; - } - private: bool isContextuallyConverted(Expr const* expr) const { @@ -318,8 +295,6 @@ private: //TODO: There are some more places where an expression is contextually converted to bool, but // those are probably not relevant for our needs here. std::deque<Expr const*> contextuallyConvertedExprs_; - - std::stack<ParenExpr const*> parenExprs_; }; bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castExpr) @@ -328,7 +303,7 @@ bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castEx return true; if (castExpr->getCastKind() != CK_PointerToBoolean) return true; - auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(castExpr->getSubExpr()); + auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(castExpr->getSubExpr()->IgnoreParens()); if (!memberCallExpr) return true; auto methodDecl = memberCallExpr->getMethodDecl(); @@ -395,17 +370,27 @@ bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castEx report(DiagnosticsEngine::Warning, "simplify, drop the get()", memberCallExpr->getExprLoc()) << memberCallExpr->getSourceRange(); } - else if (!parenExprs_.empty() && parenExprs_.top()->IgnoreImpCasts() == memberCallExpr) + else if (isa<ParenExpr>(castExpr->getSubExpr())) { - //TODO: attempt rewrite + if (rewriter) + { + auto const loc + = compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(memberCallExpr)); + auto const range = getCallSourceRange(memberCallExpr); + if (loc.isValid() && range.isValid() && insertText(loc, "bool") && removeText(range)) + { + //TODO: atomically only change both or neither + return true; + } + } report(DiagnosticsEngine::Warning, "simplify, drop the get() and turn the surrounding parentheses into a functional " "cast to bool", memberCallExpr->getExprLoc()) << memberCallExpr->getSourceRange(); report(DiagnosticsEngine::Note, "surrounding parentheses here", - parenExprs_.top()->getExprLoc()) - << parenExprs_.top()->getSourceRange(); + castExpr->getSubExpr()->getExprLoc()) + << castExpr->getSubExpr()->getSourceRange(); } else { diff --git a/compilerplugins/clang/test/simplifypointertobool.cxx b/compilerplugins/clang/test/simplifypointertobool.cxx index 18e1da607bb8..e4bf14c40f45 100644 --- a/compilerplugins/clang/test/simplifypointertobool.cxx +++ b/compilerplugins/clang/test/simplifypointertobool.cxx @@ -18,7 +18,8 @@ bool test1(std::unique_ptr<int> p2) foo(); // expected-error@+1 {{simplify, drop the get() and wrap the expression in a functional cast to bool [loplugin:simplifypointertobool]}} bool b1 = p2.get(); - //TODO: + // expected-error@+3 {{simplify, drop the get() and turn the surrounding parentheses into a functional cast to bool [loplugin:simplifypointertobool]}} + // expected-note@+1 {{surrounding parentheses here [loplugin:simplifypointertobool]}} bool b2 = ( // deliberately spread across multiple lines p2.get()); return b1 && b2; diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx index 60e3fd0ee868..7bb868d2ff1a 100644 --- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx @@ -106,7 +106,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nati #endif std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - OSL_ENSURE(pHelper.get(),"No stream helper!"); + OSL_ENSURE(pHelper,"No stream helper!"); jlong nReturn = pHelper ? pHelper->getSeek()->getPosition() : jlong(0); #ifdef HSQLDB_DBG @@ -130,7 +130,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Nati #endif std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - OSL_ENSURE(pHelper.get(),"No stream helper!"); + OSL_ENSURE(pHelper,"No stream helper!"); jlong nReturn = pHelper ? pHelper->getSeek()->getLength() :jlong(0); #ifdef HSQLDB_DBG diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx index bdafac4ee3ab..b16eaf742e1c 100644 --- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx +++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx @@ -140,7 +140,7 @@ extern "C" SAL_JNI_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stor "n < 0"); std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - OSL_ENSURE(pHelper.get(),"No stream helper!"); + OSL_ENSURE(pHelper,"No stream helper!"); if ( pHelper ) { Reference<XInputStream> xIn = pHelper->getInputStream(); @@ -202,7 +202,7 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora #endif std::shared_ptr<StreamHelper> pHelper = StorageContainer::getRegisteredStream(env,name,key); - OSL_ENSURE(pHelper.get(),"No stream helper!"); + OSL_ENSURE(pHelper,"No stream helper!"); Reference<XInputStream> xIn = pHelper ? pHelper->getInputStream() : Reference<XInputStream>(); if ( xIn.is() ) { diff --git a/cppcanvas/source/wrapper/implsprite.cxx b/cppcanvas/source/wrapper/implsprite.cxx index c3e1cbab3b9b..f7cd4eb77c97 100644 --- a/cppcanvas/source/wrapper/implsprite.cxx +++ b/cppcanvas/source/wrapper/implsprite.cxx @@ -46,7 +46,7 @@ namespace cppcanvas::internal OSL_ENSURE( rParentCanvas.is() , "ImplSprite::ImplSprite(): Invalid canvas"); OSL_ENSURE( mxGraphicDevice.is(), "ImplSprite::ImplSprite(): Invalid graphic device"); OSL_ENSURE( mxSprite.is(), "ImplSprite::ImplSprite(): Invalid sprite"); - OSL_ENSURE( mpTransformArbiter.get(), "ImplSprite::ImplSprite(): Invalid transformation arbiter"); + OSL_ENSURE( mpTransformArbiter, "ImplSprite::ImplSprite(): Invalid transformation arbiter"); } ImplSprite::~ImplSprite() diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index c7bb190ab34e..578574d933a5 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -766,7 +766,7 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr ) ActivateAggregate( tpColumnName ); ActivateAggregate( tpType ); - OSL_ENSURE(pFieldType.get(),"We need a type information here!"); + OSL_ENSURE(pFieldType,"We need a type information here!"); // If the type has changed, substitute Controls if( m_pPreviousType != pFieldType ) { diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 865a580b3947..e7c5a72ffbb3 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1074,7 +1074,7 @@ TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo) if ( !pTypeInfo ) // just a fallback pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo); - OSL_ENSURE(pTypeInfo.get(),"checkColumns: can't find a type which is usable as a key!"); + OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!"); return pTypeInfo; } diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 9ee4a596ec70..8a651ab764da 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2851,7 +2851,7 @@ void DesktopLOKTest::testMetricField() WindowUIObject aWinUI(pWin); std::unique_ptr<UIObject> pUIWin(aWinUI.get_child("selectwidth")); - CPPUNIT_ASSERT(pUIWin.get()); + CPPUNIT_ASSERT(pUIWin); StringMap aMap; aMap["VALUE"] = "75.06"; diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index d0a5952ba486..ceacc9e0084f 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -330,7 +330,7 @@ void VbaFormControl::importModelOrStorage( BinaryInputStream& rInStrm, StorageBa if( mxSiteModel->isContainer() ) { StorageRef xSubStrg = rStrg.openSubStorage( mxSiteModel->getSubStorageName(), false ); - OSL_ENSURE( xSubStrg.get(), "VbaFormControl::importModelOrStorage - cannot find storage for embedded control" ); + OSL_ENSURE( xSubStrg, "VbaFormControl::importModelOrStorage - cannot find storage for embedded control" ); if( xSubStrg ) importStorage( *xSubStrg, rClassTable ); } diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index 3434cb306d66..6e8a9c5039af 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -196,7 +196,7 @@ void VbaProject::importVbaData(const uno::Reference<io::XInputStream>& xInputStr void VbaProject::registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher ) { - OSL_ENSURE( rxAttacher.get(), "VbaProject::registerMacroAttacher - unexpected empty reference" ); + OSL_ENSURE( rxAttacher, "VbaProject::registerMacroAttacher - unexpected empty reference" ); maMacroAttachers.push_back( rxAttacher ); } @@ -263,7 +263,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap void VbaProject::readVbaModules( StorageBase& rVbaPrjStrg ) { StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( "VBA", false ); - OSL_ENSURE( xVbaStrg.get(), "VbaProject::readVbaModules - cannot open 'VBA' substorage" ); + OSL_ENSURE( xVbaStrg, "VbaProject::readVbaModules - cannot open 'VBA' substorage" ); if( !xVbaStrg ) return; @@ -425,7 +425,7 @@ void VbaProject::readVbaModules( StorageBase& rVbaPrjStrg ) void VbaProject::importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper ) { StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( "VBA", false ); - OSL_ENSURE( xVbaStrg.get(), "VbaProject::importModulesAndForms - cannot open 'VBA' substorage" ); + OSL_ENSURE( xVbaStrg, "VbaProject::importModulesAndForms - cannot open 'VBA' substorage" ); if( !xVbaStrg ) return; rtl_TextEncoding eTextEnc = RTL_TEXTENCODING_MS_1252; diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index fb8c4d86feb4..06fa6e4133fa 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -1984,7 +1984,7 @@ std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::R SdrModel& OReportDefinition::getSdrModelFromUnoModel() const { - OSL_ENSURE(m_pImpl->m_pReportModel.get(), "No SdrModel in ReportDesign, should not happen"); + OSL_ENSURE(m_pImpl->m_pReportModel, "No SdrModel in ReportDesign, should not happen"); return *m_pImpl->m_pReportModel; } diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index c7d6d97ea6de..3d95f28269c2 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -119,7 +119,7 @@ XclExpSstImpl::XclExpSstImpl() : sal_uInt32 XclExpSstImpl::Insert( XclExpStringRef xString ) { - OSL_ENSURE( xString.get(), "XclExpSstImpl::Insert - empty pointer not allowed" ); + OSL_ENSURE( xString, "XclExpSstImpl::Insert - empty pointer not allowed" ); if( !xString ) xString.reset( new XclExpString ); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 66525e1d0a43..052079812b7b 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -2217,7 +2217,7 @@ void XclExpFmlaCompImpl::PushOperandPos( sal_uInt16 nTokPos ) void XclExpFmlaCompImpl::PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperandListRef& rxOperands ) { PushOperandPos( nTokPos ); - OSL_ENSURE( rxOperands.get(), "XclExpFmlaCompImpl::AppendOperatorTokenId - missing operand list" ); + OSL_ENSURE( rxOperands, "XclExpFmlaCompImpl::AppendOperatorTokenId - missing operand list" ); if( mxData->maOpListVec.size() <= nTokPos ) mxData->maOpListVec.resize( nTokPos + 1, XclExpOperandListRef() ); mxData->maOpListVec[ nTokPos ] = rxOperands; diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 4232fa45ad23..67df16696434 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1910,14 +1910,14 @@ ScHTMLTable* ScHTMLTable::FindNestedTable( ScHTMLTableId nTableId ) const void ScHTMLTable::PutItem( const SfxPoolItem& rItem ) { - OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PutItem - no current entry" ); + OSL_ENSURE( mxCurrEntry, "ScHTMLTable::PutItem - no current entry" ); if( mxCurrEntry && mxCurrEntry->IsEmpty() ) mxCurrEntry->GetItemSet().Put( rItem ); } void ScHTMLTable::PutText( const HtmlImportInfo& rInfo ) { - OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PutText - no current entry" ); + OSL_ENSURE( mxCurrEntry, "ScHTMLTable::PutText - no current entry" ); if( mxCurrEntry ) { if( !mxCurrEntry->HasContents() && IsSpaceCharInfo( rInfo ) ) @@ -1956,7 +1956,7 @@ void ScHTMLTable::InsertLeadingEmptyLine() void ScHTMLTable::AnchorOn() { - OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::AnchorOn - no current entry" ); + OSL_ENSURE( mxCurrEntry, "ScHTMLTable::AnchorOn - no current entry" ); // don't skip entries with single hyperlinks if( mxCurrEntry ) mxCurrEntry->SetImportAlways(); @@ -2332,7 +2332,7 @@ bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rxEntry ) bool ScHTMLTable::PushEntry( const HtmlImportInfo& rInfo, bool bLastInCell ) { - OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PushEntry - no current entry" ); + OSL_ENSURE( mxCurrEntry, "ScHTMLTable::PushEntry - no current entry" ); bool bPushed = false; if( mxCurrEntry ) { diff --git a/sc/source/filter/inc/richstringcontext.hxx b/sc/source/filter/inc/richstringcontext.hxx index 43ddb9aa0dab..9ddd0a993f55 100644 --- a/sc/source/filter/inc/richstringcontext.hxx +++ b/sc/source/filter/inc/richstringcontext.hxx @@ -49,7 +49,7 @@ RichStringContext::RichStringContext( ParentType& rParent, RichStringRef xString mxString( xString ) { mbEnableTrimSpace = false; - OSL_ENSURE( mxString.get(), "RichStringContext::RichStringContext - missing string object" ); + OSL_ENSURE( mxString, "RichStringContext::RichStringContext - missing string object" ); } } // namespace xls diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx index 3e82ae71c028..268d7a929629 100644 --- a/sc/source/filter/oox/querytablebuffer.cxx +++ b/sc/source/filter/oox/querytablebuffer.cxx @@ -213,7 +213,7 @@ void QueryTable::importQueryTable( SequenceInputStream& rStrm ) void QueryTable::finalizeImport() { ConnectionRef xConnection = getConnections().getConnection( maModel.mnConnId ); - OSL_ENSURE( xConnection.get(), "QueryTable::finalizeImport - missing connection object" ); + OSL_ENSURE( xConnection, "QueryTable::finalizeImport - missing connection object" ); if( xConnection && (xConnection->getConnectionType() == BIFF12_CONNECTION_HTML) ) { // check that valid web query properties exist @@ -226,7 +226,7 @@ void QueryTable::finalizeImport() // resolve destination cell range (stored as defined name containing the range) OUString aDefName = maModel.maDefName.replace( ' ', '_' ).replace( '-', '_' ); DefinedNameRef xDefName = getDefinedNames().getByModelName( aDefName, getSheetIndex() ); - OSL_ENSURE( xDefName.get(), "QueryTable::finalizeImport - missing defined name" ); + OSL_ENSURE( xDefName, "QueryTable::finalizeImport - missing defined name" ); if( xDefName ) { ScRange aDestRange; diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 7c3264c18dc7..fd4b760c41be 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -141,7 +141,7 @@ void SheetDataBuffer::setStringCell( const CellModel& rModel, const OUString& rT void SheetDataBuffer::setStringCell( const CellModel& rModel, const RichStringRef& rxString ) { - OSL_ENSURE( rxString.get(), "SheetDataBuffer::setStringCell - missing rich string object" ); + OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich string object" ); const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( rModel.mnXfId ).get(); OUString aText; if( rxString->extractPlainString( aText, pFirstPortionFont ) ) diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index cd1515914663..802e515f09b0 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1712,7 +1712,7 @@ void Fill::importPatternFill( const AttributeList& rAttribs ) void Fill::importFgColor( const AttributeList& rAttribs ) { - OSL_ENSURE( mxPatternModel.get(), "Fill::importFgColor - missing pattern data" ); + OSL_ENSURE( mxPatternModel, "Fill::importFgColor - missing pattern data" ); if( mxPatternModel ) { mxPatternModel->maPatternColor.importColor( rAttribs ); @@ -1722,7 +1722,7 @@ void Fill::importFgColor( const AttributeList& rAttribs ) void Fill::importBgColor( const AttributeList& rAttribs ) { - OSL_ENSURE( mxPatternModel.get(), "Fill::importBgColor - missing pattern data" ); + OSL_ENSURE( mxPatternModel, "Fill::importBgColor - missing pattern data" ); if( mxPatternModel ) { mxPatternModel->maFillColor.importColor( rAttribs ); @@ -1743,7 +1743,7 @@ void Fill::importGradientFill( const AttributeList& rAttribs ) void Fill::importColor( const AttributeList& rAttribs, double fPosition ) { - OSL_ENSURE( mxGradientModel.get(), "Fill::importColor - missing gradient data" ); + OSL_ENSURE( mxGradientModel, "Fill::importColor - missing gradient data" ); if( mxGradientModel && (fPosition >= 0.0) ) mxGradientModel->maColors[ fPosition ].importColor( rAttribs ); } @@ -2853,7 +2853,7 @@ FontRef StylesBuffer::getDefaultFont() const // no font from styles - try first loaded font (e.g. BIFF2) if( !xDefFont ) xDefFont = maFonts.get( 0 ); - OSL_ENSURE( xDefFont.get(), "StylesBuffer::getDefaultFont - no default font found" ); + OSL_ENSURE( xDefFont, "StylesBuffer::getDefaultFont - no default font found" ); return xDefFont; } diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx index f70e7a91c9a7..215c7ce71f1e 100644 --- a/sc/source/filter/oox/viewsettings.cxx +++ b/sc/source/filter/oox/viewsettings.cxx @@ -559,7 +559,7 @@ void ViewSettings::finalizeImport() // use active sheet to set sheet properties that are document-global in Calc sal_Int16 nActiveSheet = getActiveCalcSheet(); SheetViewModelRef& rxActiveSheetView = maSheetViews[ nActiveSheet ]; - OSL_ENSURE( rxActiveSheetView.get(), "ViewSettings::finalizeImport - missing active sheet view settings" ); + OSL_ENSURE( rxActiveSheetView, "ViewSettings::finalizeImport - missing active sheet view settings" ); if( !rxActiveSheetView ) rxActiveSheetView = std::make_shared<SheetViewModel>(); diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 969a0a6c29ec..e6a531d88e1e 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -421,7 +421,7 @@ void WorkbookFragment::finalizeImport() { // create the WorksheetGlobals object WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, xSheetSegment, eSheetType, nCalcSheet ); - OSL_ENSURE( xSheetGlob.get(), "WorkbookFragment::finalizeImport - missing sheet in document" ); + OSL_ENSURE( xSheetGlob, "WorkbookFragment::finalizeImport - missing sheet in document" ); if( xSheetGlob ) { // create the sheet fragment handler diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 88cdd82cdcd6..0580e30bbbae 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -908,7 +908,7 @@ XclTxo::XclTxo( const XclExpRoot& rRoot, const EditTextObject& rEditObj, SdrObje void XclTxo::SaveCont( XclExpStream& rStrm ) { - OSL_ENSURE( mpString.get(), "XclTxo::SaveCont - missing string" ); + OSL_ENSURE( mpString, "XclTxo::SaveCont - missing string" ); // #i96858# do not save existing string formatting if text is empty sal_uInt16 nRunLen = mpString->IsEmpty() ? 0 : (8 * mpString->GetFormatsCount()); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index d1960223a1b9..25e19d9c7cc2 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -2970,7 +2970,7 @@ void SdImportTest::testOOXTheme() bTheme = true; uno::Reference<xml::dom::XDocument> aThemeDom; CPPUNIT_ASSERT(prop.Value >>= aThemeDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty + CPPUNIT_ASSERT(aThemeDom); // Reference not empty } } CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 1c6456d60c76..d01e46262c70 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1718,7 +1718,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres } } - DBG_ASSERT( pEffect.get(), "sd::EffectSequenceHelper::append(), failed!" ); + DBG_ASSERT( pEffect, "sd::EffectSequenceHelper::append(), failed!" ); return pEffect; } diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index 9629774072fc..c37c737023a8 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -173,7 +173,7 @@ Iterator OutlinerContainer::CreateSelectionIterator ( bool bDirectionIsForward, IteratorLocation aLocation) { - OSL_ASSERT(rpViewShell.get()); + OSL_ASSERT(rpViewShell); sal_Int32 nObjectIndex; @@ -212,7 +212,7 @@ Iterator OutlinerContainer::CreateDocumentIterator ( bool bDirectionIsForward, IteratorLocation aLocation) { - OSL_ASSERT(rpViewShell.get()); + OSL_ASSERT(rpViewShell); PageKind ePageKind; EditMode eEditMode; diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index ebae0d83276d..9fd3d536dbce 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1830,7 +1830,7 @@ void SlideShowImpl::removeShapeEventListener( // entry for this shape found -> remove listener from // helper object ENSURE_OR_THROW( - aIter->second.get(), + aIter->second, "SlideShowImpl::removeShapeEventListener(): " "listener map contains NULL broadcast helper" ); diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 10398f88e13f..979ab06424fa 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -831,7 +831,7 @@ bool SlideView::updateScreen() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN_FALSE( mpCanvas.get(), + ENSURE_OR_RETURN_FALSE( mpCanvas, "SlideView::updateScreen(): Disposed" ); return mpCanvas->updateScreen( false ); @@ -841,7 +841,7 @@ bool SlideView::paintScreen() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN_FALSE( mpCanvas.get(), + ENSURE_OR_RETURN_FALSE( mpCanvas, "SlideView::paintScreen(): Disposed" ); return mpCanvas->updateScreen( true ); diff --git a/svl/qa/unit/items/stylepool.cxx b/svl/qa/unit/items/stylepool.cxx index 2cc37b8d3bdc..c334360f5e3f 100644 --- a/svl/qa/unit/items/stylepool.cxx +++ b/svl/qa/unit/items/stylepool.cxx @@ -60,18 +60,18 @@ CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder) aStylePool.insertItemSet(aChild2, &aChild2Name); std::unique_ptr<IStylePoolIteratorAccess> pIter = aStylePool.createIterator(); std::shared_ptr<SfxItemSet> pStyle1 = pIter->getNext(); - CPPUNIT_ASSERT(pStyle1.get()); + CPPUNIT_ASSERT(pStyle1); const SfxStringItem* pItem1 = static_cast<const SfxStringItem*>(pStyle1->GetItem(1)); CPPUNIT_ASSERT_EQUAL(OUString("Item1"), pItem1->GetValue()); std::shared_ptr<SfxItemSet> pStyle2 = pIter->getNext(); - CPPUNIT_ASSERT(pStyle2.get()); + CPPUNIT_ASSERT(pStyle2); const SfxStringItem* pItem2 = static_cast<const SfxStringItem*>(pStyle2->GetItem(1)); // Without the accompanying fix in place, this test would have failed with 'Expected: Item2; // Actual: Item3'. The iteration order depended on the pointer address on the pointer // address of the parents. CPPUNIT_ASSERT_EQUAL(OUString("Item2"), pItem2->GetValue()); std::shared_ptr<SfxItemSet> pStyle3 = pIter->getNext(); - CPPUNIT_ASSERT(pStyle3.get()); + CPPUNIT_ASSERT(pStyle3); const SfxStringItem* pItem3 = static_cast<const SfxStringItem*>(pStyle3->GetItem(1)); CPPUNIT_ASSERT_EQUAL(OUString("Item3"), pItem3->GetValue()); CPPUNIT_ASSERT(!pIter->getNext()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 4df9baf213ea..e9dde46e3752 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -427,7 +427,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") bTheme = true; uno::Reference<xml::dom::XDocument> aThemeDom; CPPUNIT_ASSERT(prop.Value >>= aThemeDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aThemeDom.get()); // Reference not empty + CPPUNIT_ASSERT(aThemeDom); // Reference not empty } } CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements @@ -449,28 +449,28 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") bData = true; uno::Reference<xml::dom::XDocument> aDataDom; CPPUNIT_ASSERT(prop.Value >>= aDataDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aDataDom.get()); // Reference not empty + CPPUNIT_ASSERT(aDataDom); // Reference not empty } else if (prop.Name == "OOXLayout") { bLayout = true; uno::Reference<xml::dom::XDocument> aLayoutDom; CPPUNIT_ASSERT(prop.Value >>= aLayoutDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aLayoutDom.get()); // Reference not empty + CPPUNIT_ASSERT(aLayoutDom); // Reference not empty } else if (prop.Name == "OOXStyle") { bQStyle = true; uno::Reference<xml::dom::XDocument> aStyleDom; CPPUNIT_ASSERT(prop.Value >>= aStyleDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aStyleDom.get()); // Reference not empty + CPPUNIT_ASSERT(aStyleDom); // Reference not empty } else if (prop.Name == "OOXColor") { bColor = true; uno::Reference<xml::dom::XDocument> aColorDom; CPPUNIT_ASSERT(prop.Value >>= aColorDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aColorDom.get()); // Reference not empty + CPPUNIT_ASSERT(aColorDom); // Reference not empty } else if (prop.Name == "OOXDrawing") { @@ -479,7 +479,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") uno::Reference<xml::dom::XDocument> aDrawingDom; CPPUNIT_ASSERT(prop.Value >>= diagramDrawing); CPPUNIT_ASSERT(diagramDrawing[0] >>= aDrawingDom); // PropertyValue of proper type - CPPUNIT_ASSERT(aDrawingDom.get()); // Reference not empty + CPPUNIT_ASSERT(aDrawingDom); // Reference not empty } } CPPUNIT_ASSERT(bData && bLayout && bQStyle && bColor && bDrawing); // Grab Bag has all the expected elements @@ -541,7 +541,7 @@ DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx") sal_Int32 length = aCustomXmlDomList.getLength(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), length); aCustomXmlDom = aCustomXmlDomList[0]; - CPPUNIT_ASSERT(aCustomXmlDom.get()); // Reference not empty + CPPUNIT_ASSERT(aCustomXmlDom); // Reference not empty } } CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 9104497ccd2e..219ca13aee71 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -677,7 +677,7 @@ void HTMLTableCnts::Add( std::unique_ptr<HTMLTableCnts> pNewCnts ) inline void HTMLTableCnts::SetTableBox( SwTableBox *pBox ) { - OSL_ENSURE(m_xLayoutInfo.get(), "There is no layout info"); + OSL_ENSURE(m_xLayoutInfo, "There is no layout info"); if (m_xLayoutInfo) m_xLayoutInfo->SetTableBox(pBox); } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 95e96f9357b6..3b4ed85e97e2 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1281,7 +1281,7 @@ the appropriate set/ask field. long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, OUString &rOrigName, const OUString &rData) { - OSL_ENSURE(m_xPlcxMan.get(), "No pPlcxMan"); + OSL_ENSURE(m_xPlcxMan, "No pPlcxMan"); long nNo; /* If there was no bookmark associated with this set field, then we create a @@ -1344,7 +1344,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField, OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName) { OUString sName(BookmarkToWriter(rOrigName)); - OSL_ENSURE(m_xPlcxMan.get(), "no pPlcxMan"); + OSL_ENSURE(m_xPlcxMan, "no pPlcxMan"); m_xPlcxMan->GetBook()->MapName(sName); //See if there has been a variable set with this name, if so get diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index a171a6791292..789b82ae42e6 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -215,7 +215,7 @@ DocumentHolder PdfExportTest::exportAndParse(const OUString& rURL, const utl::Me maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); return pPdfDocument; } @@ -362,12 +362,12 @@ void PdfExportTest::testTdf105461() SvMemoryStream aMemory; aMemory.WriteStream(aFile); DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // Make sure there is a filled rectangle inside. int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); @@ -423,7 +423,7 @@ void PdfExportTest::testTdf107868() // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // Make sure there is no filled rectangle inside. int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); @@ -681,7 +681,7 @@ void PdfExportTest::testSofthyphenPos() // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // tdf#96892 incorrect fractional part of font size caused soft-hyphen to // be positioned inside preceding text (incorrect = 11.1, correct = 11.05) @@ -910,12 +910,12 @@ void PdfExportTest::testTdf108963() SvMemoryStream aMemory; aMemory.WriteStream(aFile); DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // FIXME: strangely this fails on some Win systems after a pdfium update, expected: 793.7; actual: 793 #if !defined _WIN32 @@ -1158,12 +1158,12 @@ void PdfExportTest::testTdf115117_1a() SvMemoryStream aMemory; aMemory.WriteStream(aFile); DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); auto pPdfTextPage = FPDFText_LoadPage(pPdfPage.get()); CPPUNIT_ASSERT(pPdfTextPage); @@ -1205,12 +1205,12 @@ void PdfExportTest::testTdf115117_2a() SvMemoryStream aMemory; aMemory.WriteStream(aFile); DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); auto pPdfTextPage = FPDFText_LoadPage(pPdfPage.get()); CPPUNIT_ASSERT(pPdfTextPage); @@ -1519,12 +1519,12 @@ void PdfExportTest::testTdf105954() aMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); // The document has one page. CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // There is a single image on the page. int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); @@ -1552,7 +1552,7 @@ void PdfExportTest::testTdf128630() // Assert the aspect ratio of the only bitmap on the page. PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); for (int i = 0; i < nPageObjectCount; ++i) { @@ -1586,7 +1586,7 @@ void PdfExportTest::testTdf106702() // First page already has the correct image position. PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); int nExpected = 0; int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); for (int i = 0; i < nPageObjectCount; ++i) @@ -1603,7 +1603,7 @@ void PdfExportTest::testTdf106702() // Second page had an incorrect image position. pPdfPage.reset(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); int nActual = 0; nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); for (int i = 0; i < nPageObjectCount; ++i) @@ -1644,7 +1644,7 @@ void PdfExportTest::testTdf113143() // First has the original (larger) image. PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); int nLarger = 0; int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); for (int i = 0; i < nPageObjectCount; ++i) @@ -1661,7 +1661,7 @@ void PdfExportTest::testTdf113143() // Second page has the scaled (smaller) image. pPdfPage.reset(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); int nSmaller = 0; nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); for (int i = 0; i < nPageObjectCount; ++i) @@ -1702,7 +1702,7 @@ void PdfExportTest::testTdf115262() // Get the 6th page. PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/5)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // Look up the position of the first image and the 400th row. FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get()); @@ -1746,7 +1746,7 @@ void PdfExportTest::testTdf121962() // Get the first page PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get()); // Make sure the table sum is displayed as "0", not faulty expression. @@ -1776,7 +1776,7 @@ void PdfExportTest::testTdf115967() // Get the first page PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get()); // Make sure the elements inside a formula in a RTL document are exported @@ -1873,11 +1873,11 @@ void PdfExportTest::testTocLink() maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // Ensure there is a link on the first page (in the ToC). int nStartPos = 0; @@ -1904,10 +1904,10 @@ void PdfExportTest::testReduceSmallImage() maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get())); FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0); CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(pPageObject)); @@ -1959,10 +1959,10 @@ void PdfExportTest::testReduceImage() maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get())); FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0); CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(pPageObject)); @@ -2001,7 +2001,7 @@ void PdfExportTest::testLinkWrongPage() // First page should have 1 link (2nd slide, 1st was hidden). PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); // Without the accompanying fix in place, this test would have failed, as the link of the first // page went to the second page due to the hidden first slide. @@ -2009,7 +2009,7 @@ void PdfExportTest::testLinkWrongPage() // Second page should have no links (3rd slide). PageHolder pPdfPage2(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/1)); - CPPUNIT_ASSERT(pPdfPage2.get()); + CPPUNIT_ASSERT(pPdfPage2); CPPUNIT_ASSERT(!HasLinksOnPage(pPdfPage2)); } @@ -2074,12 +2074,12 @@ void PdfExportTest::testPdfImageResourceInlineXObjectRef() maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); // Make sure that the page -> form -> form has a child image. PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); + CPPUNIT_ASSERT(pPdfPage); CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get())); FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0); CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pPageObject)); @@ -2133,7 +2133,7 @@ void PdfExportTest::testDefaultVersion() maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); int nFileVersion = 0; FPDF_GetFileVersion(pPdfDocument.get(), &nFileVersion); CPPUNIT_ASSERT_EQUAL(16, nFileVersion); @@ -2159,7 +2159,7 @@ void PdfExportTest::testVersion15() maMemory.WriteStream(aFile); DocumentHolder pPdfDocument( FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); + CPPUNIT_ASSERT(pPdfDocument); int nFileVersion = 0; FPDF_GetFileVersion(pPdfDocument.get(), &nFileVersion); CPPUNIT_ASSERT_EQUAL(15, nFileVersion); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 60e32fd8aa05..475e7d9b5f77 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1261,7 +1261,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) break; } - OSL_ENSURE(rContext.get(), "PropertyMap has to be valid!"); + OSL_ENSURE(rContext, "PropertyMap has to be valid!"); if(!rContext) return ; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 155105c466df..a88e50876b5c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1369,7 +1369,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con #endif const StyleSheetEntryPtr pEntry = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( GetCurrentParaStyleName() ); - OSL_ENSURE( pEntry.get(), "no style sheet found" ); + OSL_ENSURE( pEntry, "no style sheet found" ); const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : nullptr); bool isNumberingViaStyle(false); bool isNumberingViaRule = pParaContext && pParaContext->GetListId() > -1; @@ -3860,7 +3860,7 @@ void DomainMapper_Impl::AppendFieldCommand(OUString const & rPartOfCommand) #endif FieldContextPtr pContext = m_aFieldStack.back(); - OSL_ENSURE( pContext.get(), "no field context available"); + OSL_ENSURE( pContext, "no field context available"); if( pContext ) { pContext->AppendCommand( rPartOfCommand ); @@ -4832,7 +4832,7 @@ void DomainMapper_Impl::CloseFieldCommand() FieldContextPtr pContext; if(!m_aFieldStack.empty()) pContext = m_aFieldStack.back(); - OSL_ENSURE( pContext.get(), "no field context available"); + OSL_ENSURE( pContext, "no field context available"); if( pContext ) { m_bSetUserFieldContent = false; @@ -5640,7 +5640,7 @@ bool DomainMapper_Impl::IsFieldResultAsString() bool bRet = false; OSL_ENSURE( !m_aFieldStack.empty(), "field stack empty?"); FieldContextPtr pContext = m_aFieldStack.back(); - OSL_ENSURE( pContext.get(), "no field context available"); + OSL_ENSURE( pContext, "no field context available"); if( pContext ) { bRet = pContext->GetTextField().is() @@ -5716,7 +5716,7 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult) #endif FieldContextPtr pContext = m_aFieldStack.back(); - OSL_ENSURE( pContext.get(), "no field context available"); + OSL_ENSURE( pContext, "no field context available"); if (m_aFieldStack.size() > 1) { @@ -5882,7 +5882,7 @@ void DomainMapper_Impl::PopFieldContext() return; FieldContextPtr pContext = m_aFieldStack.back(); - OSL_ENSURE( pContext.get(), "no field context available"); + OSL_ENSURE( pContext, "no field context available"); if( pContext ) { if( !pContext->IsCommandCompleted() ) diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 762bd623a1d3..59fb4f8c2123 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -664,7 +664,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) if (nName != NS_ooxml::LN_CT_NumPicBullet_numPicBulletId) { - OSL_ENSURE( m_pCurrentDefinition.get(), "current entry has to be set here"); + OSL_ENSURE( m_pCurrentDefinition, "current entry has to be set here"); if(!m_pCurrentDefinition) return ; pCurrentLvl = m_pCurrentDefinition->GetCurrentLevel( ); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 1624b023ff34..481c8fd9db75 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2667,7 +2667,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) = new RTFReferenceProperties(aObjAttributes, aObjSprms); uno::Reference<drawing::XShape> xShape; RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape); - OSL_ASSERT(pShape.get()); + OSL_ASSERT(pShape); if (pShape) pShape->getAny() >>= xShape; if (xShape.is()) |