diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-08-28 11:46:34 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-08-28 11:46:34 +0000 |
commit | d56bedfb425cf77f176f143455e4a9fb6ce65540 (patch) | |
tree | 1a935a1c84ed7383fb919d9a1aa18bb5b2fb3ca0 /i18npool | |
parent | e2570b1d99e532507a442b3f03f7a3c1bdc368c7 (diff) |
INTEGRATION: CWS i18n36_SRC680 (1.21.2.1.2); FILE MERGED
2007/08/22 20:02:28 khong 1.21.2.1.2.2: i80923 fix infinite loop problem
2007/08/22 17:11:44 khong 1.21.2.1.2.1: i80923 fix a infinite loop
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/source/breakiterator/breakiteratorImpl.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 7c27c8fe7227..155b7ecdd8e8 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -4,9 +4,9 @@ * * $RCSfile: breakiteratorImpl.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: ihi $ $Date: 2007-08-17 14:58:11 $ + * last change: $Author: vg $ $Date: 2007-08-28 12:46:34 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -265,7 +265,7 @@ sal_Int16 SAL_CALL BreakIteratorImpl::getScriptType( const OUString& Text, sal_I static sal_Int32 SAL_CALL iterateCodePoints(const OUString& Text, sal_Int32 &nStartPos, sal_Int32 inc, sal_uInt32& ch) { if (nStartPos + inc < 0 || nStartPos + inc >= Text.getLength()) { ch = 0; - nStartPos = nStartPos + inc < 0 ? 0 : Text.getLength(); + nStartPos = nStartPos + inc < 0 ? -1 : Text.getLength(); } else { ch = Text.iterateCodePoints(&nStartPos, inc); if (inc > 0) ch = Text.iterateCodePoints(&nStartPos, 0); @@ -273,6 +273,7 @@ static sal_Int32 SAL_CALL iterateCodePoints(const OUString& Text, sal_Int32 &nSt return nStartPos; } + sal_Int32 SAL_CALL BreakIteratorImpl::beginOfScript( const OUString& Text, sal_Int32 nStartPos, sal_Int16 ScriptType ) throw(RuntimeException) { @@ -282,8 +283,11 @@ sal_Int32 SAL_CALL BreakIteratorImpl::beginOfScript( const OUString& Text, if(ScriptType != getScriptClass(Text.iterateCodePoints(&nStartPos, 0))) return -1; + if (nStartPos == 0) return 0; sal_uInt32 ch=0; - while (iterateCodePoints(Text, nStartPos, -1, ch) >= 0 && ScriptType == getScriptClass(ch)) {} + while (iterateCodePoints(Text, nStartPos, -1, ch) >= 0 && ScriptType == getScriptClass(ch)) { + if (nStartPos == 0) return 0; + } return iterateCodePoints(Text, nStartPos, 1, ch); } @@ -324,7 +328,10 @@ sal_Int32 SAL_CALL BreakIteratorImpl::previousScript( const OUString& Text, else if (nStartPos == 0) { if (numberOfChange > 0) numberOfChange--; - Text.iterateCodePoints(&nStartPos, -1); + if (nStartPos > 0) + Text.iterateCodePoints(&nStartPos, -1); + else + return -1; } } return numberOfChange == 0 ? iterateCodePoints(Text, nStartPos, 1, ch) : -1; @@ -416,6 +423,7 @@ sal_Int32 SAL_CALL BreakIteratorImpl::previousCharBlock( const OUString& Text, s } + sal_Int16 SAL_CALL BreakIteratorImpl::getWordType( const OUString& /*Text*/, sal_Int32 /*nPos*/, const Locale& /*rLocale*/ ) throw(RuntimeException) { |