diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-02 15:10:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-03 08:07:41 +0100 |
commit | acdba3c2eee18ef0c079b7c41cd4165e06c956c7 (patch) | |
tree | 18c6da7b7d46bf901b6dd4f7a5b280caa7f62280 | |
parent | f4bd9029ba7b500ebf99b7fa3d774de7fa029176 (diff) |
loplugin:passstuffbyref more return improvements
slightly less restrictive check when calling functions
Change-Id: I35e268ac611797b1daa83777cda02288a635aa32
Reviewed-on: https://gerrit.libreoffice.org/47259
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
47 files changed, 66 insertions, 65 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 1e97b1cf9040..79428e116b9e 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -422,7 +422,7 @@ public: void BasicRemoveWatch (); Color const & GetBackgroundColor () const { return aSyntaxColors.GetBackgroundColor(); } Color const & GetFontColor () const { return aSyntaxColors.GetFontColor(); } - Color GetSyntaxColor (TokenType eType) const { return aSyntaxColors.GetColor(eType); } + Color const & GetSyntaxColor (TokenType eType) const { return aSyntaxColors.GetColor(eType); } protected: // Window: @@ -449,7 +449,7 @@ private: public: Color const & GetBackgroundColor () const { return m_aBackgroundColor; }; Color const & GetFontColor () const { return m_aFontColor; } - Color GetColor (TokenType eType) const { return aColors[eType]; } + Color const & GetColor(TokenType eType) const { return aColors[eType]; } private: virtual void ConfigurationChanged (utl::ConfigurationBroadcaster*, ConfigurationHints) override; diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx index 54982fdfc045..8cfae946f041 100644 --- a/compilerplugins/clang/passstuffbyref.cxx +++ b/compilerplugins/clang/passstuffbyref.cxx @@ -275,7 +275,7 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C return; } - //functionDecl->dump(); + // functionDecl->dump(); mbInsideFunctionDecl = true; mbFoundReturnValueDisqualifier = false; @@ -412,12 +412,14 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr) FunctionDecl const * calleeFunctionDecl = callExpr->getDirectCallee(); if (!calleeFunctionDecl) return true; - // TODO anything takes a param is suspect because it might return the param by ref. + // TODO anything takes a non-integral param is suspect because it might return the param by ref. // we could tighten this to only reject functions that have a param of the same type // as the return type. Or we could check for such functions and disallow them. // Or we could force such functions to be annotated somehow. - if (calleeFunctionDecl->getNumParams() > 0) - return true; + for (unsigned i = 0; i != calleeFunctionDecl->getNumParams(); ++i) { + if (!calleeFunctionDecl->getParamDecl(i)->getType()->isIntegralOrEnumerationType()) + return true; + } auto tc = loplugin::TypeCheck(calleeFunctionDecl->getReturnType()); if (!tc.LvalueReference() && !tc.Pointer()) return true; diff --git a/compilerplugins/clang/test/passstuffbyref.cxx b/compilerplugins/clang/test/passstuffbyref.cxx index 71c219c986ec..f6277b4bbf07 100644 --- a/compilerplugins/clang/test/passstuffbyref.cxx +++ b/compilerplugins/clang/test/passstuffbyref.cxx @@ -41,8 +41,7 @@ struct S2 { // TODO OUString get10() { return OUString(*&get6()); } // todoexpected-error {{rather return class rtl::OUString by const& than by value, to avoid unnecessary copying [loplugin:passstuffbyref]}} OUString get11() const { return mxCow->get(); } // expected-error {{rather return class rtl::OUString by const& than by value, to avoid unnecessary copying [loplugin:passstuffbyref]}} - // TODO anything takes a param is suspect because it might return the param by ref - OUString get12() { return child.get2(false); } // todoexpected-error {{rather return class rtl::OUString by const& than by value, to avoid unnecessary copying [loplugin:passstuffbyref]}} + OUString get12() { return child.get2(false); } // expected-error {{rather return class rtl::OUString by const& than by value, to avoid unnecessary copying [loplugin:passstuffbyref]}} // no warning expected OUString set1() { return OUString("xxx"); } diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index d4437f15cf0a..fafabd715df0 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -551,13 +551,13 @@ ODsnTypeCollection::TypeIterator::~TypeIterator() #endif } -OUString ODsnTypeCollection::TypeIterator::getDisplayName() const +OUString const & ODsnTypeCollection::TypeIterator::getDisplayName() const { OSL_ENSURE(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); return m_pContainer->m_aDsnTypesDisplayNames[m_nPosition]; } -OUString ODsnTypeCollection::TypeIterator::getURLPrefix() const +OUString const & ODsnTypeCollection::TypeIterator::getURLPrefix() const { OSL_ENSURE(m_nPosition < (sal_Int32)m_pContainer->m_aDsnPrefixes.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); return m_pContainer->m_aDsnPrefixes[m_nPosition]; diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx index 6ad1fb3a083f..e44ead53c805 100644 --- a/dbaccess/source/inc/dsntypes.hxx +++ b/dbaccess/source/inc/dsntypes.hxx @@ -201,8 +201,8 @@ public: TypeIterator(const TypeIterator& _rSource); ~TypeIterator(); - OUString getURLPrefix() const; - OUString getDisplayName() const; + OUString const & getURLPrefix() const; + OUString const & getDisplayName() const; /// prefix increment const TypeIterator& operator++(); diff --git a/dbaccess/source/ui/inc/ConnectionLineData.hxx b/dbaccess/source/ui/inc/ConnectionLineData.hxx index 821c3b063147..4a3f16c86c77 100644 --- a/dbaccess/source/ui/inc/ConnectionLineData.hxx +++ b/dbaccess/source/ui/inc/ConnectionLineData.hxx @@ -67,8 +67,8 @@ namespace dbaui // member access (read) const OUString& GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; } - OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); } - OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); } + OUString const & GetSourceFieldName() const { return GetFieldName(JTCS_FROM); } + OUString const & GetDestFieldName() const { return GetFieldName(JTCS_TO); } void Reset(); OConnectionLineData& operator=( const OConnectionLineData& rConnLineData ); diff --git a/dbaccess/source/ui/querydesign/QTableConnection.hxx b/dbaccess/source/ui/querydesign/QTableConnection.hxx index 1e0f057fb9f7..13ff5c48a7d4 100644 --- a/dbaccess/source/ui/querydesign/QTableConnection.hxx +++ b/dbaccess/source/ui/querydesign/QTableConnection.hxx @@ -36,7 +36,7 @@ namespace dbaui OQueryTableConnection& operator=(const OQueryTableConnection& rConn); bool operator==(const OQueryTableConnection& rCompare); - OUString GetAliasName(EConnectionSide nWhich) const { return static_cast<OQueryTableConnectionData*>(GetData().get())->GetAliasName(nWhich); } + OUString const & GetAliasName(EConnectionSide nWhich) const { return static_cast<OQueryTableConnectionData*>(GetData().get())->GetAliasName(nWhich); } bool IsVisited() const { return m_bVisited; } void SetVisited(bool bVisited) { m_bVisited = bVisited; } diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 3fc5508b5bf7..514a4bbe3f97 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1396,7 +1396,7 @@ sal_Int8 OSelectionBrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& _rEvt return DND_ACTION_LINK; } -OTableFieldDescRef OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt) +OTableFieldDescRef const & OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt) { // one or more can be created, but the first one will is not returned sal_uInt32 nCount = getFields().size(); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx index 489cc798b425..c7bc3715c057 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx @@ -100,7 +100,7 @@ namespace dbaui void DuplicateConditionLevel( const sal_uInt16 nLevel); void AddOrder(const OTableFieldDescRef& rInfo, const EOrderDir eDir, sal_uInt32 _nCurrentPos); void ClearAll(); - OTableFieldDescRef AppendNewCol( sal_uInt16 nCnt=1 ); + OTableFieldDescRef const & AppendNewCol( sal_uInt16 nCnt=1 ); bool Save(); OQueryDesignView* getDesignView(); OQueryDesignView* getDesignView() const; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 0f61526cb97a..59fc80fc8160 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -173,7 +173,7 @@ public: virtual bool EventNotify( NotifyEvent& rNEvt ) override; virtual Size GetOptimalSize() const override; - TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; } + TEntry_Impl const & GetEntryData( long nPos ) { return m_vEntries[ nPos ]; } long GetEntryCount() { return (long) m_vEntries.size(); } tools::Rectangle GetEntryRect( const long nPos ) const; bool HasActive() { return m_bHasActive; } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 2e8d4aa9d7b3..3cc9b49917e9 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1721,7 +1721,7 @@ bool Outliner::ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_Int32 _nFi return RemovingPagesHdl( pCurView ); } -SfxItemSet Outliner::GetParaAttribs( sal_Int32 nPara ) +SfxItemSet const & Outliner::GetParaAttribs( sal_Int32 nPara ) { return pEditEngine->GetParaAttribs( nPara ); } diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index a892f4c16f72..f6bba5cc89b6 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -864,7 +864,7 @@ public: SfxStyleSheet* GetStyleSheet( sal_Int32 nPara ); void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& ); - SfxItemSet GetParaAttribs( sal_Int32 nPara ); + SfxItemSet const & GetParaAttribs( sal_Int32 nPara ); void Remove( Paragraph const * pPara, sal_Int32 nParaCount ); bool Expand( Paragraph const * ); diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx index 08550dca70a4..e9ce313c6a68 100644 --- a/include/sfx2/sidebar/TabBar.hxx +++ b/include/sfx2/sidebar/TabBar.hxx @@ -85,7 +85,7 @@ public: const ResourceManager::DeckContextDescriptorContainer& rDecks); void HighlightDeck (const OUString& rsDeckId); void RemoveDeckHighlight (); - const OUString GetDeckIdForIndex (const sal_Int32 nIndex) const; + OUString const & GetDeckIdForIndex (const sal_Int32 nIndex) const; void ToggleHideFlag (const sal_Int32 nIndex); void RestoreHideFlags(); diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 533496966d12..06f99318c3c0 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -166,7 +166,7 @@ public: virtual OString GetScreenshotId() const override; - OUString GetPageText( sal_uInt16 nPageId ) const + OUString const & GetPageText( sal_uInt16 nPageId ) const { return m_pTabCtrl->GetPageText(nPageId); } diff --git a/include/svx/SmartTagMgr.hxx b/include/svx/SmartTagMgr.hxx index f918c9e5ab48..a614d97ebbd9 100644 --- a/include/svx/SmartTagMgr.hxx +++ b/include/svx/SmartTagMgr.hxx @@ -198,7 +198,7 @@ public: /** Returns a recognizer. */ - css::uno::Reference< css::smarttags::XSmartTagRecognizer > + css::uno::Reference< css::smarttags::XSmartTagRecognizer > const & GetRecognizer( sal_uInt32 i ) const { return maRecognizerList[i]; } /** Is smart tag recognition active? diff --git a/include/svx/clipfmtitem.hxx b/include/svx/clipfmtitem.hxx index 9863836d9c0a..c5c4d8960e79 100644 --- a/include/svx/clipfmtitem.hxx +++ b/include/svx/clipfmtitem.hxx @@ -53,7 +53,7 @@ public: sal_uInt16 Count() const; SotClipboardFormatId GetClipbrdFormatId( sal_uInt16 nPos ) const; - const OUString GetClipbrdFormatName( sal_uInt16 nPos ) const; + OUString const & GetClipbrdFormatName( sal_uInt16 nPos ) const; private: std::unique_ptr<SvxClipboardFormatItem_Impl> pImpl; diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 099ed3d3aee1..676fe57a4cd4 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -412,7 +412,7 @@ void ScDrawShell::Activate (const bool) GetSidebarContextName())); } -::rtl::OUString ScDrawShell::GetSidebarContextName() +const OUString & ScDrawShell::GetSidebarContextName() { return vcl::EnumContext::GetContextName( svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC( diff --git a/sc/source/ui/inc/drawsh.hxx b/sc/source/ui/inc/drawsh.hxx index fcfc4adb9b9a..433c01798640 100644 --- a/sc/source/ui/inc/drawsh.hxx +++ b/sc/source/ui/inc/drawsh.hxx @@ -88,7 +88,7 @@ public: static bool AreAllObjectsOnLayer(SdrLayerID nLayerNo,const SdrMarkList& rMark); void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); - ::rtl::OUString GetSidebarContextName(); + OUString const & GetSidebarContextName(); }; #endif diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx index f3076804da93..8143e4f632cc 100644 --- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx +++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx @@ -137,7 +137,7 @@ public: Size GetOptimalSize() const override; bool EventNotify( NotifyEvent& rNEvt ) override; - TClientBoxEntry GetEntryData( long nPos ) { return m_vEntries[ nPos ]; } + TClientBoxEntry const & GetEntryData( long nPos ) { return m_vEntries[ nPos ]; } long GetActiveEntryIndex(); ::tools::Rectangle GetEntryRect( const long nPos ) const; long PointToPos( const Point& rPos ); diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 17587ac5be1e..494f96cf5588 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -362,7 +362,7 @@ public: */ virtual bool RelocateToParentWindow (vcl::Window* pParentWindow) override; - OUString GetSidebarContextName() const; + OUString const & GetSidebarContextName() const; bool IsInSwitchPage() { return mbIsInSwitchPage; } diff --git a/sd/source/ui/inc/zoomlist.hxx b/sd/source/ui/inc/zoomlist.hxx index 115e0d36aa92..fa16473ff802 100644 --- a/sd/source/ui/inc/zoomlist.hxx +++ b/sd/source/ui/inc/zoomlist.hxx @@ -35,8 +35,8 @@ public: ZoomList(ViewShell* pViewShell); void InsertZoomRect(const ::tools::Rectangle& rRect); - ::tools::Rectangle GetNextZoomRect(); - ::tools::Rectangle GetPreviousZoomRect(); + ::tools::Rectangle const & GetNextZoomRect(); + ::tools::Rectangle const & GetPreviousZoomRect(); bool IsNextPossible() const; bool IsPreviousPossible() const; diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 7fcecf0974a5..1e13ccf9493c 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -237,7 +237,7 @@ void MasterPageContainer::SetPreviewSize (PreviewSize eSize) NIL_TOKEN); } -Size MasterPageContainer::GetPreviewSizePixel() const +Size const & MasterPageContainer::GetPreviewSizePixel() const { return mpImpl->GetPreviewSizePixel(mePreviewSize); } diff --git a/sd/source/ui/sidebar/MasterPageContainer.hxx b/sd/source/ui/sidebar/MasterPageContainer.hxx index 732901fcabe5..1fa628473486 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.hxx +++ b/sd/source/ui/sidebar/MasterPageContainer.hxx @@ -78,7 +78,7 @@ public: /** Return the preview size in pixels. */ - Size GetPreviewSizePixel() const; + Size const & GetPreviewSizePixel() const; enum PreviewState { PS_AVAILABLE, PS_CREATABLE, PS_PREPARING, PS_NOT_AVAILABLE }; PreviewState GetPreviewState (Token aToken); diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 8032e66608cc..83fb4e824975 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -751,7 +751,7 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) mpAnnotationManager->GetAnnotationState( rItemSet ); } -::rtl::OUString DrawViewShell::GetSidebarContextName() const +OUString const & DrawViewShell::GetSidebarContextName() const { svx::sidebar::SelectionAnalyzer::ViewType eViewType (svx::sidebar::SelectionAnalyzer::ViewType::Standard); switch (mePageKind) diff --git a/sd/source/ui/view/zoomlist.cxx b/sd/source/ui/view/zoomlist.cxx index 06359ce495c2..f9a77e6b54d2 100644 --- a/sd/source/ui/view/zoomlist.cxx +++ b/sd/source/ui/view/zoomlist.cxx @@ -54,7 +54,7 @@ void ZoomList::InsertZoomRect(const ::tools::Rectangle& rRect) rBindings.Invalidate( SID_ZOOM_PREV ); } -::tools::Rectangle ZoomList::GetNextZoomRect() +::tools::Rectangle const & ZoomList::GetNextZoomRect() { mnCurPos++; size_t nRectCount = maRectangles.size(); @@ -69,7 +69,7 @@ void ZoomList::InsertZoomRect(const ::tools::Rectangle& rRect) return maRectangles[mnCurPos]; } -::tools::Rectangle ZoomList::GetPreviousZoomRect() +::tools::Rectangle const & ZoomList::GetPreviousZoomRect() { if (mnCurPos > 0) mnCurPos--; diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index a18de4f77171..7a9ede9a1f4f 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -306,7 +306,7 @@ IMPL_LINK_NOARG(TabBar::Item, HandleClick, Button*, void) {} // workaround for #i123198# } -const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const +OUString const & TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const { if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size()) throw RuntimeException(); diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index 81c4762c8403..9e726230326b 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -105,7 +105,7 @@ public: namespace { -OUString getCategoryType() +OUString const & getCategoryType() { return SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType()); } diff --git a/svx/source/inc/tablemodel.hxx b/svx/source/inc/tablemodel.hxx index 5c1ac7a86e6d..e59626da0200 100644 --- a/svx/source/inc/tablemodel.hxx +++ b/svx/source/inc/tablemodel.hxx @@ -163,9 +163,9 @@ private: virtual void SAL_CALL disposing() override; /// @throws css::lang::IndexOutOfBoundsException - TableRowRef getRow( sal_Int32 nRow ) const; + TableRowRef const & getRow( sal_Int32 nRow ) const; /// @throws css::lang::IndexOutOfBoundsException - TableColumnRef getColumn( sal_Int32 nColumn ) const; + TableColumnRef const & getColumn( sal_Int32 nColumn ) const; void updateRows(); void updateColumns(); diff --git a/svx/source/items/clipfmtitem.cxx b/svx/source/items/clipfmtitem.cxx index 08aa4782f376..2855ae46789e 100644 --- a/svx/source/items/clipfmtitem.cxx +++ b/svx/source/items/clipfmtitem.cxx @@ -138,7 +138,7 @@ SotClipboardFormatId SvxClipboardFormatItem::GetClipbrdFormatId( sal_uInt16 nPos return pImpl->aFmtIds[ nPos ]; } -const OUString SvxClipboardFormatItem::GetClipbrdFormatName( sal_uInt16 nPos ) const +OUString const & SvxClipboardFormatItem::GetClipbrdFormatName( sal_uInt16 nPos ) const { return pImpl->aFmtNms[nPos]; } diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index 4d6a558a3622..224d6280b4a1 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -942,7 +942,7 @@ void TableModel::removeRows( sal_Int32 nIndex, sal_Int32 nCount ) } -TableRowRef TableModel::getRow( sal_Int32 nRow ) const +TableRowRef const & TableModel::getRow( sal_Int32 nRow ) const { if( (nRow >= 0) && (nRow < getRowCountImpl()) ) return maRows[nRow]; @@ -951,7 +951,7 @@ TableRowRef TableModel::getRow( sal_Int32 nRow ) const } -TableColumnRef TableModel::getColumn( sal_Int32 nColumn ) const +TableColumnRef const & TableModel::getColumn( sal_Int32 nColumn ) const { if( (nColumn >= 0) && (nColumn < getColumnCountImpl()) ) return maColumns[nColumn]; diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index 65a0327c18cb..e221dd031bbc 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -132,8 +132,8 @@ public: void SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const nKeys[]); //initui.cxx - static OUString GetAuthFieldName(ToxAuthorityField eType); - static OUString GetAuthTypeName(ToxAuthorityType eType); + static OUString const & GetAuthFieldName(ToxAuthorityField eType); + static OUString const & GetAuthTypeName(ToxAuthorityType eType); LanguageType GetLanguage() const {return m_eLanguage;} void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;} diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index f5898a30e020..0ea5412a6592 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -217,7 +217,7 @@ public: sal_uInt16 GetStackCount() const; std::size_t GetAuthor( sal_uInt16 nPos = 0) const; - OUString GetAuthorString( sal_uInt16 nPos = 0 ) const; + OUString const & GetAuthorString( sal_uInt16 nPos = 0 ) const; const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const; RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const; RedlineType_t GetType( sal_uInt16 nPos = 0) const diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 8b9d8e265a18..7302281e7f66 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -191,7 +191,7 @@ public: // Redlining. std::size_t GetRedlineAuthor(); - OUString GetRedlineAuthor(std::size_t nPos); + OUString const & GetRedlineAuthor(std::size_t nPos); /// See SwXTextDocument::getTrackedChangeAuthors(). OUString GetRedlineAuthorInfo(); std::size_t InsertRedlineAuthor(const OUString& rAuthor); diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 7644a107200e..e2c061f004ac 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1709,7 +1709,7 @@ std::size_t SwRangeRedline::GetAuthor( sal_uInt16 nPos ) const return GetRedlineData(nPos).nAuthor; } -OUString SwRangeRedline::GetAuthorString( sal_uInt16 nPos ) const +OUString const & SwRangeRedline::GetAuthorString( sal_uInt16 nPos ) const { return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).nAuthor); } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 3b692e9825a0..812167721fbe 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -370,7 +370,7 @@ void MSWordStyles::BuildStyleIds() } } -OString MSWordStyles::GetStyleId(sal_uInt16 nId) const +OString const & MSWordStyles::GetStyleId(sal_uInt16 nId) const { return m_aStyleIds[nId]; } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 6fc71a97b624..1336fc9e2dc3 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1571,7 +1571,7 @@ public: sal_uInt16 GetSlot( const SwFormat* pFormat ) const; /// Get styleId of the nId-th style (nId is its position in pFormatA). - OString GetStyleId(sal_uInt16 nId) const; + OString const & GetStyleId(sal_uInt16 nId) const; const SwFormat* GetSwFormat(sal_uInt16 nId) const { return m_pFormatA[nId]; } /// Get numbering rule of the nId-th style diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index 1e82eaf98bd2..00992b9e196c 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -418,7 +418,7 @@ void SwModule::SetRedlineAuthor(const OUString &rAuthor) InsertRedlineAuthor( m_sActAuthor ); } -OUString SwModule::GetRedlineAuthor(std::size_t nPos) +OUString const & SwModule::GetRedlineAuthor(std::size_t nPos) { OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash while(nPos >= m_pAuthorNames.size()) diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx index f9ba04987743..2ed0ef9fade9 100644 --- a/sw/source/uibase/inc/glosdoc.hxx +++ b/sw/source/uibase/inc/glosdoc.hxx @@ -97,7 +97,7 @@ public: ); size_t GetGroupCnt(); - OUString GetGroupName(size_t); + OUString const & GetGroupName(size_t); OUString GetGroupTitle( const OUString& rGroupName ); bool FindGroupName(OUString& rGroup); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 9f592df77473..cb3b317bf9d2 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -352,7 +352,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); void SetPageStyle(const OUString &rCollName); - OUString GetCurPageStyle() const; + OUString const & GetCurPageStyle() const; // change current style using the attributes in effect void QuickUpdateStyle(); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 8790a4763986..424d54290981 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -132,7 +132,7 @@ bool SwGlossaries::FindGroupName(OUString& rGroup) return false; } -OUString SwGlossaries::GetGroupName(size_t nGroupId) +OUString const & SwGlossaries::GetGroupName(size_t nGroupId) { OSL_ENSURE(nGroupId < m_GlosArr.size(), "SwGlossaries::GetGroupName: index out of bounds"); diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx index bd5a30fb1a52..af3fd53daa89 100644 --- a/sw/source/uibase/utlui/initui.cxx +++ b/sw/source/uibase/utlui/initui.cxx @@ -329,7 +329,7 @@ namespace }; } -OUString SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType) +OUString const & SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType) { if(!pAuthFieldNameList) { @@ -367,7 +367,7 @@ static const char* STR_AUTH_TYPE_ARY[] = STR_AUTH_TYPE_CUSTOM5 }; -OUString SwAuthorityFieldType::GetAuthTypeName(ToxAuthorityType eType) +OUString const & SwAuthorityFieldType::GetAuthTypeName(ToxAuthorityType eType) { if(!pAuthFieldTypeList) { diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index d401687ec5a3..c8e9b93712b4 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1504,7 +1504,7 @@ void SwWrtShell::SetPageStyle(const OUString &rCollName) // Access templates -OUString SwWrtShell::GetCurPageStyle() const +OUString const & SwWrtShell::GetCurPageStyle() const { return GetPageDesc(GetCurPageDesc( false/*bCalcFrame*/ )).GetName(); } diff --git a/writerfilter/source/dmapper/TableData.hxx b/writerfilter/source/dmapper/TableData.hxx index de30d2247a63..a3614b953605 100644 --- a/writerfilter/source/dmapper/TableData.hxx +++ b/writerfilter/source/dmapper/TableData.hxx @@ -352,7 +352,7 @@ public: @param i index of the row */ - const RowPointer_t getRow(unsigned int i) const + RowPointer_t const & getRow(unsigned int i) const { return mRows[i]; } diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx b/writerfilter/source/ooxml/OOXMLPropertySet.cxx index 286da4fb040e..195d75b83185 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx @@ -224,7 +224,7 @@ OOXMLValue::Pointer_t const & OOXMLBooleanValue::Create(bool bValue) return bValue ? True : False; } -OOXMLValue::Pointer_t OOXMLBooleanValue::Create(const char *pValue) +OOXMLValue::Pointer_t const & OOXMLBooleanValue::Create(const char *pValue) { return Create (GetBooleanValue(pValue)); } diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.hxx b/writerfilter/source/ooxml/OOXMLPropertySet.hxx index c6b664f59b90..fbedaeda6498 100644 --- a/writerfilter/source/ooxml/OOXMLPropertySet.hxx +++ b/writerfilter/source/ooxml/OOXMLPropertySet.hxx @@ -92,7 +92,7 @@ class OOXMLBooleanValue : public OOXMLValue explicit OOXMLBooleanValue(bool bValue); public: static OOXMLValue::Pointer_t const & Create (bool bValue); - static OOXMLValue::Pointer_t Create (const char *pValue); + static OOXMLValue::Pointer_t const & Create (const char *pValue); virtual ~OOXMLBooleanValue() override; diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 75a56b35fa78..d65c057e5beb 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -308,7 +308,7 @@ struct ZipStorageImpl void initialize(); Reference<XInputStream> getStream(const rtl::OUString &rPath); - Reference<XInputStream> getStream(std::size_t nId); + Reference<XInputStream> const & getStream(std::size_t nId); private: void traverse(const Reference<container::XNameAccess> &rxEnum); @@ -361,7 +361,7 @@ Reference<XInputStream> ZipStorageImpl::getStream(const rtl::OUString &rPath) return maStreams[aIt->second].xStream; } -Reference<XInputStream> ZipStorageImpl::getStream(const std::size_t nId) +Reference<XInputStream> const & ZipStorageImpl::getStream(const std::size_t nId) { if (!maStreams[nId].xStream.is()) maStreams[nId].xStream = createStream(rtl::OStringToOUString(maStreams[nId].aName, RTL_TEXTENCODING_UTF8)); diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx index 21cc404ccd26..151e5367be0a 100644 --- a/xmloff/source/transform/StyleOASISTContext.cxx +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -87,9 +87,9 @@ public: static XMLPropType GetPropType( const OUString& rLocalName ); - static OUString MergeUnderline( XMLTokenEnum eUnderline, + static OUString const & MergeUnderline( XMLTokenEnum eUnderline, bool bBold, bool bDouble ); - static OUString MergeLineThrough( XMLTokenEnum eLineThrough, + static OUString const & MergeLineThrough( XMLTokenEnum eLineThrough, bool bBold, bool bDouble, sal_Unicode c ); }; @@ -635,7 +635,7 @@ XMLPropType XMLPropertiesTContext_Impl::GetPropType( const OUString& rLocalName return eProp; } -OUString XMLPropertiesTContext_Impl::MergeUnderline( +OUString const & XMLPropertiesTContext_Impl::MergeUnderline( XMLTokenEnum eUnderline, bool bBold, bool bDouble ) { if( bDouble ) @@ -700,7 +700,7 @@ OUString XMLPropertiesTContext_Impl::MergeUnderline( return GetXMLToken( eUnderline ); } -OUString XMLPropertiesTContext_Impl::MergeLineThrough( +OUString const & XMLPropertiesTContext_Impl::MergeLineThrough( XMLTokenEnum eLineThrough, bool bBold, bool bDouble, sal_Unicode c ) { |