diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-10 12:30:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-01-10 13:07:41 +0100 |
commit | 175a2063effa1c5a3eab896c6c4b0d07f3588edb (patch) | |
tree | 4a252a7e9e6e714343e9ff21c3d78c8e41086009 /sdext/source | |
parent | ddf901664d3dd12191f98b77182652a6889f2b26 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/pdfimport/pdfiadaptor.cxx | 3 | ||||
-rw-r--r-- | sdext/source/pdfimport/test/tests.cxx | 2 | ||||
-rw-r--r-- | sdext/source/pdfimport/tree/treevisitorfactory.cxx | 22 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterPaneBorderPainter.cxx | 3 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterTheme.cxx | 12 |
5 files changed, 17 insertions, 25 deletions
diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx b/sdext/source/pdfimport/pdfiadaptor.cxx index 4d12474f0edf..a496736dca78 100644 --- a/sdext/source/pdfimport/pdfiadaptor.cxx +++ b/sdext/source/pdfimport/pdfiadaptor.cxx @@ -227,8 +227,7 @@ bool PDFIRawAdaptor::parse( const uno::Reference<io::XInputStream>& xInput const OUString& rFilterOptions ) { // container for metaformat - std::shared_ptr<PDFIProcessor> pSink( - new PDFIProcessor(xStatus, m_xContext)); + auto pSink = std::make_shared<PDFIProcessor>(xStatus, m_xContext); bool bSuccess=false; diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index 0cf64eeec424..128352ad2e72 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -450,7 +450,7 @@ namespace void testXPDFParser() { #if HAVE_FEATURE_POPPLER - std::shared_ptr<TestSink> pSink( new TestSink() ); + auto pSink = std::make_shared<TestSink>(); CPPUNIT_ASSERT( pdfi::xpdf_ImportFromFile( m_directories.getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), diff --git a/sdext/source/pdfimport/tree/treevisitorfactory.cxx b/sdext/source/pdfimport/tree/treevisitorfactory.cxx index a9cf73cc2aa8..6131014e92bd 100644 --- a/sdext/source/pdfimport/tree/treevisitorfactory.cxx +++ b/sdext/source/pdfimport/tree/treevisitorfactory.cxx @@ -32,19 +32,19 @@ namespace pdfi virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override { - return std::shared_ptr<ElementTreeVisitor>(new WriterXmlOptimizer(rProc)); + return std::make_shared<WriterXmlOptimizer>(rProc); } virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( StyleContainer& rStyles, PDFIProcessor& rProc ) const override { - return std::shared_ptr<ElementTreeVisitor>(new WriterXmlFinalizer(rStyles,rProc)); + return std::make_shared<WriterXmlFinalizer>(rStyles,rProc); } virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override { - return std::shared_ptr<ElementTreeVisitor>(new WriterXmlEmitter(rEmitContext)); + return std::make_shared<WriterXmlEmitter>(rEmitContext); } }; @@ -54,21 +54,19 @@ namespace pdfi virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc)); + return std::make_shared<DrawXmlOptimizer>(rProc); } virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( StyleContainer& rStyles, PDFIProcessor& rProc ) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc)); + return std::make_shared<DrawXmlFinalizer>(rStyles,rProc); } virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext, - DrawXmlEmitter::IMPRESS_DOC - )); + return std::make_shared<DrawXmlEmitter>(rEmitContext, DrawXmlEmitter::IMPRESS_DOC); } }; @@ -78,21 +76,19 @@ namespace pdfi virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc)); + return std::make_shared<DrawXmlOptimizer>(rProc); } virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( StyleContainer& rStyles, PDFIProcessor& rProc ) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc)); + return std::make_shared<DrawXmlFinalizer>(rStyles,rProc); } virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override { - return std::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext, - DrawXmlEmitter::DRAW_DOC - )); + return std::make_shared<DrawXmlEmitter>(rEmitContext, DrawXmlEmitter::DRAW_DOC); } }; diff --git a/sdext/source/presenter/PresenterPaneBorderPainter.cxx b/sdext/source/presenter/PresenterPaneBorderPainter.cxx index e8ff0a50958d..d729ee06bae5 100644 --- a/sdext/source/presenter/PresenterPaneBorderPainter.cxx +++ b/sdext/source/presenter/PresenterPaneBorderPainter.cxx @@ -563,8 +563,7 @@ std::shared_ptr<RendererPaneStyle> sPaneStyleName = sStyleName; // Create a new pane style object and initialize it with bitmaps. - std::shared_ptr<RendererPaneStyle> pStyle ( - new RendererPaneStyle(mpTheme,sPaneStyleName)); + auto pStyle = std::make_shared<RendererPaneStyle>(mpTheme,sPaneStyleName); iStyle = maRendererPaneStyles.emplace(rsResourceURL, pStyle).first; } if (iStyle != maRendererPaneStyles.end()) diff --git a/sdext/source/presenter/PresenterTheme.cxx b/sdext/source/presenter/PresenterTheme.cxx index cd82d1dcd90d..6c512fce61a8 100644 --- a/sdext/source/presenter/PresenterTheme.cxx +++ b/sdext/source/presenter/PresenterTheme.cxx @@ -339,11 +339,10 @@ std::shared_ptr<PresenterConfigurationAccess> PresenterTheme::GetNodeForViewStyl return std::shared_ptr<PresenterConfigurationAccess>(); // Open configuration for writing. - std::shared_ptr<PresenterConfigurationAccess> pConfiguration ( - new PresenterConfigurationAccess( + auto pConfiguration = std::make_shared<PresenterConfigurationAccess>( mxContext, "/org.openoffice.Office.PresenterScreen/", - PresenterConfigurationAccess::READ_WRITE)); + PresenterConfigurationAccess::READ_WRITE); // Get configuration node for the view style container of the current // theme. @@ -700,8 +699,7 @@ PresenterTheme::SharedFontDescriptor ReadContext::ReadFont ( const Reference<beans::XPropertySet>& rxProperties, const PresenterTheme::SharedFontDescriptor& rpDefault) { - std::shared_ptr<PresenterTheme::FontDescriptor> pDescriptor ( - new PresenterTheme::FontDescriptor(rpDefault)); + auto pDescriptor = std::make_shared<PresenterTheme::FontDescriptor>(rpDefault); PresenterConfigurationAccess::GetProperty(rxProperties, "FamilyName") >>= pDescriptor->msFamilyName; PresenterConfigurationAccess::GetProperty(rxProperties, "Style") >>= pDescriptor->msStyleName; @@ -831,7 +829,7 @@ void PaneStyleContainer::ProcessPaneStyle( if (rValues.size() != 6) return; - std::shared_ptr<PaneStyle> pStyle (new PaneStyle()); + auto pStyle = std::make_shared<PaneStyle>(); rValues[0] >>= pStyle->msStyleName; @@ -946,7 +944,7 @@ void ViewStyleContainer::ProcessViewStyle( ReadContext const & rReadContext, const Reference<beans::XPropertySet>& rxProperties) { - std::shared_ptr<ViewStyle> pStyle (new ViewStyle()); + auto pStyle = std::make_shared<ViewStyle>(); PresenterConfigurationAccess::GetProperty(rxProperties, "StyleName") >>= pStyle->msStyleName; |