summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-09-18 13:51:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-18 18:25:59 +0200
commit270c04bd68cdb154ea1e74a307a5cbb6e81fb1a6 (patch)
tree9425b14afcd23ebc9ec8a5ce3a42e32aa11e17cd /i18npool
parent0685678da0994103b14b9417c52310bd40e21102 (diff)
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@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/inc/nativenumbersupplier.hxx8
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx6
-rw-r--r--i18npool/source/transliteration/transliteration_Numeric.cxx4
3 files changed, 10 insertions, 8 deletions
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 );
}
}