From 127a706581035b934c2a3a6b173693aca2cca58b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 22 May 2019 18:50:53 -0700 Subject: [PATCH] Move off the Next ZipString overload. Bug: http://b/129068177 Test: treehugger Change-Id: I83840c2ffd6cdede8cb34b4ec168427a43e1daf7 --- tests/libs/bionic_tests_zipalign.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/libs/bionic_tests_zipalign.cpp b/tests/libs/bionic_tests_zipalign.cpp index ec500d479..adb731f74 100644 --- a/tests/libs/bionic_tests_zipalign.cpp +++ b/tests/libs/bionic_tests_zipalign.cpp @@ -37,7 +37,7 @@ static void usage() { fprintf(stderr, " The output zip file that will be created from the input file.\n"); } -using ZipData = std::pair, std::unique_ptr>; +using ZipData = std::pair, std::string>; static bool GetEntries(ZipArchiveHandle handle, std::vector* entries) { void* cookie; @@ -48,10 +48,9 @@ static bool GetEntries(ZipArchiveHandle handle, std::vector* entries) { } ZipEntry entry; - ZipString name; + std::string name; while ((return_value = Next(cookie, &entry, &name)) == 0) { - entries->emplace_back(std::make_pair(std::make_unique(entry), - std::make_unique(name))); + entries->emplace_back(std::make_pair(std::make_unique(entry), name)); } if (return_value != -1) { fprintf(stderr, "Error while iterating over zip entries: %s\n", ErrorCodeString(return_value)); @@ -78,13 +77,12 @@ static bool CreateAlignedZip(ZipArchiveHandle& handle, FILE* zip_dst, uint32_t a int32_t error; for (auto& entry : entries) { ZipEntry* zip_entry = entry.first.get(); - ZipString* zip_str = entry.second.get(); + std::string& zip_name = entry.second; size_t flags = 0; if ((zip_entry->method & kCompressDeflated) != 0) { flags |= ZipWriter::kCompress; } - std::string zip_name(reinterpret_cast(zip_str->name), zip_str->name_length); error = writer.StartAlignedEntry(zip_name.c_str(), flags, alignment); if (error != 0) { fprintf(stderr, "StartAlignedEntry failed: %s\n", ZipWriter::ErrorCodeString(error));