]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/csrmbcs.cpp
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / csrmbcs.cpp
index 9c16cc7c4cd5ee24547d334ac80097e0b6545496..3557e0216ffd0e513593be6f81ae53366907102f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  **********************************************************************
- *   Copyright (C) 2005-2012, International Business Machines
+ *   Copyright (C) 2005-2016, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  **********************************************************************
  */
@@ -9,6 +9,7 @@
 
 #if !UCONFIG_NO_CONVERSION
 
+#include "cmemory.h"
 #include "csmatch.h"
 #include "csrmbcs.h"
 
@@ -16,8 +17,6 @@
 
 U_NAMESPACE_BEGIN
 
-#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
-
 #define min(x,y) (((x)<(y))?(x):(y))
 
 static const uint16_t commonChars_sjis [] = {
@@ -343,9 +342,9 @@ UBool CharsetRecog_sjis::nextChar(IteratedChar* it, InputText* det) const {
 
 UBool CharsetRecog_sjis::match(InputText* det, CharsetMatch *results) const {
 #if U_PLATFORM_IS_DARWIN_BASED
-    int32_t confidence = match_mbcs(det, commonChars_sjis, ARRAY_SIZE(commonChars_sjis), keyStrings_sjis);
+    int32_t confidence = match_mbcs(det, commonChars_sjis, UPRV_LENGTHOF(commonChars_sjis), keyStrings_sjis);
 #else
-    int32_t confidence = match_mbcs(det, commonChars_sjis, ARRAY_SIZE(commonChars_sjis));
+    int32_t confidence = match_mbcs(det, commonChars_sjis, UPRV_LENGTHOF(commonChars_sjis));
 #endif
     results->set(det, this, confidence);
     return (confidence > 0);
@@ -448,9 +447,9 @@ const char *CharsetRecog_euc_jp::getLanguage() const
 UBool CharsetRecog_euc_jp::match(InputText *det, CharsetMatch *results) const
 {
 #if U_PLATFORM_IS_DARWIN_BASED
-    int32_t confidence = match_mbcs(det, commonChars_euc_jp, ARRAY_SIZE(commonChars_euc_jp), keyStrings_euc_jp);
+    int32_t confidence = match_mbcs(det, commonChars_euc_jp, UPRV_LENGTHOF(commonChars_euc_jp), keyStrings_euc_jp);
 #else
-    int32_t confidence = match_mbcs(det, commonChars_euc_jp, ARRAY_SIZE(commonChars_euc_jp));
+    int32_t confidence = match_mbcs(det, commonChars_euc_jp, UPRV_LENGTHOF(commonChars_euc_jp));
 #endif
     results->set(det, this, confidence);
     return (confidence > 0);
@@ -474,9 +473,9 @@ const char *CharsetRecog_euc_kr::getLanguage() const
 UBool CharsetRecog_euc_kr::match(InputText *det, CharsetMatch *results) const
 {
 #if U_PLATFORM_IS_DARWIN_BASED
-    int32_t confidence =  match_mbcs(det, commonChars_euc_kr, ARRAY_SIZE(commonChars_euc_kr), keyStrings_euc_kr);
+    int32_t confidence =  match_mbcs(det, commonChars_euc_kr, UPRV_LENGTHOF(commonChars_euc_kr), keyStrings_euc_kr);
 #else
-    int32_t confidence =  match_mbcs(det, commonChars_euc_kr, ARRAY_SIZE(commonChars_euc_kr));
+    int32_t confidence =  match_mbcs(det, commonChars_euc_kr, UPRV_LENGTHOF(commonChars_euc_kr));
 #endif
     results->set(det, this, confidence);
     return (confidence > 0);
@@ -530,9 +529,9 @@ const char *CharsetRecog_big5::getLanguage() const
 UBool CharsetRecog_big5::match(InputText *det, CharsetMatch *results) const
 {
 #if U_PLATFORM_IS_DARWIN_BASED
-    int32_t confidence = match_mbcs(det, commonChars_big5, ARRAY_SIZE(commonChars_big5), keyStrings_big5);
+    int32_t confidence = match_mbcs(det, commonChars_big5, UPRV_LENGTHOF(commonChars_big5), keyStrings_big5);
 #else
-    int32_t confidence = match_mbcs(det, commonChars_big5, ARRAY_SIZE(commonChars_big5));
+    int32_t confidence = match_mbcs(det, commonChars_big5, UPRV_LENGTHOF(commonChars_big5));
 #endif
     results->set(det, this, confidence);
     return (confidence > 0);
@@ -610,9 +609,9 @@ const char *CharsetRecog_gb_18030::getLanguage() const
 UBool CharsetRecog_gb_18030::match(InputText *det, CharsetMatch *results) const
 {
 #if U_PLATFORM_IS_DARWIN_BASED
-    int32_t confidence = match_mbcs(det, commonChars_gb_18030, ARRAY_SIZE(commonChars_gb_18030), keyStrings_gb_18030);
+    int32_t confidence = match_mbcs(det, commonChars_gb_18030, UPRV_LENGTHOF(commonChars_gb_18030), keyStrings_gb_18030);
 #else
-    int32_t confidence = match_mbcs(det, commonChars_gb_18030, ARRAY_SIZE(commonChars_gb_18030));
+    int32_t confidence = match_mbcs(det, commonChars_gb_18030, UPRV_LENGTHOF(commonChars_gb_18030));
 #endif
     results->set(det, this, confidence);
     return (confidence > 0);