diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-21 07:51:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-01 08:26:24 +0200 |
commit | ed8152b1ed9baf859966fd21d6641dfba9c4467c (patch) | |
tree | b4f7b372433c5da3b8df41d026ff95fecece9ce6 /writerperfect/qa | |
parent | 6cb9b06432434fb3257118743780828b3b57326a (diff) |
improve loplugin:makeshared
to find places where we are converting stuff to unique_ptr
instead of using std::make_shared.
As a bonus, this tends to find places where we are using shared_ptr
where we can instead be using unique_ptr avoiding the locking overhead.
Change-Id: I1b57bbc4a6c766b48bba8e25a55161800e149f62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93207
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerperfect/qa')
-rw-r--r-- | writerperfect/qa/unit/EPUBExportTest.cxx | 6 | ||||
-rw-r--r-- | writerperfect/qa/unit/WPXSvStreamTest.cxx | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index c6518433de0e..cf50d2d9da52 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -111,7 +111,7 @@ void EPUBExportTest::createDoc(const OUString& rFile, xmlDocPtr EPUBExportTest::parseExport(const OUString& rName) { uno::Reference<io::XInputStream> xInputStream(mxZipFile->getByName(rName), uno::UNO_QUERY); - std::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); + std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); return parseXmlStream(pStream.get()); } @@ -120,7 +120,7 @@ std::map<OUString, std::vector<OUString>> EPUBExportTest::parseCss(const OUStrin std::map<OUString, std::vector<OUString>> aRet; uno::Reference<io::XInputStream> xInputStream(mxZipFile->getByName(rName), uno::UNO_QUERY); - std::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); + std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); // Minimal CSS handler till orcus is up to our needs. OString aLine; @@ -797,7 +797,7 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testSVG) CPPUNIT_ASSERT(mxZipFile->hasByName("OEBPS/images/image0001.svg")); uno::Reference<io::XInputStream> xInputStream( mxZipFile->getByName("OEBPS/images/image0001.svg"), uno::UNO_QUERY); - std::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); + std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); SvMemoryStream aMemoryStream; aMemoryStream.WriteStream(*pStream); diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index 368a8223368e..e9680510b43a 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -31,6 +31,7 @@ namespace ucb = com::sun::star::ucb; namespace uno = com::sun::star::uno; using std::shared_ptr; +using std::unique_ptr; using librevenge::RVNGInputStream; using librevenge::RVNG_SEEK_CUR; @@ -303,7 +304,7 @@ void WPXSvStreamTest::testStructured() // check for existing substream CPPUNIT_ASSERT(pInput->existsSubStream("WordDocument")); - shared_ptr<RVNGInputStream> pSubStream(pInput->getSubStreamByName("WordDocument")); + unique_ptr<RVNGInputStream> pSubStream(pInput->getSubStreamByName("WordDocument")); CPPUNIT_ASSERT(bool(pSubStream)); CPPUNIT_ASSERT(!pSubStream->isEnd()); @@ -325,7 +326,7 @@ void WPXSvStreamTest::testStructured() // check for existing substream CPPUNIT_ASSERT(pInput->existsSubStream("content.xml")); - shared_ptr<RVNGInputStream> pSubStream(pInput->getSubStreamByName("content.xml")); + unique_ptr<RVNGInputStream> pSubStream(pInput->getSubStreamByName("content.xml")); CPPUNIT_ASSERT(bool(pSubStream)); CPPUNIT_ASSERT(!pSubStream->isEnd()); |