[Libreoffice-commits] core.git: basegfx/source compilerplugins/clang filter/source include/basegfx include/svl include/ucbhelper include/unotools include/vcl sax/source svl/source ucbhelper/source unotools/source vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Sun Dec 24 06:02:11 UTC 2017


 basegfx/source/polygon/b2dpolygon.cxx                       |    6 +++---
 basegfx/source/polygon/b2dpolypolygon.cxx                   |    2 +-
 basegfx/source/tools/b2dclipstate.cxx                       |    2 +-
 compilerplugins/clang/passstuffbyref.cxx                    |   11 ++++++++++-
 compilerplugins/clang/test/passstuffbyref.cxx               |    5 +++++
 filter/source/svg/svgreader.cxx                             |    2 +-
 include/basegfx/polygon/b2dpolygon.hxx                      |    6 +++---
 include/basegfx/polygon/b2dpolypolygon.hxx                  |    2 +-
 include/basegfx/utils/b2dclipstate.hxx                      |    2 +-
 include/svl/itemprop.hxx                                    |    2 +-
 include/ucbhelper/simplenameclashresolverequest.hxx         |    2 +-
 include/unotools/localedatawrapper.hxx                      |    4 ++--
 include/vcl/ImageTree.hxx                                   |    2 +-
 include/vcl/button.hxx                                      |    2 +-
 include/vcl/jobset.hxx                                      |    2 +-
 include/vcl/msgbox.hxx                                      |    6 +++---
 include/vcl/pdfwriter.hxx                                   |    2 +-
 include/vcl/settings.hxx                                    |    6 +++---
 include/vcl/syswin.hxx                                      |    2 +-
 include/vcl/textview.hxx                                    |    2 +-
 sax/source/fastparser/fastparser.cxx                        |    8 ++++----
 svl/source/items/itemprop.cxx                               |    2 +-
 ucbhelper/source/provider/simplenameclashresolverequest.cxx |    2 +-
 unotools/source/i18n/localedatawrapper.cxx                  |    4 ++--
 vcl/source/app/settings.cxx                                 |    6 +++---
 vcl/source/control/button.cxx                               |    2 +-
 vcl/source/edit/textview.cxx                                |    2 +-
 vcl/source/gdi/jobset.cxx                                   |    2 +-
 vcl/source/gdi/pdfwriter.cxx                                |    2 +-
 vcl/source/image/ImageTree.cxx                              |    2 +-
 vcl/source/window/menubarwindow.cxx                         |    2 +-
 vcl/source/window/menubarwindow.hxx                         |    2 +-
 vcl/source/window/msgbox.cxx                                |    6 +++---
 vcl/source/window/syswin.cxx                                |    2 +-
 34 files changed, 64 insertions(+), 50 deletions(-)

New commits:
commit 6028b64e27dc45f20aa4a4e0adbef1c03e91a79b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Sat Dec 23 18:35:30 2017 +0200

    loplugin:passstuffbyref even more return improvements
    
    Change-Id: I2a752025cd429e4d271626402dce5d8a8b0c76d2
    Reviewed-on: https://gerrit.libreoffice.org/47021
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index 17df4c4b3738..601f493c27b4 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -1175,7 +1175,7 @@ namespace basegfx
         return mpPolygon->count();
     }
 
-    B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
+    B2DPoint const & B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
     {
         OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");
 
@@ -1399,12 +1399,12 @@ namespace basegfx
         }
     }
 
-    B2DPolygon B2DPolygon::getDefaultAdaptiveSubdivision() const
+    B2DPolygon const & B2DPolygon::getDefaultAdaptiveSubdivision() const
     {
         return mpPolygon->getDefaultAdaptiveSubdivision(*this);
     }
 
-    B2DRange B2DPolygon::getB2DRange() const
+    B2DRange const & B2DPolygon::getB2DRange() const
     {
         return mpPolygon->getB2DRange(*this);
     }
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 977adde32d7f..b0a51d46a3a7 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -230,7 +230,7 @@ namespace basegfx
         return mpPolyPolygon->count();
     }
 
