]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/identifier_info.cpp
ICU-551.24.tar.gz
[apple/icu.git] / icuSources / i18n / identifier_info.cpp
index 87ddda1a793262736fb84670f1ff9a4e9533aa25..0c0706f1ccdb1273f1ce84ea182b77e8444e065b 100644 (file)
@@ -18,8 +18,6 @@
 
 U_NAMESPACE_BEGIN
 
-#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
-
 static UnicodeSet *ASCII;
 static ScriptSet *JAPANESE;
 static ScriptSet *CHINESE;
@@ -137,7 +135,7 @@ IdentifierInfo &IdentifierInfo::setIdentifier(const UnicodeString &identifier, U
             fNumerics->add(cp - (UChar32)u_getNumericValue(cp));
         }
         UScriptCode extensions[500];
-        int32_t extensionsCount = uscript_getScriptExtensions(cp, extensions, LENGTHOF(extensions), &status);
+        int32_t extensionsCount = uscript_getScriptExtensions(cp, extensions, UPRV_LENGTHOF(extensions), &status);
         if (U_FAILURE(status)) {
             return *this;
         }
@@ -169,7 +167,7 @@ IdentifierInfo &IdentifierInfo::setIdentifier(const UnicodeString &identifier, U
     // We also compute any commonalities among the alternates.
     if (uhash_count(fScriptSetSet) > 0) {
         fCommonAmongAlternates->setAll();
-        for (int32_t it = -1;;) {
+        for (int32_t it = UHASH_FIRST;;) {
             const UHashElement *nextHashEl = uhash_nextElement(fScriptSetSet, &it);
             if (nextHashEl == NULL) {
                 break;
@@ -181,7 +179,7 @@ IdentifierInfo &IdentifierInfo::setIdentifier(const UnicodeString &identifier, U
             } else {
                 fCommonAmongAlternates->intersect(*next);
                 // [[Arab Syrc Thaa]; [Arab Syrc]] => [[Arab Syrc]]
-                for (int32_t otherIt = -1;;) {
+                for (int32_t otherIt = UHASH_FIRST;;) {
                     const UHashElement *otherHashEl = uhash_nextElement(fScriptSetSet, &otherIt);
                     if (otherHashEl == NULL) {
                         break;
@@ -271,7 +269,7 @@ UBool IdentifierInfo::containsWithAlternates(const ScriptSet &container, const S
     if (!container.contains(containee)) {
         return FALSE;
     }
-    for (int32_t iter = -1; ;) {
+    for (int32_t iter = UHASH_FIRST; ;) {
         const UHashElement *hashEl = uhash_nextElement(fScriptSetSet, &iter);
         if (hashEl == NULL) {
             break;
@@ -289,7 +287,7 @@ UnicodeString &IdentifierInfo::displayAlternates(UnicodeString &dest, const UHas
     if (U_FAILURE(status)) {
         return dest;
     }
-    for (int32_t pos = -1; ;) {
+    for (int32_t pos = UHASH_FIRST; ;) {
         const UHashElement *el = uhash_nextElement(alternates, &pos);
         if (el == NULL) {
             break;