From f3d9aab8410c00298f29ca0194c5d33d53c63ff2 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 5 May 2016 09:46:12 +0200 Subject: teach passstuffbyref plugin to check for.. unnecessarily passing primitives by const ref. Suggested by Tor Lillqvist Change-Id: I445e220542969ca3e252581e5953fb01cb2b2be6 Reviewed-on: https://gerrit.libreoffice.org/24672 Reviewed-by: Tor Lillqvist Tested-by: Jenkins Reviewed-by: Noel Grandin --- writerfilter/inc/ooxml/OOXMLDocument.hxx | 6 ++--- writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 22 ++++++++--------- writerfilter/source/ooxml/OOXMLDocumentImpl.hxx | 8 +++---- .../source/ooxml/OOXMLFastContextHandler.cxx | 28 +++++++++++----------- .../source/ooxml/OOXMLFastContextHandler.hxx | 14 +++++------ 5 files changed, 39 insertions(+), 39 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx index 525e08aad3e5..6a3370fc8163 100644 --- a/writerfilter/inc/ooxml/OOXMLDocument.hxx +++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx @@ -138,7 +138,7 @@ public: @param rNoteId id of the footnote to resolve */ virtual void resolveFootnote(Stream & rStream, - const Id & rNoteType, + Id aNoteType, const sal_Int32 nNoteId) = 0; /** Resolves an endnote to a stream handler. @@ -151,7 +151,7 @@ public: @param rNoteId id of the endnote to resolve */ virtual void resolveEndnote(Stream & rStream, - const Id & rNoteType, + Id aNoteType, const sal_Int32 NoteId) = 0; /** @@ -220,7 +220,7 @@ public: virtual css::uno::Reference getInputStreamForId(const OUString & rId) = 0; virtual void setXNoteId(const sal_Int32 nId) = 0; virtual sal_Int32 getXNoteId() const = 0; - virtual void setXNoteType(const Id & nId) = 0; + virtual void setXNoteType(Id nId) = 0; virtual const OUString & getTarget() const = 0; virtual css::uno::Reference getShapeContext( ) = 0; virtual void setShapeContext( css::uno::Reference xContext ) = 0; diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 180a2b0ae662..78b39078951d 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -250,7 +250,7 @@ sal_Int32 OOXMLDocumentImpl::getXNoteId() const return mnXNoteId; } -void OOXMLDocumentImpl::setXNoteType(const Id & nId) +void OOXMLDocumentImpl::setXNoteType(Id nId) { mXNoteType = nId; } @@ -276,7 +276,7 @@ OOXMLDocumentImpl::getSubStream(const OUString & rId) } writerfilter::Reference::Pointer_t -OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rType, +OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, Id aType, const sal_Int32 nId) { OOXMLStream::Pointer_t pStream = @@ -284,7 +284,7 @@ OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rT // See above, no status indicator for the note stream, either. OOXMLDocumentImpl * pDocument = new OOXMLDocumentImpl(pStream, uno::Reference(), mbSkipImages, maMediaDescriptor); pDocument->setXNoteId(nId); - pDocument->setXNoteType(rType); + pDocument->setXNoteType(aType); pDocument->setModel(getModel()); pDocument->setDrawPage(getDrawPage()); @@ -292,18 +292,18 @@ OOXMLDocumentImpl::getXNoteStream(OOXMLStream::StreamType_t nType, const Id & rT } void OOXMLDocumentImpl::resolveFootnote(Stream & rStream, - const Id & rType, + Id aType, const sal_Int32 nNoteId) { writerfilter::Reference::Pointer_t pStream = - getXNoteStream(OOXMLStream::FOOTNOTES, rType, nNoteId); + getXNoteStream(OOXMLStream::FOOTNOTES, aType, nNoteId); Id nId; - switch (rType) + switch (aType) { case NS_ooxml::LN_Value_doc_ST_FtnEdn_separator: case NS_ooxml::LN_Value_doc_ST_FtnEdn_continuationSeparator: - nId = rType; + nId = aType; break; default: nId = NS_ooxml::LN_footnote; @@ -314,18 +314,18 @@ void OOXMLDocumentImpl::resolveFootnote(Stream & rStream, } void OOXMLDocumentImpl::resolveEndnote(Stream & rStream, - const Id & rType, + Id aType, const sal_Int32 nNoteId) { writerfilter::Reference::Pointer_t pStream = - getXNoteStream(OOXMLStream::ENDNOTES, rType, nNoteId); + getXNoteStream(OOXMLStream::ENDNOTES, aType, nNoteId); Id nId; - switch (rType) + switch (aType) { case NS_ooxml::LN_Value_doc_ST_FtnEdn_separator: case NS_ooxml::LN_Value_doc_ST_FtnEdn_continuationSeparator: - nId = rType; + nId = aType; break; default: nId = NS_ooxml::LN_endnote; diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx index e8da24dd2929..3c2970478d44 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx @@ -84,7 +84,7 @@ protected: writerfilter::Reference::Pointer_t getXNoteStream(OOXMLStream::StreamType_t nType, - const Id & rType, + Id aType, const sal_Int32 nNoteId); void setIsSubstream( bool bSubstream ) { mbIsSubstream = bSubstream; }; @@ -99,10 +99,10 @@ public: virtual void resolve(Stream & rStream) override; virtual void resolveFootnote(Stream & rStream, - const Id & rType, + Id aType, const sal_Int32 nNoteId) override; virtual void resolveEndnote(Stream & rStream, - const Id & rType, + Id aType, const sal_Int32 nNoteId) override; virtual void resolveHeader(Stream & rStream, const sal_Int32 type, @@ -126,7 +126,7 @@ public: virtual css::uno::Reference getInputStreamForId(const OUString & rId) override; virtual void setXNoteId(const sal_Int32 nId) override; virtual sal_Int32 getXNoteId() const override; - virtual void setXNoteType(const Id & rId) override; + virtual void setXNoteType(Id aId) override; virtual const OUString & getTarget() const override; virtual css::uno::Reference getShapeContext( ) override; virtual void setShapeContext( css::uno::Reference xContext ) override; diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 7cc6e2c9f122..30eb8a8f9df2 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -475,7 +475,7 @@ void OOXMLFastContextHandler::setLastSectionGroup() } void OOXMLFastContextHandler::newProperty -(const Id & /*nId*/, const OOXMLValue::Pointer_t& /*pVal*/) +(Id /*nId*/, const OOXMLValue::Pointer_t& /*pVal*/) { } @@ -649,12 +649,12 @@ void OOXMLFastContextHandler::propagateCharacterProperties() mpParserState->setCharacterProperties(getPropertySet()); } -void OOXMLFastContextHandler::propagateCharacterPropertiesAsSet(const Id & rId) +void OOXMLFastContextHandler::propagateCharacterPropertiesAsSet(Id nId) { OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet())); OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet); - OOXMLProperty::Pointer_t pProp(new OOXMLProperty(rId, pValue, OOXMLProperty::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(nId, pValue, OOXMLProperty::SPRM)); pPropertySet->add(pProp); mpParserState->setCharacterProperties(pPropertySet); @@ -698,12 +698,12 @@ void OOXMLFastContextHandler::clearTableProps() (new OOXMLPropertySet)); } -void OOXMLFastContextHandler::sendPropertiesWithId(const Id & rId) +void OOXMLFastContextHandler::sendPropertiesWithId(Id nId) { OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet())); OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySet); - OOXMLProperty::Pointer_t pProp(new OOXMLProperty(rId, pValue, OOXMLProperty::SPRM)); + OOXMLProperty::Pointer_t pProp(new OOXMLProperty(nId, pValue, OOXMLProperty::SPRM)); pPropertySet->add(pProp); mpStream->props(pPropertySet); @@ -877,12 +877,12 @@ OOXMLFastContextHandlerStream::~OOXMLFastContextHandlerStream() { } -void OOXMLFastContextHandlerStream::newProperty(const Id & rId, +void OOXMLFastContextHandlerStream::newProperty(Id nId, const OOXMLValue::Pointer_t& pVal) { - if (rId != 0x0) + if (nId != 0x0) { - OOXMLProperty::Pointer_t pProperty(new OOXMLProperty(rId, pVal, OOXMLProperty::ATTRIBUTE)); + OOXMLProperty::Pointer_t pProperty(new OOXMLProperty(nId, pVal, OOXMLProperty::ATTRIBUTE)); mpPropertySetAttrs->add(pProperty); } @@ -952,11 +952,11 @@ OOXMLValue::Pointer_t OOXMLFastContextHandlerProperties::getValue() const } void OOXMLFastContextHandlerProperties::newProperty -(const Id & rId, const OOXMLValue::Pointer_t& pVal) +(Id nId, const OOXMLValue::Pointer_t& pVal) { - if (rId != 0x0) + if (nId != 0x0) { - OOXMLProperty::Pointer_t pProperty(new OOXMLProperty(rId, pVal, OOXMLProperty::ATTRIBUTE)); + OOXMLProperty::Pointer_t pProperty(new OOXMLProperty(nId, pVal, OOXMLProperty::ATTRIBUTE)); mpPropertySet->add(pProperty); } @@ -1760,7 +1760,7 @@ OOXMLFastContextHandlerWrapper::getResource() const return UNKNOWN; } -void OOXMLFastContextHandlerWrapper::addNamespace(const Id & nId) +void OOXMLFastContextHandlerWrapper::addNamespace(Id nId) { mMyNamespaces.insert(nId); } @@ -1844,13 +1844,13 @@ OOXMLFastContextHandlerWrapper::getFastContextHandler() const } void OOXMLFastContextHandlerWrapper::newProperty -(const Id & rId, const OOXMLValue::Pointer_t& pVal) +(Id nId, const OOXMLValue::Pointer_t& pVal) { if (mxContext.is()) { OOXMLFastContextHandler * pHandler = getFastContextHandler(); if (pHandler != nullptr) - pHandler->newProperty(rId, pVal); + pHandler->newProperty(nId, pVal); } } diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index d50d46e1e513..11f2ea921364 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -99,7 +99,7 @@ public: virtual void attributes(const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) throw (css::uno::RuntimeException, css::xml::sax::SAXException); - virtual void newProperty(const Id & rId, const OOXMLValue::Pointer_t& pVal); + virtual void newProperty(Id aId, const OOXMLValue::Pointer_t& pVal); virtual void setPropertySet(const OOXMLPropertySet::Pointer_t& pPropertySet); virtual OOXMLPropertySet::Pointer_t getPropertySet() const; @@ -171,11 +171,11 @@ public: void startTxbxContent(); void endTxbxContent(); void propagateCharacterProperties(); - void propagateCharacterPropertiesAsSet(const Id & rId); + void propagateCharacterPropertiesAsSet(Id nId); void propagateTableProperties(); void propagateRowProperties(); void propagateCellProperties(); - void sendPropertiesWithId(const Id & rId); + void sendPropertiesWithId(Id nId); void sendPropertiesToParent(); void sendCellProperties(); void sendRowProperties(); @@ -247,7 +247,7 @@ public: const OOXMLPropertySet::Pointer_t& getPropertySetAttrs() const { return mpPropertySetAttrs;} - virtual void newProperty(const Id & rId, const OOXMLValue::Pointer_t& pVal) override; + virtual void newProperty(Id aId, const OOXMLValue::Pointer_t& pVal) override; void sendProperty(Id nId); virtual OOXMLPropertySet::Pointer_t getPropertySet() const override; @@ -266,7 +266,7 @@ public: virtual OOXMLValue::Pointer_t getValue() const override; virtual ResourceEnum_t getResource() const override { return PROPERTIES; } - virtual void newProperty(const Id & nId, const OOXMLValue::Pointer_t& pVal) override; + virtual void newProperty(Id nId, const OOXMLValue::Pointer_t& pVal) override; void handleXNotes(); void handleHdrFtr(); @@ -500,10 +500,10 @@ public: virtual ResourceEnum_t getResource() const override; - void addNamespace(const Id & nId); + void addNamespace(Id nId); void addToken( Token_t Element ); - virtual void newProperty(const Id & rId, const OOXMLValue::Pointer_t& pVal) override; + virtual void newProperty(Id nId, const OOXMLValue::Pointer_t& pVal) override; virtual void setPropertySet(const OOXMLPropertySet::Pointer_t& pPropertySet) override; virtual OOXMLPropertySet::Pointer_t getPropertySet() const override; -- cgit