-    B2DPolygon B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const
+    B2DPolygon const & B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const
     {
         OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)");
 
diff --git a/basegfx/source/tools/b2dclipstate.cxx b/basegfx/source/tools/b2dclipstate.cxx
index cf848f1af1c2..cff66f93faf9 100644
--- a/basegfx/source/tools/b2dclipstate.cxx
+++ b/basegfx/source/tools/b2dclipstate.cxx
@@ -482,7 +482,7 @@ namespace utils
         mpImpl->xorPolyPolygon(rPolyPoly);
     }
 
-    B2DPolyPolygon B2DClipState::getClipPoly() const
+    B2DPolyPolygon const & B2DClipState::getClipPoly() const
     {
         return mpImpl->getClipPoly();
     }
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 98b75abac960..0630beb80b59 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -229,6 +229,10 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
         return;
     }
 
+    // not sure if it's possible to modify these
+    if (isa<CXXConversionDecl>(functionDecl))
+        return;
+
     // ignore stuff that forms part of the stable URE interface
     if (isInUnoIncludeFile(functionDecl)) {
         return;
@@ -267,6 +271,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
     if (startswith(type.getAsString(), "struct o3tl::strong_int")) {
         return;
     }
+
+    //functionDecl->dump();
+
     mbInsideFunctionDecl = true;
     mbFoundReturnValueDisqualifier = false;
     TraverseStmt(functionDecl->getBody());
@@ -395,7 +402,9 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
             FunctionDecl const * calleeFunctionDecl = callExpr->getDirectCallee();
             if (!calleeFunctionDecl)
                 return true;
-            return !loplugin::TypeCheck(calleeFunctionDecl->getReturnType()).LvalueReference();
+            auto tc = loplugin::TypeCheck(calleeFunctionDecl->getReturnType());
+            if (!tc.LvalueReference() && !tc.Pointer())
+                return true;
         }
         return false;
     }
diff --git a/compilerplugins/clang/test/passstuffbyref.cxx b/compilerplugins/clang/test/passstuffbyref.cxx
index 3178bf7329f2..99e4a5a189b6 100644
--- a/compilerplugins/clang/test/passstuffbyref.cxx
+++ b/compilerplugins/clang/test/passstuffbyref.cxx
@@ -9,6 +9,7 @@
 
 #include <rtl/ustring.hxx>
 #include <sys/time.h>
