Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: icu46/source/common/icudataver.c

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « icu46/source/common/icucfg.h.in ('k') | icu46/source/common/icuplug.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: icu46/source/common/icudataver.c
===================================================================
--- icu46/source/common/icudataver.c (revision 0)
+++ icu46/source/common/icudataver.c (revision 0)
@@ -0,0 +1,83 @@
+/*
+******************************************************************************
+*
+* Copyright (C) 2009, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+******************************************************************************
+*/
+
+#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;
+
+ if (U_FAILURE(*status)) {
+ return;
+ }
+
+ if (dataVersionFillin != NULL) {
+ icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
+ if (U_SUCCESS(*status)) {
+ ures_getVersionByKey(icudatares, U_ICU_DATA_KEY, dataVersionFillin, status);
+ }
+ 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;
+}
Property changes on: icu46/source/common/icudataver.c
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « icu46/source/common/icucfg.h.in ('k') | icu46/source/common/icuplug.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698