summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-10-22 15:08:38 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-22 15:08:38 -0700
commit008744cedaa7e3be533bbedb51dd986c6dfea987 (patch)
treeed3f372cfb1e3af8765d607123aee098bddda64d /libc
parent417834b17ee00a6b1cd4e816f632c3596f3f51c3 (diff)
parentdf92635a57e8093d9cbffc38bbf513f3361ee91e (diff)
downloadbionic-008744cedaa7e3be533bbedb51dd986c6dfea987.zip
bionic-008744cedaa7e3be533bbedb51dd986c6dfea987.tar.gz
bionic-008744cedaa7e3be533bbedb51dd986c6dfea987.tar.bz2
am df92635a: Merge "Support zone.tab in bionic, and remove the file format version."
* commit 'df92635a57e8093d9cbffc38bbf513f3361ee91e': Support zone.tab in bionic, and remove the file format version.
Diffstat (limited to 'libc')
-rw-r--r--libc/tools/zoneinfo/ZoneCompactor.java30
-rwxr-xr-xlibc/tools/zoneinfo/generate3
-rw-r--r--libc/tzcode/localtime.c9
-rw-r--r--libc/zoneinfo/tzdatabin522162 -> 541098 bytes
4 files changed, 21 insertions, 21 deletions
diff --git a/libc/tools/zoneinfo/ZoneCompactor.java b/libc/tools/zoneinfo/ZoneCompactor.java
index 6ce24cf..8a1a628 100644
--- a/libc/tools/zoneinfo/ZoneCompactor.java
+++ b/libc/tools/zoneinfo/ZoneCompactor.java
@@ -107,7 +107,7 @@ public class ZoneCompactor {
return ret;
}
- public ZoneCompactor(String setupFile, String dataDirectory, String outputDirectory, String version) throws Exception {
+ public ZoneCompactor(String setupFile, String dataDirectory, String zoneTabFile, String outputDirectory, String version) throws Exception {
// Read the setup file, and concatenate all the data.
ByteArrayOutputStream allData = new ByteArrayOutputStream();
BufferedReader reader = new BufferedReader(new FileReader(setupFile));
@@ -138,6 +138,7 @@ public class ZoneCompactor {
}
}
}
+ reader.close();
// Fill in fields for links.
Iterator<String> it = links.keySet().iterator();
@@ -156,18 +157,14 @@ public class ZoneCompactor {
// Write the header.
- // byte[12] tzdata_version -- 'tzdata2012f\0'
- // int file_format_version -- probably won't need this, but just in case
- // int index_offset -- likewise
+ // byte[12] tzdata_version -- 'tzdata2012f\0'
+ // int index_offset -- so we can slip in extra header fields in a backwards-compatible way
// int data_offset
// int zonetab_offset
// tzdata_version
f.write(toAscii(new byte[12], version));
- // file_format_version
- f.writeInt(1);
-
// Write dummy values for the three offsets, and remember where we need to seek back to later
// when we have the real values.
int index_offset_offset = (int) f.getFilePointer();
@@ -201,8 +198,17 @@ public class ZoneCompactor {
// Write the data.
f.write(allData.toByteArray());
- // TODO: append the zonetab.
- int zonetab_offset = 0;
+ // Copy the zone.tab.
+ reader = new BufferedReader(new FileReader(zoneTabFile));
+ while ((s = reader.readLine()) != null) {
+ if (!s.startsWith("#")) {
+ f.writeBytes(s);
+ f.write('\n');
+ }
+ }
+ reader.close();
+
+ int zonetab_offset = (int) f.getFilePointer();
// Go back and fix up the offsets in the header.
f.seek(index_offset_offset);
@@ -226,10 +232,10 @@ public class ZoneCompactor {
}
public static void main(String[] args) throws Exception {
- if (args.length != 4) {
- System.err.println("usage: java ZoneCompactor <setup file> <data directory> <output directory> <tzdata version>");
+ if (args.length != 5) {
+ System.err.println("usage: java ZoneCompactor <setup file> <data directory> <zone.tab file> <output directory> <tzdata version>");
System.exit(0);
}
- new ZoneCompactor(args[0], args[1], args[2], args[3]);
+ new ZoneCompactor(args[0], args[1], args[2], args[3], args[4]);
}
}
diff --git a/libc/tools/zoneinfo/generate b/libc/tools/zoneinfo/generate
index e9ff59b..27d023f 100755
--- a/libc/tools/zoneinfo/generate
+++ b/libc/tools/zoneinfo/generate
@@ -89,7 +89,8 @@ def UpgradeTo(ftp, filename):
'%s/libcore/util/ZoneInfo.java' % libcore_src_dir,
'%s/libcore/io/BufferIterator.java' % libcore_src_dir])
subprocess.check_call(['java', 'ZoneCompactor',
- 'setup', 'data', bionic_libc_zoneinfo_dir, new_version])
+ 'setup', 'data', 'extracted/zone.tab',
+ bionic_libc_zoneinfo_dir, new_version])
# Run with no arguments from any directory, with no special setup required.
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index f5718b9..fcaf48b 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -2200,13 +2200,11 @@ static int __bionic_open_tzdata_path(const char* path, const char* olson_id, int
}
// byte[12] tzdata_version -- "tzdata2012f\0"
- // int file_format_version -- 1
// int index_offset
// int data_offset
// int zonetab_offset
struct bionic_tzdata_header {
char tzdata_version[12];
- int32_t file_format_version;
int32_t index_offset;
int32_t data_offset;
int32_t zonetab_offset;
@@ -2222,14 +2220,9 @@ static int __bionic_open_tzdata_path(const char* path, const char* olson_id, int
close(fd);
return -1;
}
- if (ntohl(header.file_format_version) != 1) {
- fprintf(stderr, "%s: bad file format version: %d\n", __FUNCTION__, header.file_format_version);
- close(fd);
- return -1;
- }
#if 0
- fprintf(stderr, "version: %s (%d)\n", header.tzdata_version, ntohl(header.file_format_version));
+ fprintf(stderr, "version: %s\n", header.tzdata_version);
fprintf(stderr, "index_offset = %d\n", ntohl(header.index_offset));
fprintf(stderr, "data_offset = %d\n", ntohl(header.data_offset));
fprintf(stderr, "zonetab_offset = %d\n", ntohl(header.zonetab_offset));
diff --git a/libc/zoneinfo/tzdata b/libc/zoneinfo/tzdata
index f5fefe2..a1c77d6 100644
--- a/libc/zoneinfo/tzdata
+++ b/libc/zoneinfo/tzdata
Binary files differ