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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « icu46/source/common/icucfg.h.in ('k') | icu46/source/common/icuplug.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 2009, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 */
9
10 #include "unicode/utypes.h"
11 #include "unicode/icudataver.h"
12 #include "unicode/uversion.h"
13 #include "unicode/ures.h"
14 #include "uresimp.h" /* for ures_getVersionByKey */
15 #include "cmemory.h"
16
17 /*
18 * Determines if icustd is in the data.
19 */
20 static UBool hasICUSTDBundle();
21
22 static UBool hasICUSTDBundle() {
23 UErrorCode status = U_ZERO_ERROR;
24 UBool result = TRUE;
25
26 UResourceBundle *icustdbundle = ures_openDirect(NULL, U_ICU_STD_BUNDLE, &sta tus);
27 if (U_SUCCESS(status)) {
28 result = TRUE;
29 } else {
30 result = FALSE;
31 }
32
33 ures_close(icustdbundle);
34
35 return result;
36 }
37
38 U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCod e *status) {
39 UResourceBundle *icudatares = NULL;
40
41 if (U_FAILURE(*status)) {
42 return;
43 }
44
45 if (dataVersionFillin != NULL) {
46 icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
47 if (U_SUCCESS(*status)) {
48 ures_getVersionByKey(icudatares, U_ICU_DATA_KEY, dataVersionFillin, status);
49 }
50 ures_close(icudatares);
51 }
52 }
53
54 U_CAPI UBool U_EXPORT2 u_isDataOlder(UVersionInfo dataVersionFillin, UBool *isMo difiedFillin, UErrorCode *status) {
55 UBool result = TRUE;
56 UVersionInfo dataVersion;
57 UVersionInfo wiredVersion;
58
59 if (U_FAILURE(*status)) {
60 return result;
61 }
62
63 u_getDataVersion(dataVersion, status);
64 if (U_SUCCESS(*status)) {
65 u_versionFromString(wiredVersion, U_ICU_DATA_VERSION);
66
67 if (uprv_memcmp(dataVersion, wiredVersion, sizeof(UVersionInfo)) >= 0) {
68 result = FALSE;
69 }
70
71 if (dataVersionFillin != NULL) {
72 uprv_memcpy(dataVersionFillin, dataVersion, sizeof(UVersionInfo));
73 }
74
75 if (hasICUSTDBundle()) {
76 *isModifiedFillin = FALSE;
77 } else {
78 *isModifiedFillin = TRUE;
79 }
80 }
81
82 return result;
83 }
OLDNEW
« 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