diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-06-26 11:48:42 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2018-07-04 16:52:09 +0200 |
commit | 6b5d49e129ba1f480ff74b4db657bd0e0dcd2bdf (patch) | |
tree | 61d7e93dbcf6bb83e6e0f55432e4431eb9f3cfab | |
parent | e62d2e5ebc94a64767c4c5e6f1f7529cada72fe4 (diff) |
fix thread-unsafe return of a reference to a static
The Mapping struct is small, so there's no need to reuse it.
Without this, sc/qa/.../sumif_wildcards.fods sometimes fails with calc
threading.
Change-Id: If1f370bebe8e1afa14f8645d843a056b6f0dbdea
Reviewed-on: https://gerrit.libreoffice.org/56449
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
(cherry picked from commit 87ac4627260bc56825f1283a3a4d88b7f5e466d8)
Reviewed-on: https://gerrit.libreoffice.org/56514
-rw-r--r-- | i18nutil/source/utility/casefolding.cxx | 6 | ||||
-rw-r--r-- | include/i18nutil/casefolding.hxx | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/i18nutil/source/utility/casefolding.cxx b/i18nutil/source/utility/casefolding.cxx index 0d957c0a91b6..52a8a2a913b9 100644 --- a/i18nutil/source/utility/casefolding.cxx +++ b/i18nutil/source/utility/casefolding.cxx @@ -57,7 +57,7 @@ static bool cased_letter(sal_Unicode ch) // whenever there are more accents above. #define accent_above(ch) (((ch) >= 0x0300 && (ch) <= 0x0314) || ((ch) >= 0x033D && (ch) <= 0x0344) || (ch) == 0x0346 || ((ch) >= 0x034A && (ch) <= 0x034C)) -Mapping& casefolding::getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, Locale const & aLocale, MappingType nMappingType) +const Mapping& casefolding::getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, Locale const & aLocale, MappingType nMappingType) { switch(str[pos]) { case 0x03a3: @@ -86,9 +86,9 @@ Mapping& casefolding::getConditionalValue(const sal_Unicode* str, sal_Int32 pos, throw RuntimeException(); } -Mapping& casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, Locale const & aLocale, MappingType nMappingType) +Mapping casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, Locale const & aLocale, MappingType nMappingType) { - static Mapping dummy = { 0, 1, { 0, 0, 0 } }; + Mapping dummy = { 0, 1, { 0, 0, 0 } }; sal_Int16 address = CaseMappingIndex[str[pos] >> 8]; dummy.map[0] = str[pos]; diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx index 5ed59c57cd36..ca29cabb4959 100644 --- a/include/i18nutil/casefolding.hxx +++ b/include/i18nutil/casefolding.hxx @@ -74,9 +74,9 @@ class I18NUTIL_DLLPUBLIC casefolding { public: /// @throws css::uno::RuntimeException - static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType); + static Mapping getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType); /// @throws css::uno::RuntimeException - static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType); + static const Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale const & aLocale, MappingType nMappingType); /// @throws css::uno::RuntimeException static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale const & aLocale, MappingType nMappingtype, TransliterationFlags moduleLoaded); |