Skip to content

Commit

Permalink
Merge "Fix double closes in ziparchive tests."
Browse files Browse the repository at this point in the history
Former-commit-id: 3a2bd498f8703ca7fcd281da25e027ea00833e1c
  • Loading branch information
jmgao authored and Gerrit Code Review committed Nov 16, 2018
2 parents 9a53a7e + 55275d0 commit 0f727eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libziparchive/zip_archive_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ TEST(ziparchive, EmptyEntries) {
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, kEmptyEntriesZip, sizeof(kEmptyEntriesZip)));

ZipArchiveHandle handle;
ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle));
ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle, false));

ZipEntry entry;
ZipString empty_name;
Expand All @@ -322,7 +322,7 @@ TEST(ziparchive, EntryLargerThan32K) {
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, reinterpret_cast<const uint8_t*>(kAbZip),
sizeof(kAbZip) - 1));
ZipArchiveHandle handle;
ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EntryLargerThan32KTest", &handle));
ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "EntryLargerThan32KTest", &handle, false));

ZipEntry entry;
ZipString ab_name;
Expand Down Expand Up @@ -369,7 +369,7 @@ TEST(ziparchive, TrailerAfterEOCD) {
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, trailer, sizeof(trailer)));

ZipArchiveHandle handle;
ASSERT_GT(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle));
ASSERT_GT(0, OpenArchiveFd(tmp_file.fd, "EmptyEntriesTest", &handle, false));
}

TEST(ziparchive, ExtractToFile) {
Expand Down Expand Up @@ -579,7 +579,7 @@ static void ExtractEntryToMemory(const std::vector<uint8_t>& zip_data,
ASSERT_NE(-1, tmp_file.fd);
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &zip_data[0], zip_data.size()));
ZipArchiveHandle handle;
ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "ExtractEntryToMemory", &handle));
ASSERT_EQ(0, OpenArchiveFd(tmp_file.fd, "ExtractEntryToMemory", &handle, false));

// This function expects a variant of kDataDescriptorZipFile, for look for
// an entry whose name is "name" and whose size is 12 (contents =
Expand Down Expand Up @@ -687,7 +687,7 @@ TEST(ziparchive, BrokenLfhSignature) {
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &kZipFileWithBrokenLfhSignature[0],
kZipFileWithBrokenLfhSignature.size()));
ZipArchiveHandle handle;
ASSERT_EQ(-1, OpenArchiveFd(tmp_file.fd, "LeadingNonZipBytes", &handle));
ASSERT_EQ(-1, OpenArchiveFd(tmp_file.fd, "LeadingNonZipBytes", &handle, false));
}

class VectorReader : public zip_archive::Reader {
Expand Down

0 comments on commit 0f727eb

Please sign in to comment.