+#include <o3tl/cow_wrapper.hxx>
 #include <vector>
 
 struct S1 {
@@ -21,6 +22,7 @@ struct S2 {
     OUString mv3[2];
     S1 child;
     static OUString gs1;
+    o3tl::cow_wrapper<S1> mxCow;
 
     // make sure we ignore cases where the passed in parameter is std::move'd
     S2(OUString v1, OUString v2)
@@ -35,6 +37,9 @@ struct S2 {
     OUString get7() { return get6(); } // expected-error {{rather return class rtl::OUString by const& than by value, to avoid unnecessary copying [loplugin:passstuffbyref]}}
     OUString & get8() { return gs1; }
     OUString get9() { return get8(); } // expected-error {{rather return class rtl::OUString by const& than by value, to avoid unnecessary copying [loplugin:passstuffbyref]}}
+    // 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]}}
 
     // no warning expected
     OUString set1() { return OUString("xxx"); }
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index dfd269236ee1..43fe63b07ba6 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -136,7 +136,7 @@ bool PolyPolygonIsMixedOpenAndClosed( const basegfx::B2DPolyPolygon& rPoly )
     // polygon and there are both closed and open polygons.
     for( sal_uInt32 a(0); !bRetval && a < rPoly.count(); a++ )
     {
-        if ( (rPoly.getB2DPolygon(a)).isClosed() )
+        if ( rPoly.getB2DPolygon(a).isClosed() )
         {
             bClosed = true;
         }
diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx
index 703f24548975..714d2a1fd10d 100644
--- a/include/basegfx/polygon/b2dpolygon.hxx
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -75,7 +75,7 @@ namespace basegfx
         sal_uInt32 count() const;
 
         /// Coordinate interface
-        basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
+        basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const;
         void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
 
         /// Coordinate insert/append
@@ -149,7 +149,7 @@ namespace basegfx
             be this polygon itself when it has no bezier segments. It is guaranteed
             to have no more bezier segments
         */
-        B2DPolygon getDefaultAdaptiveSubdivision() const;
+        B2DPolygon const & getDefaultAdaptiveSubdivision() const;
 
         /** Get the B2DRange (Rectangle dimensions) of this B2DPolygon
 
@@ -178,7 +178,7 @@ namespace basegfx
             @return
             The outer range of the bezier curve/polygon
         */
-        B2DRange getB2DRange() const;
+        B2DRange const & getB2DRange() const;
 
         /** append other 2D polygons
 
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx
index ddc05a669ceb..fff49fb86c45 100644
--- a/include/basegfx/polygon/b2dpolypolygon.hxx
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -67,7 +67,7 @@ namespace basegfx
         // polygon interface
         sal_uInt32 count() const;
 
-        B2DPolygon getB2DPolygon(sal_uInt32 nIndex) const;
+        B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const;
         void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
 
         // test for curve
diff --git a/include/basegfx/utils/b2dclipstate.hxx b/include/basegfx/utils/b2dclipstate.hxx
index 5c3f615284ca..a6d12ba41d7b 100644
--- a/include/basegfx/utils/b2dclipstate.hxx
+++ b/include/basegfx/utils/b2dclipstate.hxx
@@ -88,7 +88,7 @@ namespace basegfx
 
             void transform(const B2DHomMatrix& );
 
-            B2DPolyPolygon getClipPoly() const;
+            B2DPolyPolygon const & getClipPoly() const;
         };
     }
 }
diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
index 8e1c44afa456..f674d70b6e6e 100644
--- a/include/svl/itemprop.hxx
+++ b/include/svl/itemprop.hxx
@@ -95,7 +95,7 @@ public:
     ~SfxItemPropertyMap();
 
     const SfxItemPropertySimpleEntry*  getByName( const OUString &rName ) const;
-    css::uno::Sequence< css::beans::Property > getProperties() const;
+    css::uno::Sequence< css::beans::Property > const & getProperties() const;
     /// @throws css::beans::UnknownPropertyException
     css::beans::Property getPropertyByName( const OUString & rName ) const;
     bool hasPropertyByName( const OUString& rName ) const;
diff --git a/include/ucbhelper/simplenameclashresolverequest.hxx b/include/ucbhelper/simplenameclashresolverequest.hxx
index 3e7b1fef884f..0453cd721be6 100644
--- a/include/ucbhelper/simplenameclashresolverequest.hxx
+++ b/include/ucbhelper/simplenameclashresolverequest.hxx
@@ -61,7 +61,7 @@ public:
       *
       * @return the new name, if supplied.
       */
-    const OUString getNewName() const;
+    OUString const & getNewName() const;
 };
 
 } // namespace ucbhelper
diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx
index 02b416250adc..56ee9d88e0a4 100644
--- a/include/unotools/localedatawrapper.hxx
+++ b/include/unotools/localedatawrapper.hxx
@@ -181,10 +181,10 @@ public:
     const std::shared_ptr< css::i18n::Calendar2 >& getDefaultCalendar() const;
 
     /// Convenience method to obtain the day names of the default calendar.
-    const css::uno::Sequence< css::i18n::CalendarItem2 > getDefaultCalendarDays() const;
+    css::uno::Sequence< css::i18n::CalendarItem2 > const & getDefaultCalendarDays() const;
 
     /// Convenience method to obtain the month names of the default calendar.
-    const css::uno::Sequence< css::i18n::CalendarItem2 > getDefaultCalendarMonths() const;
+    css::uno::Sequence< css::i18n::CalendarItem2 > const & getDefaultCalendarMonths() const;
 
     /** If the secondary calendar, if any, is of the name passed AND number
         formats using it usually use the E or EE keyword (EC|EEC). */
diff --git a/include/vcl/ImageTree.hxx b/include/vcl/ImageTree.hxx
index 5de137128d58..a40905d863ef 100644
--- a/include/vcl/ImageTree.hxx
+++ b/include/vcl/ImageTree.hxx
@@ -60,7 +60,7 @@ public:
         BitmapEx & bitmap, bool localized,
         const ImageLoadFlags eFlags = ImageLoadFlags::NONE);
 
-    VCL_DLLPUBLIC css::uno::Reference<css::container::XNameAccess> getNameAccess();
+    VCL_DLLPUBLIC css::uno::Reference<css::container::XNameAccess> const & getNameAccess();
 
 
     /** a crude form of life cycle control (called from DeInitVCL; otherwise,
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 29bcfdc10b65..dbc80437bcee 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -82,7 +82,7 @@ public:
     static OUString     GetStandardText( StandardButtonType eButton );
 
     bool                SetModeImage( const Image& rImage );
-    const Image         GetModeImage( ) const;
+    Image const &       GetModeImage( ) const;
     bool                HasImage() const;
     void                SetImageAlign( ImageAlign eAlign );
     ImageAlign          GetImageAlign() const;
diff --git a/include/vcl/jobset.hxx b/include/vcl/jobset.hxx
index a3aa1196f83b..a641ea018797 100644
--- a/include/vcl/jobset.hxx
+++ b/include/vcl/jobset.hxx
@@ -46,7 +46,7 @@ public:
     SAL_DLLPRIVATE ImplJobSetup&        ImplGetData();
     SAL_DLLPRIVATE const ImplJobSetup&  ImplGetConstData() const;
 
-    OUString              GetPrinterName() const;
+    OUString const &      GetPrinterName() const;
     bool                  IsDefault() const;
 
     friend VCL_DLLPUBLIC SvStream&  ReadJobSetup( SvStream& rIStream, JobSetup& rJobSetup );
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 18b869318b90..7c982cc5a996 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -95,7 +95,7 @@ public:
                         InfoBox( vcl::Window* pParent, MessBoxStyle nStyle,
                                 const OUString& rMessage );
 
-    static Image        GetStandardImage();
+    static Image const & GetStandardImage();
     static OUString     GetStandardText();
 };
 
@@ -109,7 +109,7 @@ public:
 
     void                SetDefaultCheckBoxText();
 
-    static Image        GetStandardImage();
+    static Image const & GetStandardImage();
     static OUString     GetStandardText();
 };
 
@@ -136,7 +136,7 @@ public:
 
     void                SetDefaultCheckBoxText();
 
-    static Image        GetStandardImage();
+    static Image const & GetStandardImage();
     static OUString     GetStandardText();
 };
 
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index f06c21d81c44..29e14fb0ff20 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -721,7 +721,7 @@ The following structure describes the permissions used in PDF security
      * this should enable the producer to give feedback about
      * any anomalies that might have occurred
      */
-    std::set< ErrorCode > GetErrors();
+    std::set< ErrorCode > const & GetErrors();
 
     static css::uno::Reference< css::beans::XMaterialHolder >
            InitEncryption( const OUString& i_rOwnerPassword,
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 494e2bb8f24f..9b6ab00f2029 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -543,7 +543,7 @@ public:
     /** Obtain the list of icon themes which were found in the config folder
      * @see vcl::IconThemeScanner for more details.
      */
-    std::vector<vcl::IconThemeInfo> GetInstalledIconThemes() const;
+    std::vector<vcl::IconThemeInfo> const & GetInstalledIconThemes() const;
 
     /** Obtain the name of the icon theme which will be chosen automatically for the desktop environment.
      * This method will only return icon themes which were actually found on the system.
@@ -561,9 +561,9 @@ public:
     const FrameStyle&               GetFrameStyle() const;
     void                            SetFrameStyle( const FrameStyle& rStyle );
 
-    const BitmapEx                  GetPersonaHeader() const;
+    BitmapEx const &                GetPersonaHeader() const;
 
-    const BitmapEx                  GetPersonaFooter() const;
+    BitmapEx const &                GetPersonaFooter() const;
 
     const boost::optional<Color>&   GetPersonaMenuBarTextColor() const;
 
diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index 0153c876730c..8dc9bfee1e68 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -238,7 +238,7 @@ public:
 
     void            SetNotebookBar(const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame>& rFrame);
     void            CloseNotebookBar();
-    VclPtr<NotebookBar> GetNotebookBar() const;
+    VclPtr<NotebookBar> const & GetNotebookBar() const;
 
     TaskPaneList*   GetTaskPaneList();
     void            GetWindowStateData( WindowStateData& rData ) const;
diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
index ad16d8486913..545b1ba9030f 100644
--- a/include/vcl/textview.hxx
+++ b/include/vcl/textview.hxx
@@ -96,7 +96,7 @@ class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
     void                ShowSelection( const TextSelection& rSel );
     void                ImpShowHideSelection( const TextSelection* pRange = nullptr );
 
-    TextSelection       ImpMoveCursor( const KeyEvent& rKeyEvent );
+    TextSelection const & ImpMoveCursor( const KeyEvent& rKeyEvent );
     TextPaM             ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode );
     bool                IsInSelection( const TextPaM& rPaM );
 
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 0a2753cad4e2..55b6545c5114 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -221,7 +221,7 @@ public:
     void registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken );
     /// @throws css::lang::IllegalArgumentException
     /// @throws css::uno::RuntimeException
-    OUString getNamespaceURL( const OUString& rPrefix );
+    OUString const & getNamespaceURL( const OUString& rPrefix );
     /// @throws css::uno::RuntimeException
     void setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler );
     /// @throws css::uno::RuntimeException
@@ -254,7 +254,7 @@ private:
     /// @throws css::xml::sax::SAXException
     sal_Int32 GetTokenWithPrefix( const xmlChar* pPrefix, int prefixLen, const xmlChar* pName, int nameLen );
     /// @throws css::xml::sax::SAXException
-    OUString GetNamespaceURL( const OString& rPrefix );
+    OUString const & GetNamespaceURL( const OString& rPrefix );
     sal_Int32 GetNamespaceToken( const OUString& rNamespaceURL );
     sal_Int32 GetTokenWithContextNamespace( sal_Int32 nNamespaceToken, const xmlChar* pName, int nNameLen );
     void DefineNamespace( const OString& rPrefix, const OUString& namespaceURL );
@@ -703,7 +703,7 @@ sal_Int32 FastSaxParserImpl::GetNamespaceToken( const OUString& rNamespaceURL )
         return FastToken::DONTKNOW;
 }
 
-OUString FastSaxParserImpl::GetNamespaceURL( const OString& rPrefix )
+OUString const & FastSaxParserImpl::GetNamespaceURL( const OString& rPrefix )
 {
     Entity& rEntity = getEntity();
     if( !rEntity.maNamespaceCount.empty() )
@@ -877,7 +877,7 @@ void FastSaxParserImpl::registerNamespace( const OUString& NamespaceURL, sal_Int
     throw IllegalArgumentException();
 }
 
-OUString FastSaxParserImpl::getNamespaceURL( const OUString& rPrefix )
+OUString const & FastSaxParserImpl::getNamespaceURL( const OUString& rPrefix )
 {
     try
     {
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 67e283c1113f..fd22a4f68733 100644
--- a/svl/source/items/itemprop.cxx
+++ b/svl/source/items/itemprop.cxx
@@ -79,7 +79,7 @@ const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( const OUString
     return &aIter->second;
 }
 
-uno::Sequence<beans::Property> SfxItemPropertyMap::getProperties() const
+uno::Sequence<beans::Property> const & SfxItemPropertyMap::getProperties() const
 {
     if( !m_pImpl->m_aPropSeq.getLength() )
     {
diff --git a/ucbhelper/source/provider/simplenameclashresolverequest.cxx b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
index 668b512ab10d..04e9f9ebc7e6 100644
--- a/ucbhelper/source/provider/simplenameclashresolverequest.cxx
+++ b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
@@ -152,7 +152,7 @@ SimpleNameClashResolveRequest::SimpleNameClashResolveRequest(
     setContinuations( aContinuations );
 }
 
-const OUString SimpleNameClashResolveRequest::getNewName() const
+OUString const & SimpleNameClashResolveRequest::getNewName() const
 {
     return m_xNameSupplier->getName();
 }
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 2f125f6b8e14..411c650dc74f 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -563,12 +563,12 @@ const std::shared_ptr< css::i18n::Calendar2 >& LocaleDataWrapper::getDefaultCale
     return xDefaultCalendar;
 }
 
-const css::uno::Sequence< css::i18n::CalendarItem2 > LocaleDataWrapper::getDefaultCalendarDays() const
+css::uno::Sequence< css::i18n::CalendarItem2 > const & LocaleDataWrapper::getDefaultCalendarDays() const
 {
     return getDefaultCalendar()->Days;
 }
 
-const css::uno::Sequence< css::i18n::CalendarItem2 > LocaleDataWrapper::getDefaultCalendarMonths() const
+css::uno::Sequence< css::i18n::CalendarItem2 > const & LocaleDataWrapper::getDefaultCalendarMonths() const
 {
     return getDefaultCalendar()->Months;
 }
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index e2841b8b4ed2..9089ca51ffd0 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2209,13 +2209,13 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot
     }
 }
 
-const BitmapEx StyleSettings::GetPersonaHeader() const
+BitmapEx const & StyleSettings::GetPersonaHeader() const
 {
     setupPersonaHeaderFooter( PERSONA_HEADER, mxData->maPersonaHeaderFooter, mxData->maPersonaHeaderBitmap, mxData->maPersonaMenuBarTextColor );
     return mxData->maPersonaHeaderBitmap;
 }
 
-const BitmapEx StyleSettings::GetPersonaFooter() const
+BitmapEx const & StyleSettings::GetPersonaFooter() const
 {
     setupPersonaHeaderFooter( PERSONA_FOOTER, mxData->maPersonaHeaderFooter, mxData->maPersonaFooterBitmap, mxData->maPersonaMenuBarTextColor );
     return mxData->maPersonaFooterBitmap;
@@ -2974,7 +2974,7 @@ StyleSettings::GetOptions() const
     return mxData->mnOptions;
 }
 
-std::vector<vcl::IconThemeInfo>
+std::vector<vcl::IconThemeInfo> const &
 StyleSettings::GetInstalledIconThemes() const
 {
     if (!mxData->mIconThemeScanner) {
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index ec05ea1cc298..1f1699397770 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -162,7 +162,7 @@ bool Button::SetModeImage( const Image& rImage )
     return true;
 }
 
-const Image Button::GetModeImage( ) const
+Image const & Button::GetModeImage( ) const
 {
     return mpButtonData->maImage;
 }
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 9493e37e952e..6ba271aecbf3 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1127,7 +1127,7 @@ void TextView::SetReadOnly( bool bReadOnly )
     }
 }
 
-TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
+TextSelection const & TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
 {
     // normally only needed for Up/Down; but who cares
     mpImpl->mpTextEngine->CheckIdleFormatter();
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index d126a8b16f9a..d7a0829b882c 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -223,7 +223,7 @@ ImplJobSetup& JobSetup::ImplGetData()
     return *mpData;
 }
 
-OUString JobSetup::GetPrinterName() const
+OUString const & JobSetup::GetPrinterName() const
 {
     return mpData->GetPrinterName();
 }
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 7ff4300c71ee..a360e6230231 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -457,7 +457,7 @@ void PDFWriter::AddStream( const OUString& rMimeType, PDFOutputStream* pStream )
     xImplementation->addStream( rMimeType, pStream );
 }
 
-std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors()
+std::set< PDFWriter::ErrorCode > const & PDFWriter::GetErrors()
 {
     return xImplementation->getErrors();
 }
diff --git a/vcl/source/image/ImageTree.cxx b/vcl/source/image/ImageTree.cxx
index bbce46b0f280..941812925190 100644
--- a/vcl/source/image/ImageTree.cxx
+++ b/vcl/source/image/ImageTree.cxx
@@ -37,7 +37,7 @@ bool ImageTree::loadImage(OUString const & rName, OUString const & rStyle,
     return mpImplImageTree->loadImage(rName, rStyle, rBitmap, bLocalized, eFlags);
 }
 
-css::uno::Reference<css::container::XNameAccess> ImageTree::getNameAccess()
+css::uno::Reference<css::container::XNameAccess> const & ImageTree::getNameAccess()
 {
     return mpImplImageTree->getNameAccess();
 }
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index f7f933f28a95..cb14f3fba94f 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -211,7 +211,7 @@ void MenuBarWindow::ShowButtons( bool bClose, bool bFloat, bool bHide )
     Resize();
 }
 
-Size MenuBarWindow::MinCloseButtonSize()
+Size const & MenuBarWindow::MinCloseButtonSize()
 {
     return aCloseBtn->getMinSize();
 }
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index bdf785f36d13..988e21cc20f5 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -129,7 +129,7 @@ public:
 
     void    SetAutoPopup(bool bAuto) { mbAutoPopup = bAuto; }
     void    LayoutChanged();
-    Size            MinCloseButtonSize();
+    Size const & MinCloseButtonSize();
 
     /// Add an arbitrary button to the menubar that will appear next to the close button.
     sal_uInt16 AddMenuBarButton(const Image&, const Link<MenuBar::MenuBarButtonCallbackArg&,bool>&, const OUString&);
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 67b3edf1df37..b86335840bb7 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -386,7 +386,7 @@ InfoBox::InfoBox( vcl::Window* pParent, MessBoxStyle nStyle, const OUString& rMe
     SetImage( InfoBox::GetStandardImage() );
 }
 
-Image InfoBox::GetStandardImage()
+Image const & InfoBox::GetStandardImage()
 {
     ImplInitMsgBoxImageList();
     return ImplGetSVData()->maWinData.maMsgBoxImgList[3];
@@ -419,7 +419,7 @@ void WarningBox::SetDefaultCheckBoxText()
     maCheckBoxText = VclResId(SV_STDTEXT_DONTWARNAGAIN);
 }
 
-Image WarningBox::GetStandardImage()
+Image const & WarningBox::GetStandardImage()
 {
     ImplInitMsgBoxImageList();
     return ImplGetSVData()->maWinData.maMsgBoxImgList[2];
@@ -497,7 +497,7 @@ void QueryBox::SetDefaultCheckBoxText()
     maCheckBoxText = VclResId(SV_STDTEXT_DONTASKAGAIN);
 }
 
-Image QueryBox::GetStandardImage()
+Image const & QueryBox::GetStandardImage()
 {
     ImplInitMsgBoxImageList();
     return ImplGetSVData()->maWinData.maMsgBoxImgList[1];
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 9c42fc94b2de..28a9924b0203 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -982,7 +982,7 @@ void SystemWindow::CloseNotebookBar()
     maNotebookBarUIFile.clear();
 }
 
-VclPtr<NotebookBar> SystemWindow::GetNotebookBar() const
+VclPtr<NotebookBar> const & SystemWindow::GetNotebookBar() const
 {
     return static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetNotebookBar();
 }


More information about the Libreoffice-commits mailing list