X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/51004dcb01e06fef634b61be77ed73dd61cb6db9..2ca993e82fb37b597a3c73ecd1586a139a6579c5:/icuSources/i18n/csr2022.cpp diff --git a/icuSources/i18n/csr2022.cpp b/icuSources/i18n/csr2022.cpp index 3db0bc9f..dd34a4db 100644 --- a/icuSources/i18n/csr2022.cpp +++ b/icuSources/i18n/csr2022.cpp @@ -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 "cstring.h" #include "csr2022.h" @@ -16,8 +17,6 @@ U_NAMESPACE_BEGIN -#define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) - /** * Matching function shared among the 2022 detectors JP, CN and KR * Counts up the number of legal and unrecognized escape sequences in @@ -119,6 +118,7 @@ static const uint8_t escapeSequences_2022JP[][5] = { {0x1b, 0x2e, 0x46, 0x00, 0x00} // ISO 8859-7 }; +#if !UCONFIG_ONLY_HTML_CONVERSION static const uint8_t escapeSequences_2022KR[][5] = { {0x1b, 0x24, 0x29, 0x43, 0x00} }; @@ -136,6 +136,7 @@ static const uint8_t escapeSequences_2022CN[][5] = { {0x1b, 0x4e, 0x00, 0x00, 0x00}, // SS2 {0x1b, 0x4f, 0x00, 0x00, 0x00}, // SS3 }; +#endif CharsetRecog_2022JP::~CharsetRecog_2022JP() {} @@ -147,11 +148,12 @@ UBool CharsetRecog_2022JP::match(InputText *textIn, CharsetMatch *results) const int32_t confidence = match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022JP, - ARRAY_SIZE(escapeSequences_2022JP)); + UPRV_LENGTHOF(escapeSequences_2022JP)); results->set(textIn, this, confidence); return (confidence > 0); } +#if !UCONFIG_ONLY_HTML_CONVERSION CharsetRecog_2022KR::~CharsetRecog_2022KR() {} const char *CharsetRecog_2022KR::getName() const { @@ -162,7 +164,7 @@ UBool CharsetRecog_2022KR::match(InputText *textIn, CharsetMatch *results) const int32_t confidence = match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022KR, - ARRAY_SIZE(escapeSequences_2022KR)); + UPRV_LENGTHOF(escapeSequences_2022KR)); results->set(textIn, this, confidence); return (confidence > 0); } @@ -177,10 +179,11 @@ UBool CharsetRecog_2022CN::match(InputText *textIn, CharsetMatch *results) const int32_t confidence = match_2022(textIn->fInputBytes, textIn->fInputLen, escapeSequences_2022CN, - ARRAY_SIZE(escapeSequences_2022CN)); + UPRV_LENGTHOF(escapeSequences_2022CN)); results->set(textIn, this, confidence); return (confidence > 0); } +#endif CharsetRecog_2022::~CharsetRecog_2022() { // nothing to do