]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/strmatch.cpp
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / i18n / strmatch.cpp
index 8286c7eaa0757494d4298c4ad98eb721e76a75f8..466dc4d89706fd81e26b3b99a9d59c2e87d58257 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (c) 2001-2004, International Business Machines Corporation
+*   Copyright (c) 2001-2011, International Business Machines Corporation
 *   and others.  All Rights Reserved.
 **********************************************************************
 *   Date        Name        Description
 #include "rbt_data.h"
 #include "util.h"
 #include "unicode/uniset.h"
+#include "unicode/utf16.h"
 
 U_NAMESPACE_BEGIN
 
-static const UChar EMPTY[] = { 0 }; // empty string: ""
-
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(StringMatcher)
 
 StringMatcher::StringMatcher(const UnicodeString& theString,
@@ -196,7 +195,7 @@ UBool StringMatcher::matchesIndexValue(uint8_t v) const {
  */
 void StringMatcher::addMatchSetTo(UnicodeSet& toUnionTo) const {
     UChar32 ch;
-    for (int32_t i=0; i<pattern.length(); i+=UTF_CHAR_LENGTH(ch)) {
+    for (int32_t i=0; i<pattern.length(); i+=U16_LENGTH(ch)) {
         ch = pattern.char32At(i);
         const UnicodeMatcher* matcher = data->lookupMatcher(ch);
         if (matcher == NULL) {
@@ -228,7 +227,7 @@ int32_t StringMatcher::replace(Replaceable& text,
         }
     }
     
-    text.handleReplaceBetween(start, limit, EMPTY); // delete original text
+    text.handleReplaceBetween(start, limit, UnicodeString()); // delete original text
     
     return outLen;
 }
@@ -278,8 +277,8 @@ void StringMatcher::setData(const TransliterationRuleData* d) {
         if (f != NULL) {
             f->setData(data);
         }
-        i += UTF_CHAR_LENGTH(c);
-    }    
+        i += U16_LENGTH(c);
+    }
 }
 
 U_NAMESPACE_END