summaryrefslogtreecommitdiff
path: root/i18npool/source/transliteration/halfwidthToFullwidth.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-06-22 13:27:08 +0200
committerLuboš Luňák <l.lunak@collabora.com>2018-06-26 11:58:47 +0200
commite9430571c41367625110cdcde168da178b8b30a9 (patch)
tree4fc083a81d97087aedfb2a2e0dbd7814a3875d39 /i18npool/source/transliteration/halfwidthToFullwidth.cxx
parent364af18d7394c113dc8624c0c84de28c2747a927 (diff)
remove the useOffset thread-unsafe hack from transliteration
And instead pass it as an argument to an implementation function. Otherwise this is thread-unsafe for Calc's threaded calculation, and transliteration is used in various places in Calc code. Change-Id: Ibdf95e4b6867ec251618f6ff91e605acb69667c0 Reviewed-on: https://gerrit.libreoffice.org/56290 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'i18npool/source/transliteration/halfwidthToFullwidth.cxx')
-rw-r--r--i18npool/source/transliteration/halfwidthToFullwidth.cxx33
1 files changed, 12 insertions, 21 deletions
diff --git a/i18npool/source/transliteration/halfwidthToFullwidth.cxx b/i18npool/source/transliteration/halfwidthToFullwidth.cxx
index 14b23ee95707..4857f2896ecf 100644
--- a/i18npool/source/transliteration/halfwidthToFullwidth.cxx
+++ b/i18npool/source/transliteration/halfwidthToFullwidth.cxx
@@ -35,17 +35,14 @@ halfwidthToFullwidth::halfwidthToFullwidth()
implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH";
}
-OUString SAL_CALL
-halfwidthToFullwidth::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
+OUString
+halfwidthToFullwidth::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset )
{
- bool _useOffset = useOffset;
// One to One mapping
- useOffset = false;
- const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
- useOffset = _useOffset;
+ const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, offset, false);
// 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(), offset, useOffset );
}
halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
@@ -56,17 +53,14 @@ halfwidthKatakanaToFullwidthKatakana::halfwidthKatakanaToFullwidthKatakana()
implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTHKATAKANA_FULLWIDTHKATAKANA";
}
-OUString SAL_CALL
-halfwidthKatakanaToFullwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
+OUString
+halfwidthKatakanaToFullwidthKatakana::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset )
{
- bool _useOffset = useOffset;
// One to One mapping
- useOffset = false;
- const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
- useOffset = _useOffset;
+ const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, offset, false);
// 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(), offset, useOffset );
}
halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
@@ -77,17 +71,14 @@ halfwidthToFullwidthLikeJIS::halfwidthToFullwidthLikeJIS()
implementationName = "com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH_LIKE_JIS";
}
-OUString SAL_CALL
-halfwidthToFullwidthLikeJIS::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
+OUString
+halfwidthToFullwidthLikeJIS::transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset, bool useOffset )
{
- bool _useOffset = useOffset;
// One to One mapping
- useOffset = false;
- const OUString& newStr = transliteration_OneToOne::transliterate( inStr, startPos, nCount, offset);
- useOffset = _useOffset;
+ const OUString& newStr = transliteration_OneToOne::transliterateImpl( inStr, startPos, nCount, offset, false);
// Composition: KA + voice-mark --> GA
- return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, _useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU );
+ return i18nutil::widthfolding::compose_ja_voiced_sound_marks ( newStr, 0, newStr.getLength(), offset, useOffset, WIDTHFOLDNIG_DONT_USE_COMBINED_VU );
}