comphelper/source/eventattachermgr/eventattachermgr.cxx     |    4 ++--
 comphelper/source/processfactory/processfactory.cxx         |    2 +-
 include/comphelper/processfactory.hxx                       |    2 +-
 include/rtl/ustring.hxx                                     |   10 ++++++++++
 include/xmloff/maptype.hxx                                  |    4 +---
 svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx    |    3 +--
 svx/source/svdraw/svdobj.cxx                                |    4 +---
 svx/source/tbxctrls/grafctrl.cxx                            |    3 +--
 sw/source/uibase/app/docstyle.cxx                           |    3 +--
 unotools/source/i18n/localedatawrapper.cxx                  |    3 +--
 xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx |    3 +--
 11 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit 47a1dccd17d106e880d51dad4aa51cd0795bf198
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Nov 5 13:18:57 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Nov 6 09:25:20 2024 +0100

    loplugin:passstuffbyref in comphelper
    
    Change-Id: I2c94b6e0bbdce4f4236815df8c4841327a33939e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176053
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx 
b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index ab5f1d79dbd0..46c7b78d41a7 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -123,7 +123,7 @@ private:
     void insertEntry(std::unique_lock<std::mutex>&, sal_Int32 Index);
 
     /// @throws Exception
-    Reference< XIdlReflection > getReflection(std::unique_lock<std::mutex>&);
+    const Reference< XIdlReflection > & 
getReflection(std::unique_lock<std::mutex>&);
 
     /** checks if <arg>_nIndex</arg> is a valid index, throws an 
<type>IllegalArgumentException</type> if not
     @param _nIndex
@@ -370,7 +370,7 @@ ImplEventAttacherManager::ImplEventAttacherManager( const 
Reference< XIntrospect
     }
 }
 
-Reference< XIdlReflection > 
ImplEventAttacherManager::getReflection(std::unique_lock<std::mutex>&)
+const Reference< XIdlReflection > & 
ImplEventAttacherManager::getReflection(std::unique_lock<std::mutex>&)
 {
     // Do we already have a service? If not, create one.
     if( !mxCoreReflection.is() )
diff --git a/comphelper/source/processfactory/processfactory.cxx 
b/comphelper/source/processfactory/processfactory.cxx
index 00827434566f..3312128a32df 100644
--- a/comphelper/source/processfactory/processfactory.cxx
+++ b/comphelper/source/processfactory/processfactory.cxx
@@ -106,7 +106,7 @@ Reference< XComponentContext > getComponentContext(
     return xRet;
 }
 
-Reference< XComponentContext > getProcessComponentContext()
+const Reference< XComponentContext > & getProcessComponentContext()
 {
     static const uno::Reference<XComponentContext> processComponentContext = 
getComponentContext( getProcessServiceFactory() );
     return processComponentContext;
diff --git a/include/comphelper/processfactory.hxx 
b/include/comphelper/processfactory.hxx
index 0f74e5b1365d..7dba64eeea29 100644
--- a/include/comphelper/processfactory.hxx
+++ b/include/comphelper/processfactory.hxx
@@ -62,7 +62,7 @@ getComponentContext(
  * Throws a RuntimeException if no component context can be obtained.
  */
 COMPHELPER_DLLPUBLIC
-css::uno::Reference< css::uno::XComponentContext >
+const css::uno::Reference< css::uno::XComponentContext > &
 getProcessComponentContext();
 
 }
commit bd8539dfd1025dccac1f919ad698249379e036da
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Nov 5 12:21:29 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Nov 6 09:25:10 2024 +0100

    add an EMPTY_OUSTRING in OUString header
    
    we already declare the same thing in various places,
    and I intend to be using this some more, so it makes
    sense to only declare it in one place
    
    Change-Id: Ifea6b589e992dd9f6cd8f2301f837e71397481c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176046
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 8272cdb22c55..b03978c7d625 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -3987,6 +3987,16 @@ struct hash<::rtl::OUString>
 
 }
 
+#if !(defined _MSC_VER && _MSC_VER <= 1929 && defined _MANAGED)
+/**
+  * static empty string object, handy for returning from functions where the 
function is
+  * returning a "const OUString &"
+  *
+  * @since LibreOffice 25.2
+  */
+static inline constexpr ::rtl::OUString EMPTY_OUSTRING = u""_ustr;
+#endif
+
 #endif
 /// @endcond
 
