X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/57a6839dcb3bba09e8228b822b290604668416fe..refs/heads/master:/icuSources/i18n/csdetect.cpp?ds=inline diff --git a/icuSources/i18n/csdetect.cpp b/icuSources/i18n/csdetect.cpp index 3efbd492..babb3084 100644 --- a/icuSources/i18n/csdetect.cpp +++ b/icuSources/i18n/csdetect.cpp @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** - * Copyright (C) 2005-2013, International Business Machines + * Copyright (C) 2005-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ @@ -27,8 +29,6 @@ #include "csrucode.h" #include "csr2022.h" -#define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) - #define NEW_ARRAY(type,count) (type *) uprv_malloc((count) * sizeof(type)) #define DELETE_ARRAY(array) uprv_free((void *) (array)) @@ -36,9 +36,9 @@ U_NAMESPACE_BEGIN struct CSRecognizerInfo : public UMemory { CSRecognizerInfo(CharsetRecognizer *recognizer, UBool isDefaultEnabled) - : recognizer(recognizer), isDefaultEnabled(isDefaultEnabled) {}; + : recognizer(recognizer), isDefaultEnabled(isDefaultEnabled) {} - ~CSRecognizerInfo() {delete recognizer;}; + ~CSRecognizerInfo() {delete recognizer;} CharsetRecognizer *recognizer; UBool isDefaultEnabled; @@ -47,7 +47,7 @@ struct CSRecognizerInfo : public UMemory { U_NAMESPACE_END static icu::CSRecognizerInfo **fCSRecognizers = NULL; -static icu::UInitOnce gCSRecognizersInitOnce; +static icu::UInitOnce gCSRecognizersInitOnce = U_INITONCE_INITIALIZER; static int32_t fCSRecognizers_size = 0; U_CDECL_BEGIN @@ -110,6 +110,7 @@ static void U_CALLCONV initRecognizers(UErrorCode &status) { new CSRecognizerInfo(new CharsetRecog_big5(), TRUE), new CSRecognizerInfo(new CharsetRecog_2022JP(), TRUE), +#if !UCONFIG_ONLY_HTML_CONVERSION new CSRecognizerInfo(new CharsetRecog_2022KR(), TRUE), new CSRecognizerInfo(new CharsetRecog_2022CN(), TRUE), @@ -117,8 +118,9 @@ static void U_CALLCONV initRecognizers(UErrorCode &status) { new CSRecognizerInfo(new CharsetRecog_IBM424_he_ltr(), FALSE), new CSRecognizerInfo(new CharsetRecog_IBM420_ar_rtl(), FALSE), new CSRecognizerInfo(new CharsetRecog_IBM420_ar_ltr(), FALSE) +#endif }; - int32_t rCount = ARRAY_SIZE(tempArray); + int32_t rCount = UPRV_LENGTHOF(tempArray); fCSRecognizers = NEW_ARRAY(CSRecognizerInfo *, rCount);