Move off the Next ZipString overload.
Bug: http://b/129068177
Test: treehugger
Change-Id: I83840c2ffd6cdede8cb34b4ec168427a43e1daf7
diff --git a/tests/libs/bionic_tests_zipalign.cpp b/tests/libs/bionic_tests_zipalign.cpp
index ec500d4..adb731f 100644
--- a/tests/libs/bionic_tests_zipalign.cpp
+++ b/tests/libs/bionic_tests_zipalign.cpp
@@ -37,7 +37,7 @@
fprintf(stderr, " The output zip file that will be created from the input file.\n");
}
-using ZipData = std::pair<std::unique_ptr<ZipEntry>, std::unique_ptr<ZipString>>;
+using ZipData = std::pair<std::unique_ptr<ZipEntry>, std::string>;
static bool GetEntries(ZipArchiveHandle handle, std::vector<ZipData>* entries) {
void* cookie;
@@ -48,10 +48,9 @@
}
ZipEntry entry;
- ZipString name;
+ std::string name;
while ((return_value = Next(cookie, &entry, &name)) == 0) {
- entries->emplace_back(std::make_pair(std::make_unique<ZipEntry>(entry),
- std::make_unique<ZipString>(name)));
+ entries->emplace_back(std::make_pair(std::make_unique<ZipEntry>(entry), name));
}
if (return_value != -1) {
fprintf(stderr, "Error while iterating over zip entries: %s\n", ErrorCodeString(return_value));
@@ -78,13 +77,12 @@
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<const char*>(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));