From 1491b0003a03064a3cec30fc71c35d46eb6970b2 Mon Sep 17 00:00:00 2001 From: Noel Date: Wed, 17 Feb 2021 18:23:05 +0200 Subject: loplugin:referencecasting in writerperfect Change-Id: I2b8dfca7344caa4b9dd503fc3fca383a6cee8f04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111077 Tested-by: Jenkins Reviewed-by: Noel Grandin --- writerperfect/qa/unit/DrawingImportTest.cxx | 4 ++-- writerperfect/qa/unit/PresentationImportTest.cxx | 4 ++-- writerperfect/qa/unit/SpreadsheetImportTest.cxx | 4 ++-- writerperfect/qa/unit/TextImportTest.cxx | 4 ++-- writerperfect/qa/unit/wpftimport.cxx | 2 +- writerperfect/source/writer/EPUBPackage.cxx | 3 +-- writerperfect/source/writer/exp/XMLTextFrameContext.cxx | 2 +- writerperfect/source/writer/exp/xmlfmt.cxx | 2 +- writerperfect/source/writer/exp/xmlimp.cxx | 3 +-- 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/writerperfect/qa/unit/DrawingImportTest.cxx b/writerperfect/qa/unit/DrawingImportTest.cxx index 6fb1f98ef6b2..8af2ec8d62b7 100644 --- a/writerperfect/qa/unit/DrawingImportTest.cxx +++ b/writerperfect/qa/unit/DrawingImportTest.cxx @@ -123,8 +123,8 @@ void DrawingImportTest::test() using namespace css; rtl::Reference xFilter{ new DrawingImportFilter(m_xContext) }; - writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter.get(), - "private:factory/sdraw", m_xDesktop, m_xContext); + writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter, "private:factory/sdraw", + m_xDesktop, m_xContext); uno::Reference xDoc(aLoader.getDocument(), uno::UNO_QUERY); CPPUNIT_ASSERT(xDoc.is()); diff --git a/writerperfect/qa/unit/PresentationImportTest.cxx b/writerperfect/qa/unit/PresentationImportTest.cxx index e1414dec5b85..0c29c72695df 100644 --- a/writerperfect/qa/unit/PresentationImportTest.cxx +++ b/writerperfect/qa/unit/PresentationImportTest.cxx @@ -123,8 +123,8 @@ void PresentationImportTest::test() using namespace css; rtl::Reference xFilter{ new PresentationImportFilter(m_xContext) }; - writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter.get(), - "private:factory/simpress", m_xDesktop, m_xContext); + writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter, "private:factory/simpress", + m_xDesktop, m_xContext); uno::Reference xDoc(aLoader.getDocument(), uno::UNO_QUERY); CPPUNIT_ASSERT(xDoc.is()); diff --git a/writerperfect/qa/unit/SpreadsheetImportTest.cxx b/writerperfect/qa/unit/SpreadsheetImportTest.cxx index caf5d4de94ec..3c5de090ce1c 100644 --- a/writerperfect/qa/unit/SpreadsheetImportTest.cxx +++ b/writerperfect/qa/unit/SpreadsheetImportTest.cxx @@ -117,8 +117,8 @@ void SpreadsheetImportTest::test() using namespace css; rtl::Reference xFilter{ new SpreadsheetImportFilter(m_xContext) }; - writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter.get(), - "private:factory/scalc", m_xDesktop, m_xContext); + writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter, "private:factory/scalc", + m_xDesktop, m_xContext); uno::Reference xDoc(aLoader.getDocument(), uno::UNO_QUERY); CPPUNIT_ASSERT(xDoc.is()); diff --git a/writerperfect/qa/unit/TextImportTest.cxx b/writerperfect/qa/unit/TextImportTest.cxx index 0b482a75c9a3..c1ff7ad75ff2 100644 --- a/writerperfect/qa/unit/TextImportTest.cxx +++ b/writerperfect/qa/unit/TextImportTest.cxx @@ -111,8 +111,8 @@ void TextImportTest::test() using namespace css; rtl::Reference xFilter{ new TextImportFilter(m_xContext) }; - writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter.get(), - "private:factory/swriter", m_xDesktop, m_xContext); + writerperfect::test::WpftLoader aLoader(createDummyInput(), xFilter, "private:factory/swriter", + m_xDesktop, m_xContext); uno::Reference xDoc(aLoader.getDocument(), uno::UNO_QUERY); CPPUNIT_ASSERT(xDoc.is()); diff --git a/writerperfect/qa/unit/wpftimport.cxx b/writerperfect/qa/unit/wpftimport.cxx index fe3bfa02f9a6..5034f159e704 100644 --- a/writerperfect/qa/unit/wpftimport.cxx +++ b/writerperfect/qa/unit/wpftimport.cxx @@ -21,7 +21,7 @@ css::uno::Reference createDummyInput() { rtl::Reference xDummyInput( new comphelper::SequenceInputStream(css::uno::Sequence())); - return xDummyInput.get(); + return xDummyInput; } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerperfect/source/writer/EPUBPackage.cxx b/writerperfect/source/writer/EPUBPackage.cxx index 914983e97580..fe5cbf069ce4 100644 --- a/writerperfect/source/writer/EPUBPackage.cxx +++ b/writerperfect/source/writer/EPUBPackage.cxx @@ -87,8 +87,7 @@ void EPUBPackage::openElement(const char* pName, const librevenge::RVNGPropertyL pAttributeList->AddAttribute(OUString::fromUtf8(it.key()), OUString::fromUtf8(it()->getStr().cstr())); - mxOutputWriter->startElement(OUString::fromUtf8(pName), - uno::Reference(pAttributeList.get())); + mxOutputWriter->startElement(OUString::fromUtf8(pName), pAttributeList); } void EPUBPackage::closeElement(const char* pName) diff --git a/writerperfect/source/writer/exp/XMLTextFrameContext.cxx b/writerperfect/source/writer/exp/XMLTextFrameContext.cxx index 60cc3d87f94a..4c6ca118efd2 100644 --- a/writerperfect/source/writer/exp/XMLTextFrameContext.cxx +++ b/writerperfect/source/writer/exp/XMLTextFrameContext.cxx @@ -96,7 +96,7 @@ rtl::Reference XMLTextImageContext::CreateChildContext( if (rName == "office:binary-data") { m_xBinaryData = new XMLBase64ImportContext(GetImport()); - return m_xBinaryData.get(); + return m_xBinaryData; } return nullptr; } diff --git a/writerperfect/source/writer/exp/xmlfmt.cxx b/writerperfect/source/writer/exp/xmlfmt.cxx index f34540dddc1e..4ac70b85a3b1 100644 --- a/writerperfect/source/writer/exp/xmlfmt.cxx +++ b/writerperfect/source/writer/exp/xmlfmt.cxx @@ -227,7 +227,7 @@ rtl::Reference XMLFontFaceUriContext::CreateChildContext( if (rName == "office:binary-data") { mxBinaryData = new XMLBase64ImportContext(GetImport()); - return mxBinaryData.get(); + return mxBinaryData; } if (rName == "svg:font-face-format") return new XMLFontFaceFormatContext(GetImport(), *this); diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx index 62d004197f67..3efd6eab7ddd 100644 --- a/writerperfect/source/writer/exp/xmlimp.cxx +++ b/writerperfect/source/writer/exp/xmlimp.cxx @@ -188,8 +188,7 @@ void FindXMPMetadata(const uno::Reference& xContext, aInputSource.aInputStream = xStream; uno::Reference xParser = xml::sax::Parser::create(xContext); rtl::Reference xXMP(new XMPParser(rMetaData)); - uno::Reference xDocumentHandler(xXMP.get()); - xParser->setDocumentHandler(xDocumentHandler); + xParser->setDocumentHandler(xXMP); try { xParser->parseStream(aInputSource); -- cgit v1.2.3