Move off the Next ZipString overload.
Bug: http://b/129068177 Test: treehugger Change-Id: I3c8f70b0d8cc5dc6b3b4439dbe0b9a5bd85003c4
This commit is contained in:
parent
d31fb2e7fc
commit
88d8001e75
3 changed files with 7 additions and 9 deletions
|
@ -683,12 +683,11 @@ bool ZipModeImage::InitializeChunks(const std::string& filename, ZipArchiveHandl
|
||||||
|
|
||||||
// Create a list of deflated zip entries, sorted by offset.
|
// Create a list of deflated zip entries, sorted by offset.
|
||||||
std::vector<std::pair<std::string, ZipEntry>> temp_entries;
|
std::vector<std::pair<std::string, ZipEntry>> temp_entries;
|
||||||
ZipString name;
|
std::string name;
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
while ((ret = Next(cookie, &entry, &name)) == 0) {
|
while ((ret = Next(cookie, &entry, &name)) == 0) {
|
||||||
if (entry.method == kCompressDeflated || limit_ > 0) {
|
if (entry.method == kCompressDeflated || limit_ > 0) {
|
||||||
std::string entry_name(name.name, name.name + name.name_length);
|
temp_entries.emplace_back(name, entry);
|
||||||
temp_entries.emplace_back(entry_name, entry);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -539,13 +539,13 @@ bool verify_package_compatibility(ZipArchiveHandle package_zip) {
|
||||||
|
|
||||||
std::vector<std::string> compatibility_info;
|
std::vector<std::string> compatibility_info;
|
||||||
ZipEntry info_entry;
|
ZipEntry info_entry;
|
||||||
ZipString info_name;
|
std::string info_name;
|
||||||
while (Next(cookie, &info_entry, &info_name) == 0) {
|
while (Next(cookie, &info_entry, &info_name) == 0) {
|
||||||
std::string content(info_entry.uncompressed_length, '\0');
|
std::string content(info_entry.uncompressed_length, '\0');
|
||||||
int32_t ret = ExtractToMemory(zip_handle, &info_entry, reinterpret_cast<uint8_t*>(&content[0]),
|
int32_t ret = ExtractToMemory(zip_handle, &info_entry, reinterpret_cast<uint8_t*>(&content[0]),
|
||||||
info_entry.uncompressed_length);
|
info_entry.uncompressed_length);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
LOG(ERROR) << "Failed to read " << info_name.name << ": " << ErrorCodeString(ret);
|
LOG(ERROR) << "Failed to read " << info_name << ": " << ErrorCodeString(ret);
|
||||||
CloseArchive(zip_handle);
|
CloseArchive(zip_handle);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,22 +320,21 @@ static std::vector<Certificate> IterateZipEntriesAndSearchForKeys(const ZipArchi
|
||||||
|
|
||||||
std::vector<Certificate> result;
|
std::vector<Certificate> result;
|
||||||
|
|
||||||
ZipString name;
|
std::string name;
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
while ((iter_status = Next(cookie, &entry, &name)) == 0) {
|
while ((iter_status = Next(cookie, &entry, &name)) == 0) {
|
||||||
std::vector<uint8_t> pem_content(entry.uncompressed_length);
|
std::vector<uint8_t> pem_content(entry.uncompressed_length);
|
||||||
if (int32_t extract_status =
|
if (int32_t extract_status =
|
||||||
ExtractToMemory(handle, &entry, pem_content.data(), pem_content.size());
|
ExtractToMemory(handle, &entry, pem_content.data(), pem_content.size());
|
||||||
extract_status != 0) {
|
extract_status != 0) {
|
||||||
LOG(ERROR) << "Failed to extract " << std::string(name.name, name.name + name.name_length);
|
LOG(ERROR) << "Failed to extract " << name;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
Certificate cert(0, Certificate::KEY_TYPE_RSA, nullptr, nullptr);
|
||||||
// Aborts the parsing if we fail to load one of the key file.
|
// Aborts the parsing if we fail to load one of the key file.
|
||||||
if (!LoadCertificateFromBuffer(pem_content, &cert)) {
|
if (!LoadCertificateFromBuffer(pem_content, &cert)) {
|
||||||
LOG(ERROR) << "Failed to load keys from "
|
LOG(ERROR) << "Failed to load keys from " << name;
|
||||||
<< std::string(name.name, name.name + name.name_length);
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue