[Libreoffice-commits] core.git: connectivity/source i18nutil/source package/source sfx2/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 21 13:03:32 UTC 2021


 connectivity/source/commontools/sqlerror.cxx |    3 ++-
 i18nutil/source/utility/paper.cxx            |    3 ++-
 package/source/zipapi/ZipFile.cxx            |   12 ++++++------
 sfx2/source/doc/docmacromode.cxx             |    4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 3ffb7efa95d900db6fdd7d8443535988adb2be70
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jun 21 13:09:50 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jun 21 15:02:53 2021 +0200

    remove some unnecessary OUString::intern
    
    Change-Id: Ia0f41dfc8a00c115ad544b8236d751e6b2dae5ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117577
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx
index 9f8608384d1d..513a5cf9dc81 100644
--- a/connectivity/source/commontools/sqlerror.cxx
+++ b/connectivity/source/commontools/sqlerror.cxx
@@ -229,9 +229,10 @@ namespace connectivity
 
     OUString SQLError_Impl::impl_getSQLState( ErrorCondition _eCondition )
     {
+        static constexpr OUStringLiteral DEFAULT_STATE = u"S1000";
         OUString sState = lcl_getResourceState(_eCondition);
         if (sState.isEmpty())
-            sState = OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "S1000" ) );
+            sState = DEFAULT_STATE;
         return sState;
     }
 
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index 042a82e72f93..995f60ce8c3e 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -349,8 +349,9 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
     if (aLocaleStr.isEmpty())
         aLocaleStr = officecfg::System::L10N::Locale::get();
 
+    static const OUStringLiteral EN_US = u"en-US";
     if (aLocaleStr.isEmpty())
-        aLocaleStr = OUString::intern(RTL_CONSTASCII_USTRINGPARAM("en-US"));
+        aLocaleStr = EN_US;
 
     // convert locale string to locale struct
     css::lang::Locale aSysLocale;
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index fb90ef02e4e1..e0c07537b749 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -805,9 +805,9 @@ void ZipFile::readLOC( ZipEntry &rEntry )
         if (nRead < aNameBuffer.getLength())
             aNameBuffer.realloc(nRead);
 
-        OUString sLOCPath = OUString::intern( reinterpret_cast<char *>(aNameBuffer.getArray()),
-                                                          aNameBuffer.getLength(),
-                                                          RTL_TEXTENCODING_UTF8 );
+        OUString sLOCPath( reinterpret_cast<char *>(aNameBuffer.getArray()),
+                           aNameBuffer.getLength(),
+                           RTL_TEXTENCODING_UTF8 );
 
         if ( rEntry.nPathLen == -1 ) // the file was created
         {
@@ -968,9 +968,9 @@ sal_Int32 ZipFile::readCEN()
                 throw ZipException("name too long");
 
             // read always in UTF8, some tools seem not to set UTF8 bit
-            aEntry.sPath = OUString::intern ( reinterpret_cast<char const *>(aMemGrabber.getCurrentPos()),
-                                                   aEntry.nPathLen,
-                                                   RTL_TEXTENCODING_UTF8 );
+            aEntry.sPath = OUString( reinterpret_cast<char const *>(aMemGrabber.getCurrentPos()),
+                                     aEntry.nPathLen,
+                                     RTL_TEXTENCODING_UTF8 );
 
             if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, true ) )
                 throw ZipException("Zip entry has an invalid name." );
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 0e1ad424831e..faf38e70748a 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -383,8 +383,8 @@ namespace sfx2
         {
             try
             {
-                const OUString s_sBasicStorageName( OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) );
-                const OUString s_sScriptsStorageName( OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Scripts" ) ) );
+                static constexpr OUStringLiteral s_sBasicStorageName( u"Basic" );
+                static constexpr OUStringLiteral s_sScriptsStorageName( u"Scripts" );
 
                 bHasMacros =(   (   rxStorage->hasByName( s_sBasicStorageName )
                                 &&  rxStorage->isStorageElement( s_sBasicStorageName )


More information about the Libreoffice-commits mailing list