diff options
| author | Narayan Kamath <narayan@google.com> | 2015-10-30 10:03:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-10-30 10:03:28 +0000 |
| commit | b57cd14596ea26d8808b5f193769b0727f5e15e3 (patch) | |
| tree | 45be7afab50baea1b87aebe5c1440ada62ec0c5e | |
| parent | bb51fbc4d4b311ae315e4d7dd174167ebeadc2a8 (diff) | |
| parent | 0e99a2f79ae3831d8bb749e470b3d3217083b015 (diff) | |
Merge "libziparchive: fix calculation of mod_time."
| -rw-r--r-- | libziparchive/zip_archive.cc | 2 | ||||
| -rw-r--r-- | libziparchive/zip_archive_test.cc | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc index f1e13a7bc2..3d18f7c679 100644 --- a/libziparchive/zip_archive.cc +++ b/libziparchive/zip_archive.cc @@ -588,7 +588,7 @@ static int32_t FindEntry(const ZipArchive* archive, const int ent, // and other interesting attributes from the central directory. These // will later be compared against values from the local file header. data->method = cdr->compression_method; - data->mod_time = cdr->last_mod_time; + data->mod_time = cdr->last_mod_date << 16 | cdr->last_mod_time; data->crc32 = cdr->crc32; data->compressed_length = cdr->compressed_size; data->uncompressed_length = cdr->uncompressed_size; diff --git a/libziparchive/zip_archive_test.cc b/libziparchive/zip_archive_test.cc index 9a3cdb434b..32b1a38b13 100644 --- a/libziparchive/zip_archive_test.cc +++ b/libziparchive/zip_archive_test.cc @@ -272,6 +272,7 @@ TEST(ziparchive, FindEntry) { ASSERT_EQ(static_cast<uint32_t>(17), data.uncompressed_length); ASSERT_EQ(static_cast<uint32_t>(13), data.compressed_length); ASSERT_EQ(0x950821c5, data.crc32); + ASSERT_EQ(static_cast<uint32_t>(0x438a8005), data.mod_time); // An entry that doesn't exist. Should be a negative return code. ZipString absent_name; |
