[Libreoffice-commits] core.git: svl/source

Eike Rathke erack at redhat.com
Fri May 16 19:11:06 PDT 2014


 svl/source/numbers/zforfind.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 3885b5d4b00ebb31adabc36c507abd642c03d0d4
Author: Eike Rathke <erack at redhat.com>
Date:   Sat May 17 04:05:20 2014 +0200

    resolved fdo#41166 match month and day name word instead of substring
    
    Follow-up, check for ASCII first to avoid calls to i18n, and check the
    type flags instead of calls to CharClass methods that give unexpected
    results with their masks.
    
    Change-Id: I10e685998299dceb2dbcf1d87ae1de09680b8a99

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 0cf62fd..0e10138 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -458,18 +458,23 @@ bool ImpSvNumberInputScan::StringContainsWord( const OUString& rWhat,
          * how many languages do not separate the day and month names in some
          * form? */
 
+        // Check simple ASCII first before invoking i18n or anything else.
+        if (rtl::isAsciiAlphanumeric( rString[nPos] ))
+            return false;   // Alpha or numeric is not word gap.
+
         sal_Int32 nIndex = nPos;
-        sal_uInt32 c = rString.iterateCodePoints( &nIndex);
+        const sal_uInt32 c = rString.iterateCodePoints( &nIndex);
         if (nPos+1 < nIndex)
             return true;    // Surrogate, assume these to be new words.
         (void)c;
 
         const sal_Int32 nType = pFormatter->GetCharClass()->getCharacterType( rString, nPos);
+        using namespace ::com::sun::star::i18n;
 
-        if (CharClass::isAlphaNumericType( nType))
+        if ((nType & (KCharacterType::UPPER | KCharacterType::LOWER | KCharacterType::DIGIT)) != 0)
             return false;   // Alpha or numeric is not word gap.
 
-        if (CharClass::isLetterType( nType))
+        if ((nType & (KCharacterType::LETTER)) != 0)
             return true;    // Letter other than alpha is new word. (Is it?)
 
         return true;        // Catch all remaining as gap until we know better.


More information about the Libreoffice-commits mailing list