diff --git a/include/xmloff/maptype.hxx b/include/xmloff/maptype.hxx
index f15ef3d38002..704c0ae0783d 100644
--- a/include/xmloff/maptype.hxx
+++ b/include/xmloff/maptype.hxx
@@ -99,8 +99,6 @@ struct XMLPropertyMapEntry
      */
     bool            mbImportOnly;
 
-    static constexpr OUString EMPTY{u""_ustr};
-
     constexpr XMLPropertyMapEntry(
             const OUString& sApiName,
             sal_uInt16      nNameSpace,
@@ -119,7 +117,7 @@ struct XMLPropertyMapEntry
     /// used to mark the end of the array
     constexpr XMLPropertyMapEntry(std::nullptr_t)
         :
-        msApiName(EMPTY),
+        msApiName(EMPTY_OUSTRING),
         meXMLName(xmloff::token::XML_TOKEN_INVALID), mnNameSpace(0), mnType(0),
         mnContextId(0), 
mnEarliestODFVersionForExport(SvtSaveOptions::ODFSVER_010),
         mbImportOnly(false)
diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx 
b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index a6fcb11a60c1..2419930a28d8 100644
--- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -539,12 +539,11 @@ static const TypeACCNameHashMap& GetACCHashMap()
 
 const OUString & EnhancedCustomShapeTypeNames::GetAccName( const OUString& 
rShapeType )
 {
-    static const OUString EMPTY;
     const TypeACCNameHashMap& rACCMap = GetACCHashMap();
     auto aHashIter = rACCMap.find( rShapeType );
     if ( aHashIter != rACCMap.end() )
         return aHashIter->second;
-    return EMPTY;
+    return EMPTY_OUSTRING;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 892884b04f11..255dc4018075 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -724,14 +724,12 @@ void SdrObject::SetName(const OUString& rStr, const bool 
bSetChanged)
 
 const OUString & SdrObject::GetName() const
 {
-    static constexpr OUString EMPTY = u""_ustr;
-
     if(m_pPlusData)
     {
         return m_pPlusData->aObjName;
     }
 
-    return EMPTY;
+    return EMPTY_OUSTRING;
 }
 
 void SdrObject::SetTitle(const OUString& rStr)
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index a580d739414b..70f6ca8d002a 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -160,7 +160,6 @@ struct CommandToRID
 
 static OUString ImplGetRID( std::u16string_view aCommand )
 {
-    static constexpr OUString EMPTY = u""_ustr;
     static constexpr CommandToRID aImplCommandToResMap[] =
     {
         { ".uno:GrafRed",           RID_SVXBMP_GRAF_RED             },
@@ -170,7 +169,7 @@ static OUString ImplGetRID( std::u16string_view aCommand )
         { ".uno:GrafContrast",      RID_SVXBMP_GRAF_CONTRAST        },
         { ".uno:GrafGamma",         RID_SVXBMP_GRAF_GAMMA           },
         { ".uno:GrafTransparence",  RID_SVXBMP_GRAF_TRANSPARENCE    },
-        { nullptr, EMPTY }
+        { nullptr, EMPTY_OUSTRING }
     };
 
     OUString sRID;
diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index 6aae548adb29..5644990236f3 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -858,8 +858,7 @@ const OUString&  SwDocStyleSheet::GetParent() const
         case SfxStyleFamily::Pseudo:
         default:
             {
-                static const OUString sEmpty;
-                return sEmpty; // there's no parent
+                return EMPTY_OUSTRING; // there's no parent
             }
         }
 
diff --git a/unotools/source/i18n/localedatawrapper.cxx 
b/unotools/source/i18n/localedatawrapper.cxx
index 6df122660db2..a49f11f15ed1 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -382,8 +382,7 @@ const OUString& LocaleDataWrapper::getOneReservedWord( 
sal_Int16 nWord ) const
     if ( nWord < 0 || o3tl::make_unsigned(nWord) >= aReservedWords.size() )
     {
         SAL_WARN( "unotools.i18n", "getOneReservedWord: bounds" );
-        static const OUString EMPTY;
-        return EMPTY;
+        return EMPTY_OUSTRING;
     }
     return aReservedWords[nWord];
 }
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx 
b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
index e7e765132113..06ffe56ba31d 100644
--- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -112,8 +112,7 @@ const OUString& 
UnoInterfaceToUniqueIdentifierMapper::getIdentifier( const Refer
     }
     else
     {
-        static const OUString aEmpty;
-        return aEmpty;
+        return EMPTY_OUSTRING;
     }
 }
 

Reply via email to