[Libreoffice-commits] core.git: i18npool/inc i18npool/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 18 16:26:33 UTC 2021


 i18npool/inc/nativenumbersupplier.hxx                       |    8 +++++---
 i18npool/source/nativenumber/nativenumbersupplier.cxx       |    6 +++---
 i18npool/source/transliteration/transliteration_Numeric.cxx |    4 ++--
 3 files changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 270c04bd68cdb154ea1e74a307a5cbb6e81fb1a6
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Sep 18 13:51:28 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Sep 18 18:25:59 2021 +0200

    remove some allocations
    
    where we could be calling static methods
    
    Change-Id: I9efef083e6ff307441fb36c19eac9134d960edec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122300
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx
index e1ea81627b3a..1f3e613caa62 100644
--- a/i18npool/inc/nativenumbersupplier.hxx
+++ b/i18npool/inc/nativenumbersupplier.hxx
@@ -44,8 +44,8 @@ public:
         virtual OUString SAL_CALL getNativeNumberString( const OUString& aNumberString,
                 const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) override;
 
-        virtual sal_Bool SAL_CALL isValidNatNum( const css::lang::Locale& aLocale,
-                sal_Int16 nNativeNumberMode ) override;
+        virtual sal_Bool SAL_CALL isValidNatNum( const css::lang::Locale& rLocale,
+                sal_Int16 nNativeNumberMode ) override { return isValidNatNumImpl(rLocale, nNativeNumberMode); }
 
         virtual css::i18n::NativeNumberXmlAttributes SAL_CALL convertToXmlAttributes(
                 const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) override;
@@ -71,10 +71,12 @@ public:
                                        css::uno::Sequence<sal_Int32>* pOffset,
                                        const OUString& rNativeNumberParams = OUString());
         /// @throws css::uno::RuntimeException
-        sal_Unicode getNativeNumberChar( const sal_Unicode inChar,
+        static sal_Unicode getNativeNumberChar( const sal_Unicode inChar,
                 const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) ;
 
 private:
+        static bool isValidNatNumImpl( const css::lang::Locale& aLocale,
+                sal_Int16 nNativeNumberMode );
         css::lang::Locale aLocale;
         mutable css::uno::Reference< css::i18n::XCharacterClassification > xCharClass;
 };
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 1055512ce944..13d6698ae203 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -634,7 +634,7 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum
                                                             Sequence<sal_Int32>* pOffset,
                                                             const OUString& rNativeNumberParams)
 {
-    if (!isValidNatNum(rLocale, nNativeNumberMode))
+    if (!isValidNatNumImpl(rLocale, nNativeNumberMode))
         return aNumberString;
 
     if (nNativeNumberMode == NativeNumberMode::NATNUM12)
@@ -806,7 +806,7 @@ sal_Unicode NativeNumberSupplierService::getNativeNumberChar( const sal_Unicode
     if (!isNumber(inChar))
         return inChar;
 
-    if (!isValidNatNum(rLocale, nNativeNumberMode))
+    if (!isValidNatNumImpl(rLocale, nNativeNumberMode))
         return inChar;
 
     sal_Int16 langnum = getLanguageNumber(rLocale);
@@ -837,7 +837,7 @@ sal_Unicode NativeNumberSupplierService::getNativeNumberChar( const sal_Unicode
     return inChar;
 }
 
-sal_Bool SAL_CALL NativeNumberSupplierService::isValidNatNum( const Locale& rLocale, sal_Int16 nNativeNumberMode )
+bool NativeNumberSupplierService::isValidNatNumImpl( const Locale& rLocale, sal_Int16 nNativeNumberMode )
 {
     sal_Int16 langnum = getLanguageNumber(rLocale);
 
diff --git a/i18npool/source/transliteration/transliteration_Numeric.cxx b/i18npool/source/transliteration/transliteration_Numeric.cxx
index 4a24ebe4139f..35b2b2549b34 100644
--- a/i18npool/source/transliteration/transliteration_Numeric.cxx
+++ b/i18npool/source/transliteration/transliteration_Numeric.cxx
@@ -119,7 +119,7 @@ transliteration_Numeric::transliterateImpl( const OUString& inStr, sal_Int32 sta
     if (tableSize)
         return transliterateBullet( inStr, startPos, nCount, pOffset);
     else
-        return rtl::Reference<NativeNumberSupplierService>(new NativeNumberSupplierService())->getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, pOffset );
+        return rtl::Reference(new NativeNumberSupplierService())->getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, pOffset );
 }
 
 sal_Unicode SAL_CALL
@@ -134,7 +134,7 @@ transliteration_Numeric::transliterateChar2Char( sal_Unicode inChar )
         return inChar;
     }
     else
-        return rtl::Reference<NativeNumberSupplierService>(new NativeNumberSupplierService)->getNativeNumberChar( inChar, aLocale, nNativeNumberMode );
+        return NativeNumberSupplierService::getNativeNumberChar( inChar, aLocale, nNativeNumberMode );
 }
 
 }


More information about the Libreoffice-commits mailing list