diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-16 10:36:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-16 12:05:00 +0200 |
commit | c7551e8a46e2f9f8142aa7921a0494221ae096e8 (patch) | |
tree | 1ac1a31fa7993a1e490f1e0d89146cc3cd9524f5 /i18nutil | |
parent | 92e8706b6de54b0e2e7d5915f5f9ff299727930d (diff) |
speedup CharacterClassificationImpl::toUpper
remove empty sequence creation in CharacterClassificationImpl::toUpper,
rather pass a pointer, so it can be nullptr.
Which results in a fair degree of cascading change.
Change-Id: Ie56d49dc71480195c1807764b0d5124f0019f30b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122183
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18nutil')
-rw-r--r-- | i18nutil/source/utility/widthfolding.cxx | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/i18nutil/source/utility/widthfolding.cxx b/i18nutil/source/utility/widthfolding.cxx index 7efddd564f0a..6a1b52d1612e 100644 --- a/i18nutil/source/utility/widthfolding.cxx +++ b/i18nutil/source/utility/widthfolding.cxx @@ -39,7 +39,7 @@ sal_Unicode widthfolding::decompose_ja_voiced_sound_marksChar2Char (sal_Unicode /** * Decompose Japanese specific voiced and semi-voiced sound marks. */ -OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Create a string buffer which can hold nCount * 2 + 1 characters. // Its size may become double of nCount. @@ -48,10 +48,10 @@ OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, s sal_Int32 *p = nullptr; sal_Int32 position = 0; - if (useOffset) { + if (pOffset) { // Allocate double of nCount length to offset argument. - offset.realloc( nCount * 2 ); - p = offset.getArray(); + pOffset->realloc( nCount * 2 ); + p = pOffset->getArray(); position = startPos; } @@ -72,7 +72,7 @@ OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, s if (first != 0x0000) { *dst ++ = first; *dst ++ = decomposition_table[i].decomposited_character_2; // second - if (useOffset) { + if (pOffset) { *p ++ = position; *p ++ = position ++; } @@ -80,14 +80,14 @@ OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, s } } *dst ++ = c; - if (useOffset) + if (pOffset) *p ++ = position ++; } *dst = u'\0'; newStr->length = sal_Int32(dst - newStr->buffer); - if (useOffset) - offset.realloc(newStr->length); + if (pOffset) + pOffset->realloc(newStr->length); return OUString(newStr, SAL_NO_ACQUIRE); // take ownership } @@ -101,7 +101,7 @@ oneToOneMapping& widthfolding::getfull2halfTable() /** * Compose Japanese specific voiced and semi-voiced sound marks. */ -OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset, sal_Int32 nFlags ) +OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset, sal_Int32 nFlags ) { // Create a string buffer which can hold nCount + 1 characters. // Its size may become equal to nCount or smaller. @@ -126,10 +126,10 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal sal_Int32 *p = nullptr; sal_Int32 position = 0; - if (useOffset) { + if (pOffset) { // Allocate nCount length to offset argument. - offset.realloc( nCount ); - p = offset.getArray(); + pOffset->realloc( nCount ); + p = pOffset->getArray(); position = startPos; } @@ -165,7 +165,7 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal bCompose = false; if( bCompose ){ - if (useOffset) { + if (pOffset) { position ++; *p ++ = position ++; } @@ -175,14 +175,14 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal continue; } } - if (useOffset) + if (pOffset) *p ++ = position ++; *dst ++ = previousChar; previousChar = currentChar; } if (nCount == 0) { - if (useOffset) + if (pOffset) *p = position; *dst ++ = previousChar; } @@ -191,8 +191,8 @@ OUString widthfolding::compose_ja_voiced_sound_marks (const OUString& inStr, sal newStr->length = sal_Int32(dst - newStr->buffer); } - if (useOffset) - offset.realloc(newStr->length); + if (pOffset) + pOffset->realloc(newStr->length); return OUString(newStr, SAL_NO_ACQUIRE); // take ownership } |