From 175a2063effa1c5a3eab896c6c4b0d07f3588edb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 10 Jan 2020 12:30:24 +0200 Subject: use more std::make_shared found using 'git grep', I tried using clang-tidy, but it only successfully found a tiny fraction of these Change-Id: I61c7d85105ff7a911722750e759d6641d578da33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86526 Tested-by: Jenkins Reviewed-by: Noel Grandin --- slideshow/source/engine/expressionnodefactory.cxx | 16 ++++++++-------- slideshow/source/engine/screenupdater.cxx | 2 +- slideshow/source/engine/shapes/appletshape.cxx | 7 ++----- .../source/engine/shapes/drawinglayeranimation.cxx | 5 ++--- slideshow/source/engine/shapes/gdimtftools.cxx | 2 +- slideshow/source/engine/shapes/mediashape.cxx | 5 +---- slideshow/source/engine/slide/slideimpl.cxx | 18 +++++++++--------- slideshow/source/engine/slideview.cxx | 10 +++++----- slideshow/source/engine/smilfunctionparser.cxx | 5 ++--- 9 files changed, 31 insertions(+), 39 deletions(-) (limited to 'slideshow') diff --git a/slideshow/source/engine/expressionnodefactory.cxx b/slideshow/source/engine/expressionnodefactory.cxx index 74cfd96f8406..f82e09ac2f7e 100644 --- a/slideshow/source/engine/expressionnodefactory.cxx +++ b/slideshow/source/engine/expressionnodefactory.cxx @@ -192,48 +192,48 @@ namespace slideshow std::shared_ptr ExpressionNodeFactory::createConstantValueExpression( double rConstantValue ) { - return std::shared_ptr( new ConstantValueExpression(rConstantValue) ); + return std::make_shared(rConstantValue); } std::shared_ptr ExpressionNodeFactory::createValueTExpression() { - return std::shared_ptr( new TValueExpression() ); + return std::make_shared(); } std::shared_ptr ExpressionNodeFactory::createPlusExpression( const std::shared_ptr& rLHS, const std::shared_ptr& rRHS ) { - return std::shared_ptr( new PlusExpression(rLHS, rRHS) ); + return std::make_shared(rLHS, rRHS); } std::shared_ptr ExpressionNodeFactory::createMinusExpression( const std::shared_ptr& rLHS, const std::shared_ptr& rRHS ) { - return std::shared_ptr( new MinusExpression(rLHS, rRHS) ); + return std::make_shared(rLHS, rRHS); } std::shared_ptr ExpressionNodeFactory::createMultipliesExpression( const std::shared_ptr& rLHS, const std::shared_ptr& rRHS ) { - return std::shared_ptr( new MultipliesExpression(rLHS, rRHS) ); + return std::make_shared(rLHS, rRHS); } std::shared_ptr ExpressionNodeFactory::createDividesExpression( const std::shared_ptr& rLHS, const std::shared_ptr& rRHS ) { - return std::shared_ptr( new DividesExpression(rLHS, rRHS) ); + return std::make_shared(rLHS, rRHS); } std::shared_ptr ExpressionNodeFactory::createMinExpression ( const std::shared_ptr& rOuterFunction, const std::shared_ptr& rInnerFunction ) { - return std::shared_ptr( new MinExpression(rOuterFunction, rInnerFunction) ); + return std::make_shared(rOuterFunction, rInnerFunction); } std::shared_ptr ExpressionNodeFactory::createMaxExpression ( const std::shared_ptr& rOuterFunction, const std::shared_ptr& rInnerFunction ) { - return std::shared_ptr( new MaxExpression(rOuterFunction, rInnerFunction) ); + return std::make_shared(rOuterFunction, rInnerFunction); } } diff --git a/slideshow/source/engine/screenupdater.cxx b/slideshow/source/engine/screenupdater.cxx index cc609fecf97d..1053770d5b5c 100644 --- a/slideshow/source/engine/screenupdater.cxx +++ b/slideshow/source/engine/screenupdater.cxx @@ -213,7 +213,7 @@ namespace internal ::std::shared_ptr ScreenUpdater::createLock() { - return ::std::shared_ptr(new ::UpdateLock(*this)); + return ::std::make_shared<::UpdateLock>(*this); } diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx index f3b8edc9c02c..37f7b22be047 100644 --- a/slideshow/source/engine/shapes/appletshape.cxx +++ b/slideshow/source/engine/shapes/appletshape.cxx @@ -275,15 +275,12 @@ namespace slideshow std::size_t nNumPropEntries, const SlideShowContext& rContext ) { - std::shared_ptr< AppletShape > pAppletShape( - new AppletShape(xShape, + return std::make_shared(xShape, nPrio, rServiceName, pPropCopyTable, nNumPropEntries, - rContext) ); - - return pAppletShape; + rContext); } } } diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index b8b500936557..0e377c8b855b 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -910,9 +910,8 @@ std::shared_ptr createDrawingLayerAnimActivity( try { - std::shared_ptr const pWakeupEvent( - new WakeupEvent( rContext.mrEventQueue.getTimer(), - rContext.mrActivitiesQueue ) ); + auto const pWakeupEvent = std::make_shared( rContext.mrEventQueue.getTimer(), + rContext.mrActivitiesQueue ); pActivity.reset( new ActivityImpl( rContext, pWakeupEvent, pDrawShape ) ); pWakeupEvent->setActivity( pActivity ); } diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index a85a9cdc796c..19ea3d4f51b7 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -142,7 +142,7 @@ public: return xMtf; } - return GDIMetaFileSharedPtr(new GDIMetaFile(aGraphic.GetGDIMetaFile())); + return std::make_shared(aGraphic.GetGDIMetaFile()); } private: diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx index 9aa9009a9002..bd2522899156 100644 --- a/slideshow/source/engine/shapes/mediashape.cxx +++ b/slideshow/source/engine/shapes/mediashape.cxx @@ -241,10 +241,7 @@ namespace slideshow double nPrio, const SlideShowContext& rContext) { - std::shared_ptr< MediaShape > pMediaShape( - new MediaShape(xShape, nPrio, rContext)); - - return pMediaShape; + return std::make_shared(xShape, nPrio, rContext); } } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index c164f1e82a61..f58cca2128e6 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -1087,15 +1087,15 @@ SlideSharedPtr createSlide( const uno::Reference< drawing::XDrawPage >& bool bIntrinsicAnimationsAllowed, bool bDisableAnimationZOrder ) { - std::shared_ptr pRet( new SlideImpl( xDrawPage, xDrawPages, xRootNode, rEventQueue, - rEventMultiplexer, rScreenUpdater, - rActivitiesQueue, rUserEventQueue, - rCursorManager, rMediaFileManager, rViewContainer, - xComponentContext, rShapeListenerMap, - rShapeCursorMap, rPolyPolygonVector, rUserPaintColor, - dUserPaintStrokeWidth, bUserPaintEnabled, - bIntrinsicAnimationsAllowed, - bDisableAnimationZOrder )); + auto pRet = std::make_shared( xDrawPage, xDrawPages, xRootNode, rEventQueue, + rEventMultiplexer, rScreenUpdater, + rActivitiesQueue, rUserEventQueue, + rCursorManager, rMediaFileManager, rViewContainer, + xComponentContext, rShapeListenerMap, + rShapeCursorMap, rPolyPolygonVector, rUserPaintColor, + dUserPaintStrokeWidth, bUserPaintEnabled, + bIntrinsicAnimationsAllowed, + bDisableAnimationZOrder ); rEventMultiplexer.addViewHandler( pRet ); diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 9878bab7797f..21f382220eb9 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -823,11 +823,11 @@ ViewLayerSharedPtr SlideView::createViewLayer( const basegfx::B2DRange& rLayerBo if( nNumLayers > LAYER_ULLAGE ) pruneLayers(); - std::shared_ptr xViewLayer( new SlideViewLayer(mpCanvas, - getTransformation(), - rLayerBounds, - maUserSize, - this) ); + auto xViewLayer = std::make_shared(mpCanvas, + getTransformation(), + rLayerBounds, + maUserSize, + this); maViewLayers.push_back(xViewLayer); return xViewLayer; diff --git a/slideshow/source/engine/smilfunctionparser.cxx b/slideshow/source/engine/smilfunctionparser.cxx index 2ec3d8dc4d3c..a2da99a4f29e 100644 --- a/slideshow/source/engine/smilfunctionparser.cxx +++ b/slideshow/source/engine/smilfunctionparser.cxx @@ -247,10 +247,9 @@ namespace slideshow { // push complex node, that calcs the value on demand rNodeStack.push( - std::shared_ptr( - new UnaryFunctionExpression( + std::make_shared( maFunctor, - pArg ) ) ); + pArg ) ); } } -- cgit