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 | |
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>
24 files changed, 147 insertions, 147 deletions
diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx index ff01d6624ca3..2ac854abddbd 100644 --- a/i18npool/inc/textToPronounce_zh.hxx +++ b/i18npool/inc/textToPronounce_zh.hxx @@ -42,7 +42,7 @@ public: virtual ~TextToPronounce_zh() override; OUString - foldingImpl(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > & offset, bool useOffset) override; + foldingImpl(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset) override; sal_Int16 SAL_CALL getType() override; diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index 854dbfeb5cac..eaf9d602179a 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -33,7 +33,7 @@ class transliteration_Ignore : public transliteration_commonclass { public: virtual OUString - foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; // This method is shared. sal_Bool SAL_CALL @@ -49,7 +49,7 @@ public: sal_Int16 SAL_CALL getType( ) override; OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar) override; @@ -98,7 +98,7 @@ public: ignoreDiacritics_CTL(); OUString - foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset, bool useOffset) override; + foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>* pOffset) override; sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode nInChar) override; @@ -117,7 +117,7 @@ public:\ implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\ };\ OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \ - css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \ + css::uno::Sequence< sal_Int32 >* pOffset) override; \ }; TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP) @@ -138,7 +138,7 @@ public:\ implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\ };\ OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \ - css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \ + css::uno::Sequence< sal_Int32 >* pOffset) override; \ using transliteration_Ignore::transliterateRange;\ css::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1, \ const OUString& str2 ) override; \ diff --git a/i18npool/inc/transliteration_Numeric.hxx b/i18npool/inc/transliteration_Numeric.hxx index 8ebf2a394a4a..1e50e4a5d69c 100644 --- a/i18npool/inc/transliteration_Numeric.hxx +++ b/i18npool/inc/transliteration_Numeric.hxx @@ -26,7 +26,7 @@ namespace i18npool { class transliteration_Numeric : public transliteration_commonclass { public: virtual OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar) override; @@ -35,7 +35,7 @@ public: virtual sal_Int16 SAL_CALL getType( ) override; virtual OUString - foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; virtual sal_Bool SAL_CALL equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) override; @@ -51,7 +51,7 @@ private: /// @throws css::uno::RuntimeException OUString transliterateBullet( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - css::uno::Sequence< sal_Int32 >& offset, bool useOffset ); + css::uno::Sequence< sal_Int32 >* pOffset ); }; } diff --git a/i18npool/inc/transliteration_OneToOne.hxx b/i18npool/inc/transliteration_OneToOne.hxx index 9c2f79f8072d..957abcf84de2 100644 --- a/i18npool/inc/transliteration_OneToOne.hxx +++ b/i18npool/inc/transliteration_OneToOne.hxx @@ -31,7 +31,7 @@ class transliteration_OneToOne : public transliteration_commonclass { public: OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar) override; @@ -40,7 +40,7 @@ public: sal_Int16 SAL_CALL getType() override; OUString - foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; sal_Bool SAL_CALL equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, @@ -60,7 +60,7 @@ class name final : public transliteration_OneToOne \ public: \ name (); \ OUString \ - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) \ + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) \ override; \ sal_Unicode SAL_CALL \ transliterateChar2Char( sal_Unicode inChar) \ @@ -76,21 +76,21 @@ class halfwidthToFullwidth final : public transliteration_OneToOne public: halfwidthToFullwidth(); OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; }; class HALFWIDTHKATAKANA_FULLWIDTHKATAKANA final : public transliteration_OneToOne { public: HALFWIDTHKATAKANA_FULLWIDTHKATAKANA(); OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; }; class HALFWIDTH_FULLWIDTH_LIKE_JIS final : public transliteration_OneToOne { public: HALFWIDTH_FULLWIDTH_LIKE_JIS(); OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override; }; #undef TRANSLITERATION_ONETOONE diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index aea4cd79531e..d602cbfd6ffb 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -33,7 +33,7 @@ public: sal_Int16 SAL_CALL getType() override; OUString transliterateImpl(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; + css::uno::Sequence< sal_Int32 >* pOffset) override; OUString SAL_CALL transliterateChar2String( sal_Unicode inChar) override; @@ -42,7 +42,7 @@ public: transliterateChar2Char( sal_Unicode inChar) override; OUString foldingImpl(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; + css::uno::Sequence< sal_Int32 >* pOffset) override; sal_Bool SAL_CALL equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, @@ -86,7 +86,7 @@ public: Transliteration_titlecase(); virtual OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + css::uno::Sequence< sal_Int32 >* pOffset ) override; }; class Transliteration_sentencecase final : public Transliteration_body @@ -95,7 +95,7 @@ public: Transliteration_sentencecase(); virtual OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override; + css::uno::Sequence< sal_Int32 >* pOffset ) override; }; } diff --git a/i18npool/inc/transliteration_commonclass.hxx b/i18npool/inc/transliteration_commonclass.hxx index 97f716c082a5..3cead59a913c 100644 --- a/i18npool/inc/transliteration_commonclass.hxx +++ b/i18npool/inc/transliteration_commonclass.hxx @@ -57,11 +57,11 @@ public: virtual OUString SAL_CALL transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override final - { return transliterateImpl( inStr, startPos, nCount, offset, true ); } + { return transliterateImpl( inStr, startPos, nCount, &offset ); } virtual OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override final - { return foldingImpl( inStr, startPos, nCount, offset, true ); } + { return foldingImpl( inStr, startPos, nCount, &offset ); } // Methods in XExtendedTransliteration virtual OUString SAL_CALL @@ -89,10 +89,10 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; protected: virtual OUString - transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) = 0; + transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) = 0; virtual OUString - foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) = 0; + foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) = 0; css::lang::Locale aLocale; const char* transliterationName; diff --git a/i18npool/source/transliteration/fullwidthToHalfwidth.cxx b/i18npool/source/transliteration/fullwidthToHalfwidth.cxx index 1ae6a379fd94..6a90a957f038 100644 --- a/i18npool/source/transliteration/fullwidthToHalfwidth.cxx +++ b/i18npool/source/transliteration/fullwidthToHalfwidth.cxx @@ -44,13 +44,13 @@ fullwidthToHalfwidth::fullwidthToHalfwidth() * The output string contains a transliterated string only, not whole string. */ OUString -fullwidthToHalfwidth::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +fullwidthToHalfwidth::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Decomposition: GA --> KA + voice-mark - const OUString& newStr = i18nutil::widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset); + const OUString& newStr = i18nutil::widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, pOffset); // One to One mapping - return transliteration_OneToOne::transliterateImpl( newStr, 0, newStr.getLength(), offset, false); + return transliteration_OneToOne::transliterateImpl( newStr, 0, newStr.getLength(), pOffset); } sal_Unicode SAL_CALL @@ -74,13 +74,13 @@ FULLWIDTHKATAKANA_HALFWIDTHKATAKANA::FULLWIDTHKATAKANA_HALFWIDTHKATAKANA() * Transliterate fullwidth katakana to halfwidth katakana. */ OUString -FULLWIDTHKATAKANA_HALFWIDTHKATAKANA::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +FULLWIDTHKATAKANA_HALFWIDTHKATAKANA::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Decomposition: GA --> KA + voice-mark - const OUString& newStr = i18nutil::widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset); + const OUString& newStr = i18nutil::widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, pOffset); // One to One mapping - return transliteration_OneToOne::transliterateImpl( newStr, 0, newStr.getLength(), offset, false); + return transliteration_OneToOne::transliterateImpl( newStr, 0, newStr.getLength(), nullptr); } sal_Unicode SAL_CALL @@ -104,13 +104,13 @@ FULLWIDTH_HALFWIDTH_LIKE_ASC::FULLWIDTH_HALFWIDTH_LIKE_ASC() * Transliterate fullwidth to halfwidth like Excel's ASC function. */ OUString -FULLWIDTH_HALFWIDTH_LIKE_ASC::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +FULLWIDTH_HALFWIDTH_LIKE_ASC::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Decomposition: GA --> KA + voice-mark - const OUString& newStr = i18nutil::widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset); + const OUString& newStr = i18nutil::widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, pOffset); // One to One mapping - return transliteration_OneToOne::transliterateImpl( newStr, 0, newStr.getLength(), offset, false); + return transliteration_OneToOne::transliterateImpl( newStr, 0, newStr.getLength(), nullptr); } sal_Unicode SAL_CALL diff --git a/i18npool/source/transliteration/halfwidthToFullwidth.cxx b/i18npool/source/transliteration/halfwidthToFullwidth.cxx index e69e245f16d7..8351291031f7 100644 --- a/i18npool/source/transliteration/halfwidthToFullwidth.cxx +++ b/i18npool/source/transliteration/halfwidthToFullwidth.cxx @@ -36,13 +36,13 @@ halfwidthToFullwidth::halfwidthToFullwidth() } OUString -halfwidthToFullwidth::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +halfwidthToFullwidth::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // One to One mapping - const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, offset, false); + const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, nullptr); // Composition: KA + voice-mark --> GA - return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, useOffset ); + return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), pOffset ); } HALFWIDTHKATAKANA_FULLWIDTHKATAKANA::HALFWIDTHKATAKANA_FULLWIDTHKATAKANA() @@ -54,13 +54,13 @@ HALFWIDTHKATAKANA_FULLWIDTHKATAKANA::HALFWIDTHKATAKANA_FULLWIDTHKATAKANA() } OUString -HALFWIDTHKATAKANA_FULLWIDTHKATAKANA::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +HALFWIDTHKATAKANA_FULLWIDTHKATAKANA::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // One to One mapping - const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, offset, false); + const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, nullptr); // Composition: KA + voice-mark --> GA - return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, useOffset ); + return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), pOffset ); } HALFWIDTH_FULLWIDTH_LIKE_JIS::HALFWIDTH_FULLWIDTH_LIKE_JIS() @@ -72,13 +72,13 @@ HALFWIDTH_FULLWIDTH_LIKE_JIS::HALFWIDTH_FULLWIDTH_LIKE_JIS() } OUString -HALFWIDTH_FULLWIDTH_LIKE_JIS::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +HALFWIDTH_FULLWIDTH_LIKE_JIS::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // One to One mapping - const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, offset, false); + const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, nullptr); // Composition: KA + voice-mark --> GA - return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, useOffset, WIDTHFOLDING_DONT_USE_COMBINED_VU ); + return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), pOffset, WIDTHFOLDING_DONT_USE_COMBINED_VU ); } diff --git a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx index 5980f8e8d2f7..9339d87eab44 100644 --- a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx +++ b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx @@ -49,7 +49,7 @@ ignoreDiacritics_CTL::transliterateChar2Char(sal_Unicode nInChar) OUString ignoreDiacritics_CTL::foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, - sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset, bool useOffset) + sal_Int32 nCount, css::uno::Sequence<sal_Int32>* pOffset) { if (!m_transliterator) throw css::uno::RuntimeException(); @@ -57,7 +57,7 @@ ignoreDiacritics_CTL::foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, if (nStartPos < 0 || nStartPos + nCount > rInStr.getLength()) throw css::uno::RuntimeException(); - if (useOffset) + if (pOffset) { OUStringBuffer aOutBuf(nCount); @@ -79,7 +79,7 @@ ignoreDiacritics_CTL::foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, nPosition = nIndex; } - rOffset = comphelper::containerToSequence(aOffset); + *pOffset = comphelper::containerToSequence(aOffset); return aOutBuf.makeStringAndClear(); } else diff --git a/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx b/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx index 0be8c094c876..4d09e9f88ef0 100644 --- a/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreIandEfollowedByYa_ja_JP.cxx @@ -66,7 +66,7 @@ i18nutil::OneToOneMappingTable_t const IandE[] = { OUString -ignoreIandEfollowedByYa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreIandEfollowedByYa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Create a string buffer which can hold nCount + 1 characters. // The reference count is 1 now. @@ -74,10 +74,10 @@ ignoreIandEfollowedByYa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 sta sal_Unicode * dst = newStr->buffer; const sal_Unicode * src = inStr.getStr() + startPos; - if (useOffset) { + if (pOffset) { // Allocate nCount length to offset argument. - offset.realloc( nCount ); - std::iota(offset.begin(), offset.end(), startPos); + pOffset->realloc( nCount ); + std::iota(pOffset->begin(), pOffset->end(), startPos); } @@ -114,8 +114,8 @@ ignoreIandEfollowedByYa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 sta *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 } diff --git a/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx b/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx index 66e53845196e..22a600d51f41 100644 --- a/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreIterationMark_ja_JP.cxx @@ -82,7 +82,7 @@ i18nutil::OneToOneMappingTable_t const ignoreIterationMark_ja_JP_mappingTable[] OUString -ignoreIterationMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreIterationMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { i18nutil::oneToOneMapping aTable(ignoreIterationMark_ja_JP_mappingTable, sizeof(ignoreIterationMark_ja_JP_mappingTable)); @@ -92,10 +92,10 @@ ignoreIterationMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPo sal_Unicode * dst = newStr->buffer; const sal_Unicode * src = inStr.getStr() + startPos; - if (useOffset) { + if (pOffset) { // Allocate nCount length to offset argument. - offset.realloc( nCount ); - std::iota(offset.begin(), offset.end(), startPos); + pOffset->realloc( nCount ); + std::iota(pOffset->begin(), pOffset->end(), startPos); } @@ -128,8 +128,8 @@ ignoreIterationMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPo *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 } diff --git a/i18npool/source/transliteration/ignoreKana.cxx b/i18npool/source/transliteration/ignoreKana.cxx index 7e94558f4fea..86a484e1a67b 100644 --- a/i18npool/source/transliteration/ignoreKana.cxx +++ b/i18npool/source/transliteration/ignoreKana.cxx @@ -30,10 +30,10 @@ using namespace com::sun::star::lang; namespace i18npool { OUString -ignoreKana::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreKana::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { rtl::Reference< hiraganaToKatakana > t1(new hiraganaToKatakana); - return t1->transliterateImpl(inStr, startPos, nCount, offset, useOffset); + return t1->transliterateImpl(inStr, startPos, nCount, pOffset); } Sequence< OUString > SAL_CALL diff --git a/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx b/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx index 53a2f058d0a9..f54ff822e4e1 100644 --- a/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreKiKuFollowedBySa_ja_JP.cxx @@ -27,7 +27,7 @@ using namespace com::sun::star::lang; namespace i18npool { OUString -ignoreKiKuFollowedBySa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreKiKuFollowedBySa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Create a string buffer which can hold nCount + 1 characters. // The reference count is 1 now. @@ -35,10 +35,10 @@ ignoreKiKuFollowedBySa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 star sal_Unicode * dst = newStr->buffer; const sal_Unicode * src = inStr.getStr() + startPos; - if (useOffset) { + if (pOffset) { // Allocate nCount length to offset argument. - offset.realloc( nCount ); - std::iota(offset.begin(), offset.end(), startPos); + pOffset->realloc( nCount ); + std::iota(pOffset->begin(), pOffset->end(), startPos); } @@ -72,8 +72,8 @@ ignoreKiKuFollowedBySa_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 star *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 } diff --git a/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx b/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx index d40bec956589..4d7f8241a35a 100644 --- a/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreProlongedSoundMark_ja_JP.cxx @@ -289,7 +289,7 @@ const sal_Unicode table_halfwidth[] = { OUString -ignoreProlongedSoundMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreProlongedSoundMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { // Create a string buffer which can hold nCount + 1 characters. // The reference count is 1 now. @@ -297,10 +297,10 @@ ignoreProlongedSoundMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 st sal_Unicode * dst = newStr->buffer; const sal_Unicode * src = inStr.getStr() + startPos; - if (useOffset) { + if (pOffset) { // Allocate nCount length to offset argument. - offset.realloc( nCount ); - std::iota(offset.begin(), offset.end(), startPos); + pOffset->realloc( nCount ); + std::iota(pOffset->begin(), pOffset->end(), startPos); } @@ -333,8 +333,8 @@ ignoreProlongedSoundMark_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 st *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 } diff --git a/i18npool/source/transliteration/ignoreSize_ja_JP.cxx b/i18npool/source/transliteration/ignoreSize_ja_JP.cxx index 8ed2be8b6db3..01f3f20da43f 100644 --- a/i18npool/source/transliteration/ignoreSize_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreSize_ja_JP.cxx @@ -27,10 +27,10 @@ using namespace com::sun::star::lang; namespace i18npool { OUString -ignoreSize_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreSize_ja_JP::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { rtl::Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP); - return t1->transliterateImpl(inStr, startPos, nCount, offset, useOffset); + return t1->transliterateImpl(inStr, startPos, nCount, pOffset); } diff --git a/i18npool/source/transliteration/ignoreWidth.cxx b/i18npool/source/transliteration/ignoreWidth.cxx index 072a0e988699..1b9f15fde159 100644 --- a/i18npool/source/transliteration/ignoreWidth.cxx +++ b/i18npool/source/transliteration/ignoreWidth.cxx @@ -30,10 +30,10 @@ using namespace com::sun::star::lang; namespace i18npool { OUString -ignoreWidth::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset ) +ignoreWidth::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >* pOffset ) { rtl::Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth); - return t1->transliterateImpl(inStr, startPos, nCount, offset, useOffset); + return t1->transliterateImpl(inStr, startPos, nCount, pOffset); } Sequence< OUString > SAL_CALL diff --git a/i18npool/source/transliteration/textToPronounce_zh.cxx b/i18npool/source/transliteration/textToPronounce_zh.cxx index 42fdb5280ed3..a8410592ae42 100644 --- a/i18npool/source/transliteration/textToPronounce_zh.cxx +++ b/i18npool/source/transliteration/textToPronounce_zh.cxx @@ -51,7 +51,7 @@ TextToPronounce_zh::getPronounce(const sal_Unicode ch) OUString TextToPronounce_zh::foldingImpl(const OUString & inStr, sal_Int32 startPos, - sal_Int32 nCount, Sequence< sal_Int32 > & offset, bool useOffset) + sal_Int32 nCount, Sequence< sal_Int32 >* pOffset) { OUStringBuffer sb; const sal_Unicode * chArr = inStr.getStr() + startPos; @@ -62,13 +62,13 @@ TextToPronounce_zh::foldingImpl(const OUString & inStr, sal_Int32 startPos, if (startPos + nCount > inStr.getLength()) nCount = inStr.getLength() - startPos; - offset[0] = 0; + (*pOffset)[0] = 0; for (sal_Int32 i = 0; i < nCount; i++) { OUString pron(getPronounce(chArr[i])); sb.append(pron); - if (useOffset) - offset[i + 1] = offset[i] + pron.getLength(); + if (pOffset) + (*pOffset)[i + 1] = (*pOffset)[i] + pron.getLength(); } return sb.makeStringAndClear(); } diff --git a/i18npool/source/transliteration/transliteration_Ignore.cxx b/i18npool/source/transliteration/transliteration_Ignore.cxx index c3faeb11ed0f..b3c9dc96cddf 100644 --- a/i18npool/source/transliteration/transliteration_Ignore.cxx +++ b/i18npool/source/transliteration/transliteration_Ignore.cxx @@ -80,10 +80,10 @@ transliteration_Ignore::getType() OUString transliteration_Ignore::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool useOffset) + Sequence< sal_Int32 >* pOffset) { // The method folding is defined in a sub class. - return foldingImpl( inStr, startPos, nCount, offset, useOffset); + return foldingImpl( inStr, startPos, nCount, pOffset); } Sequence< OUString > @@ -107,7 +107,7 @@ transliteration_Ignore::transliterateRange( const OUString& str1, const OUString OUString transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, - sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset) + sal_Int32 nCount, Sequence< sal_Int32 >* pOffset) { // Create a string buffer which can hold nCount + 1 characters. // The reference count is 1 now. @@ -118,9 +118,9 @@ transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, // Allocate nCount length to offset argument. sal_Int32 *p = nullptr; sal_Int32 position = 0; - if (useOffset) { - offset.realloc( nCount ); - p = offset.getArray(); + if (pOffset) { + pOffset->realloc( nCount ); + p = pOffset->getArray(); position = startPos; } @@ -135,7 +135,7 @@ transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, const Mapping *m; for (m = map; m->replaceChar; m++) { if (previousChar == m->previousChar && currentChar == m->currentChar ) { - if (useOffset) { + if (pOffset) { if (! m->two2one) *p++ = position; position++; @@ -151,7 +151,7 @@ transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, } if (! m->replaceChar) { - if (useOffset) + if (pOffset) *p ++ = position ++; *dst ++ = previousChar; previousChar = currentChar; @@ -159,7 +159,7 @@ transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, } if (nCount == 0) { - if (useOffset) + if (pOffset) *p = position; *dst ++ = previousChar; } @@ -170,7 +170,7 @@ transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, c = func ? func( c) : (*table)[ c ]; if (c != 0xffff) *dst ++ = c; - if (useOffset) { + if (pOffset) { if (c != 0xffff) *p ++ = position; position++; @@ -178,8 +178,8 @@ transliteration_Ignore::foldingImpl( const OUString& inStr, sal_Int32 startPos, } } newStr->length = sal_Int32(dst - newStr->buffer); - if (useOffset) - offset.realloc(newStr->length); + if (pOffset) + pOffset->realloc(newStr->length); *dst = u'\0'; return OUString(newStr, SAL_NO_ACQUIRE); // take ownership diff --git a/i18npool/source/transliteration/transliteration_Numeric.cxx b/i18npool/source/transliteration/transliteration_Numeric.cxx index 40853aafa83e..e65505ef4e68 100644 --- a/i18npool/source/transliteration/transliteration_Numeric.cxx +++ b/i18npool/source/transliteration/transliteration_Numeric.cxx @@ -36,7 +36,7 @@ sal_Int16 SAL_CALL transliteration_Numeric::getType() } OUString - transliteration_Numeric::foldingImpl( const OUString& /*inStr*/, sal_Int32 /*startPos*/, sal_Int32 /*nCount*/, Sequence< sal_Int32 >& /*offset*/, bool ) + transliteration_Numeric::foldingImpl( const OUString& /*inStr*/, sal_Int32 /*startPos*/, sal_Int32 /*nCount*/, Sequence< sal_Int32 >* /*pOffset*/ ) { throw RuntimeException(); } @@ -59,7 +59,7 @@ Sequence< OUString > SAL_CALL OUString transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool useOffset ) + Sequence< sal_Int32 >* pOffset ) { sal_Int32 number = -1, j = 0, endPos = startPos + nCount; @@ -69,8 +69,8 @@ transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 s rtl_uString* pStr = rtl_uString_alloc(nCount); sal_Unicode* out = pStr->buffer; - if (useOffset) - offset.realloc(nCount); + if (pOffset) + pOffset->realloc(nCount); for (sal_Int32 i = startPos; i < endPos; i++) { if (isNumber(inStr[i])) @@ -83,22 +83,22 @@ transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 s } } else { if (number == 0) { - if (useOffset) - offset[j] = startPos; + if (pOffset) + (*pOffset)[j] = startPos; out[j++] = NUMBER_ZERO; } else if (number > tableSize && !recycleSymbol) { for (sal_Int32 k = startPos; k < i; k++) { - if (useOffset) - offset[j] = k; + if (pOffset) + (*pOffset)[j] = k; out[j++] = inStr[k]; } } else if (number > 0) { - if (useOffset) - offset[j] = startPos; + if (pOffset) + (*pOffset)[j] = startPos; out[j++] = table[--number % tableSize]; } else if (i < endPos) { - if (useOffset) - offset[j] = i; + if (pOffset) + (*pOffset)[j] = i; out[j++] = inStr[i]; } number = -1; @@ -106,20 +106,20 @@ transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 s } out[j] = 0; - if (useOffset) - offset.realloc(j); + if (pOffset) + pOffset->realloc(j); return OUString( pStr, SAL_NO_ACQUIRE ); } OUString transliteration_Numeric::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool useOffset ) + Sequence< sal_Int32 >* pOffset ) { if (tableSize) - return transliterateBullet( inStr, startPos, nCount, offset, useOffset); + return transliterateBullet( inStr, startPos, nCount, pOffset); else - return rtl::Reference<NativeNumberSupplierService>(new NativeNumberSupplierService(useOffset))->getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, offset ); + return rtl::Reference<NativeNumberSupplierService>(new NativeNumberSupplierService(bool(pOffset)))->getNativeNumberString( inStr.copy(startPos, nCount), aLocale, nNativeNumberMode, *pOffset ); } sal_Unicode SAL_CALL diff --git a/i18npool/source/transliteration/transliteration_OneToOne.cxx b/i18npool/source/transliteration/transliteration_OneToOne.cxx index f865a4640a80..a030d558d3b8 100644 --- a/i18npool/source/transliteration/transliteration_OneToOne.cxx +++ b/i18npool/source/transliteration/transliteration_OneToOne.cxx @@ -37,7 +37,7 @@ sal_Int16 SAL_CALL transliteration_OneToOne::getType() OUString transliteration_OneToOne::foldingImpl( const OUString& /*inStr*/, sal_Int32 /*startPos*/, - sal_Int32 /*nCount*/, Sequence< sal_Int32 >& /*offset*/, bool) + sal_Int32 /*nCount*/, Sequence< sal_Int32 >* /*pOffset*/) { throw RuntimeException(); } @@ -57,7 +57,7 @@ transliteration_OneToOne::transliterateRange( const OUString& /*str1*/, const OU OUString transliteration_OneToOne::transliterateImpl( const OUString& inStr, sal_Int32 startPos, - sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset) + sal_Int32 nCount, Sequence< sal_Int32 >* pOffset) { // Create a string buffer which can hold nCount + 1 characters. // The reference count is 1 now. @@ -66,9 +66,9 @@ transliteration_OneToOne::transliterateImpl( const OUString& inStr, sal_Int32 st const sal_Unicode * src = inStr.getStr() + startPos; // Allocate nCount length to offset argument. - if (useOffset) { - offset.realloc( nCount ); - std::iota(offset.begin(), offset.end(), startPos); + if (pOffset) { + pOffset->realloc( nCount ); + std::iota(pOffset->begin(), pOffset->end(), startPos); } // Translation diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index f77fdea155e5..9fd89df75e42 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -88,7 +88,7 @@ static MappingType lcl_getMappingTypeForToggleCase( MappingType nMappingType, sa OUString Transliteration_body::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool useOffset) + Sequence< sal_Int32 >* pOffset) { const sal_Unicode *in = inStr.getStr() + startPos; @@ -113,7 +113,7 @@ Transliteration_body::transliterateImpl( sal_Int32 j = 0; // Two different blocks to eliminate the if(useOffset) condition inside the loop. // Yes, on massive use even such small things do count. - if ( useOffset ) + if ( pOffset ) { std::vector<sal_Int32> aVec; aVec.reserve(std::max<sal_Int32>(nLocalBuf, nCount) * NMAPPINGMAX); @@ -129,7 +129,7 @@ Transliteration_body::transliterateImpl( j += map.nmap; } - offset = comphelper::containerToSequence(aVec); + *pOffset = comphelper::containerToSequence(aVec); } else { @@ -173,9 +173,9 @@ Transliteration_body::transliterateChar2Char( sal_Unicode inChar ) OUString Transliteration_body::foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool useOffset) + Sequence< sal_Int32 >* pOffset) { - return transliterateImpl(inStr, startPos, nCount, offset, useOffset); + return transliterateImpl(inStr, startPos, nCount, pOffset); } Transliteration_casemapping::Transliteration_casemapping() @@ -189,7 +189,8 @@ void Transliteration_casemapping::setMappingType( const MappingType rMappingType, const Locale& rLocale ) { nMappingType = rMappingType; - aLocale = rLocale; + if (aLocale != rLocale) + aLocale = rLocale; } Transliteration_u2l::Transliteration_u2l() @@ -228,7 +229,7 @@ Transliteration_titlecase::Transliteration_titlecase() static OUString transliterate_titlecase_Impl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, const Locale &rLocale, - Sequence< sal_Int32 >& offset ) + Sequence< sal_Int32 >* pOffset ) { const OUString aText( inStr.copy( startPos, nCount ) ); @@ -255,10 +256,10 @@ static OUString transliterate_titlecase_Impl( // The rest of the text should just become lowercase. aRes = xCharClassImpl->toTitle( aResolvedLigature, 0, nResolvedLen, rLocale ) + xCharClassImpl->toLower( aText, 1, aText.getLength() - 1, rLocale ); - offset.realloc( aRes.getLength() ); + pOffset->realloc( aRes.getLength() ); - sal_Int32* pOffset = std::fill_n(offset.begin(), nResolvedLen, 0); - std::iota(pOffset, offset.end(), 1); + sal_Int32* pOffsetInt = std::fill_n(pOffset->begin(), nResolvedLen, 0); + std::iota(pOffsetInt, pOffset->end(), 1); } return aRes; } @@ -267,9 +268,9 @@ static OUString transliterate_titlecase_Impl( // namely that startPos points to the first char of the word OUString Transliteration_titlecase::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool ) + Sequence< sal_Int32 >* pOffset ) { - return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, offset ); + return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, pOffset ); } Transliteration_sentencecase::Transliteration_sentencecase() @@ -283,9 +284,9 @@ Transliteration_sentencecase::Transliteration_sentencecase() // namely that startPos points to the first word (NOT first char!) in the sentence OUString Transliteration_sentencecase::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset, bool ) + Sequence< sal_Int32 >* pOffset ) { - return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, offset ); + return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, pOffset ); } } diff --git a/i18npool/source/transliteration/transliteration_commonclass.cxx b/i18npool/source/transliteration/transliteration_commonclass.cxx index 3c95b6845d34..054ae60e220c 100644 --- a/i18npool/source/transliteration/transliteration_commonclass.cxx +++ b/i18npool/source/transliteration/transliteration_commonclass.cxx @@ -106,8 +106,7 @@ transliteration_commonclass::compareString( const OUString& str1, const OUString OUString SAL_CALL transliteration_commonclass::transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) { - Sequence < sal_Int32 > dummy_offset; - return transliterateImpl(inStr, startPos, nCount, dummy_offset, false); + return transliterateImpl(inStr, startPos, nCount, nullptr); } OUString SAL_CALL 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 } diff --git a/include/i18nutil/widthfolding.hxx b/include/i18nutil/widthfolding.hxx index 616b6884e5a1..87b909b9169f 100644 --- a/include/i18nutil/widthfolding.hxx +++ b/include/i18nutil/widthfolding.hxx @@ -43,9 +43,9 @@ public: static oneToOneMapping& getfullKana2halfKanaTable(); static oneToOneMapping& gethalfKana2fullKanaTable(); - static OUString decompose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset); + static OUString decompose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset); static sal_Unicode decompose_ja_voiced_sound_marksChar2Char (sal_Unicode inChar); - static OUString compose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset, sal_Int32 nFlags = 0 ); + static OUString compose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset, sal_Int32 nFlags = 0 ); static sal_Unicode getCompositionChar(sal_Unicode c1, sal_Unicode c2); }; |