From ac6992371cacc017320cc922615162581084b6f6 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Tue, 23 Aug 2011 17:20:22 +0000 Subject: [PATCH] ICU-7365 Promote approved data version API to draft 49 in ICU4C X-SVN-Rev: 30570 --- icu4c/source/common/icudataver.c | 56 +----------------------- icu4c/source/common/unicode/icudataver.h | 28 ++---------- 2 files changed, 4 insertions(+), 80 deletions(-) diff --git a/icu4c/source/common/icudataver.c b/icu4c/source/common/icudataver.c index 51fe9ce9adc..beb5e7356b1 100644 --- a/icu4c/source/common/icudataver.c +++ b/icu4c/source/common/icudataver.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2009, International Business Machines +* Copyright (C) 2009-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -9,31 +9,8 @@ #include "unicode/utypes.h" #include "unicode/icudataver.h" -#include "unicode/uversion.h" #include "unicode/ures.h" #include "uresimp.h" /* for ures_getVersionByKey */ -#include "cmemory.h" - -/* - * Determines if icustd is in the data. - */ -static UBool hasICUSTDBundle(); - -static UBool hasICUSTDBundle() { - UErrorCode status = U_ZERO_ERROR; - UBool result = TRUE; - - UResourceBundle *icustdbundle = ures_openDirect(NULL, U_ICU_STD_BUNDLE, &status); - if (U_SUCCESS(status)) { - result = TRUE; - } else { - result = FALSE; - } - - ures_close(icustdbundle); - - return result; -} U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status) { UResourceBundle *icudatares = NULL; @@ -50,34 +27,3 @@ U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCod ures_close(icudatares); } } - -U_CAPI UBool U_EXPORT2 u_isDataOlder(UVersionInfo dataVersionFillin, UBool *isModifiedFillin, UErrorCode *status) { - UBool result = TRUE; - UVersionInfo dataVersion; - UVersionInfo wiredVersion; - - if (U_FAILURE(*status)) { - return result; - } - - u_getDataVersion(dataVersion, status); - if (U_SUCCESS(*status)) { - u_versionFromString(wiredVersion, U_ICU_DATA_VERSION); - - if (uprv_memcmp(dataVersion, wiredVersion, sizeof(UVersionInfo)) >= 0) { - result = FALSE; - } - - if (dataVersionFillin != NULL) { - uprv_memcpy(dataVersionFillin, dataVersion, sizeof(UVersionInfo)); - } - - if (hasICUSTDBundle()) { - *isModifiedFillin = FALSE; - } else { - *isModifiedFillin = TRUE; - } - } - - return result; -} diff --git a/icu4c/source/common/unicode/icudataver.h b/icu4c/source/common/unicode/icudataver.h index bfaa888f178..b81176299c4 100644 --- a/icu4c/source/common/unicode/icudataver.h +++ b/icu4c/source/common/unicode/icudataver.h @@ -14,44 +14,22 @@ #ifndef U_HIDE_INTERNAL_API /** - * @internal ICU 4.4 + * @draft ICU 49 */ #define U_ICU_VERSION_BUNDLE "icuver" /** - * @internal ICU 4.4 - */ -#define U_ICU_STD_BUNDLE "icustd" - -/** - * @internal ICU 4.4 + * @draft ICU 49 */ #define U_ICU_DATA_KEY "DataVersion" -/** - * This function loads up icuver and compares the data version to the wired-in U_ICU_DATA_VERSION. - * If icuver shows something less than U_ICU_DATA_VERSION it returns TRUE, else FALSE. The version - * found will be returned in the first fillin parameter (if non-null), and *isModified will be set - * to TRUE if "icustd" is NOT found. Thus, if the data has been repackaged or modified, "icustd" - * (standard ICU) will be missing, and the function will alert the caller that the data is not standard. - * - * @param dataVersionFillin icuver data version information to be filled in if not-null - * @param isModifiedFillin if the data is not standard if not-null - * @param status stores the error code from the calls to resource bundle - * - * @return TRUE if U_ICU_DATA_VERSION is newer than icuver, else FALSE - * - * @internal ICU 4.4 - */ -U_INTERNAL UBool U_EXPORT2 u_isDataOlder(UVersionInfo dataVersionFillin, UBool *isModifiedFillin, UErrorCode *status); - /** * Retrieves the data version from icuver and stores it in dataVersionFillin. * * @param dataVersionFillin icuver data version information to be filled in if not-null * @param status stores the error code from the calls to resource bundle * - * @internal ICU 4.4 + * @draft ICU 49 */ U_INTERNAL void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); #endif /* U_HIDE_INTERNAL_API */ -- 2.40.0