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

Side by Side Diff: third_party/icu/patches/linuxtz3.patch

Issue 3598015: Fix the default timezone detection in ICU.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months 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 | « third_party/icu/README.chromium ('k') | third_party/icu/source/common/putil.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 Index: source/common/putil.c
2 ===================================================================
3 --- source/common/putil.c (revision 60495)
4 +++ source/common/putil.c (working copy)
5 @@ -661,6 +661,26 @@
6 || uprv_strcmp(id, "CST6CDT") == 0
7 || uprv_strcmp(id, "EST5EDT") == 0);
8 }
9 +
10 +/* On some Unix-like OS, 'posix' subdirectory in
11 + /usr/share/zoneinfo replicates the top-level contents. 'right'
12 + subdirectory has the same set of files, but individual files
13 + are different from those in the top-level directory or 'posix'
14 + because 'right' has files for TAI (Int'l Atomic Time) while 'posix'
15 + has files for UTC.
16 + When the first match for /etc/localtime is in either of them
17 + (usually in posix because 'right' has different file contents),
18 + or TZ environment variable points to one of them, createTimeZone
19 + fails because, say, 'posix/America/New_York' is not an Olson
20 + timezone id ('America/New_York' is). So, we have to remove
21 + 'posix/' and 'right/' at the beginning. */
22 +static void removeZoneIDPrefix(const char** id) {
Evan Martin 2010/10/08 22:00:14 "skip" might be a better verb than "remove", as th
23 + if (uprv_strncmp(*id, "posix/", 6) == 0
24 + || uprv_strncmp(*id, "right/", 6) == 0)
25 + {
26 + *id += 6;
27 + }
28 +}
29 #endif
30
31 #if defined(U_TZNAME) && !defined(U_WINDOWS)
32 @@ -869,11 +889,12 @@
33
34 /* Check each entry in the directory. */
35 while((dirEntry = readdir(dirp)) != NULL) {
36 - if (uprv_strcmp(dirEntry->d_name, SKIP1) != 0 && uprv_strcmp(dirEntry-> d_name, SKIP2) != 0) {
37 + const char* dirName = dirEntry->d_name;
38 + if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0) {
39 /* Create a newpath with the new entry to test each entry in the di rectory. */
40 char newpath[MAX_PATH_SIZE];
41 uprv_strcpy(newpath, curpath);
42 - uprv_strcat(newpath, dirEntry->d_name);
43 + uprv_strcat(newpath, dirName);
44
45 if ((subDirp = opendir(newpath)) != NULL) {
46 /* If this new path is a directory, make a recursive call with the newpath. */
47 @@ -890,9 +911,11 @@
48 */
49 if (result != NULL)
50 break;
51 - } else if (uprv_strcmp(TZFILE_SKIP, dirEntry->d_name) != 0 && uprv_ strcmp(TZFILE_SKIP2, dirEntry->d_name) != 0) {
52 + } else if (uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZ FILE_SKIP2, dirName) != 0) {
53 if(compareBinaryFiles(TZDEFAULT, newpath, tzInfo)) {
54 - uprv_strcpy(SEARCH_TZFILE_RESULT, newpath + (sizeof(TZZONEI NFO) - 1));
55 + const char* zoneid = newpath + (sizeof(TZZONEINFO)) - 1;
56 + removeZoneIDPrefix(&zoneid);
57 + uprv_strcpy(SEARCH_TZFILE_RESULT, zoneid);
58 result = SEARCH_TZFILE_RESULT;
59 /* Get out after the first one found. */
60 break;
61 @@ -931,12 +954,7 @@
62 if (tzid != NULL && isValidOlsonID(tzid))
63 {
64 /* This might be a good Olson ID. */
65 - if (uprv_strncmp(tzid, "posix/", 6) == 0
66 - || uprv_strncmp(tzid, "right/", 6) == 0)
67 - {
68 - /* Remove the posix/ or right/ prefix. */
69 - tzid += 6;
70 - }
71 + removeZoneIDPrefix(&tzid);
72 return tzid;
73 }
74 /* else U_TZNAME will give a better result. */
OLDNEW
« no previous file with comments | « third_party/icu/README.chromium ('k') | third_party/icu/source/common/putil.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698