X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..51004dcb01e06fef634b61be77ed73dd61cb6db9:/icuSources/i18n/strmatch.cpp diff --git a/icuSources/i18n/strmatch.cpp b/icuSources/i18n/strmatch.cpp index 8286c7ea..7a455759 100644 --- a/icuSources/i18n/strmatch.cpp +++ b/icuSources/i18n/strmatch.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2001-2004, International Business Machines Corporation +* Copyright (c) 2001-2012, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -16,11 +16,10 @@ #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, @@ -66,7 +65,10 @@ UnicodeFunctor* StringMatcher::clone() const { * and return the pointer. */ UnicodeMatcher* StringMatcher::toMatcher() const { - return (UnicodeMatcher*) this; + StringMatcher *nonconst_this = const_cast(this); + UnicodeMatcher *nonconst_base = static_cast(nonconst_this); + + return nonconst_base; } /** @@ -74,7 +76,10 @@ UnicodeMatcher* StringMatcher::toMatcher() const { * and return the pointer. */ UnicodeReplacer* StringMatcher::toReplacer() const { - return (UnicodeReplacer*) this; + StringMatcher *nonconst_this = const_cast(this); + UnicodeReplacer *nonconst_base = static_cast(nonconst_this); + + return nonconst_base; } /** @@ -196,7 +201,7 @@ UBool StringMatcher::matchesIndexValue(uint8_t v) const { */ void StringMatcher::addMatchSetTo(UnicodeSet& toUnionTo) const { UChar32 ch; - for (int32_t i=0; ilookupMatcher(ch); if (matcher == NULL) { @@ -228,7 +233,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 +283,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