summaryrefslogtreecommitdiff
path: root/google
diff options
context:
space:
mode:
Diffstat (limited to 'google')
-rw-r--r--google/zip_internal.cc13
-rw-r--r--google/zip_reader_unittest.cc6
2 files changed, 10 insertions, 9 deletions
diff --git a/google/zip_internal.cc b/google/zip_internal.cc
index b9976d6..9b20b42 100644
--- a/google/zip_internal.cc
+++ b/google/zip_internal.cc
@@ -260,13 +260,12 @@ zip_fileinfo TimeToZipFileInfo(const base::Time& file_time) {
// It assumes that dates below 1980 are in the double digit format.
// Hence the fail safe option is to leave the date unset. Some programs
// might show the unset date as 1980-0-0 which is invalid.
- zip_info.tmz_date = {
- .tm_sec = static_cast<uInt>(file_time_parts.second),
- .tm_min = static_cast<uInt>(file_time_parts.minute),
- .tm_hour = static_cast<uInt>(file_time_parts.hour),
- .tm_mday = static_cast<uInt>(file_time_parts.day_of_month),
- .tm_mon = static_cast<uInt>(file_time_parts.month - 1),
- .tm_year = static_cast<uInt>(file_time_parts.year)};
+ zip_info.tmz_date.tm_year = file_time_parts.year;
+ zip_info.tmz_date.tm_mon = file_time_parts.month - 1;
+ zip_info.tmz_date.tm_mday = file_time_parts.day_of_month;
+ zip_info.tmz_date.tm_hour = file_time_parts.hour;
+ zip_info.tmz_date.tm_min = file_time_parts.minute;
+ zip_info.tmz_date.tm_sec = file_time_parts.second;
}
return zip_info;
diff --git a/google/zip_reader_unittest.cc b/google/zip_reader_unittest.cc
index 8ef0274..e6f89d7 100644
--- a/google/zip_reader_unittest.cc
+++ b/google/zip_reader_unittest.cc
@@ -234,8 +234,10 @@ TEST_F(ZipReaderTest, Open_ExistentButNonZipFile) {
TEST_F(ZipReaderTest, Open_EmptyFile) {
ZipReader reader;
EXPECT_FALSE(reader.ok());
- EXPECT_FALSE(reader.Open(data_dir_.AppendASCII("empty.zip")));
- EXPECT_FALSE(reader.ok());
+ EXPECT_TRUE(reader.Open(data_dir_.AppendASCII("empty.zip")));
+ EXPECT_TRUE(reader.ok());
+ EXPECT_EQ(0, reader.num_entries());
+ EXPECT_EQ(nullptr, reader.Next());
}
// Iterate through the contents in the test ZIP archive, and compare that the