Loading libs/androidfw/ApkAssets.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path, return false; } ::ZipString name; std::string name; ::ZipEntry entry; // We need to hold back directories because many paths will contain them and we want to only Loading @@ -220,7 +220,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path, int32_t result; while ((result = ::Next(cookie, &entry, &name)) == 0) { StringPiece full_file_path(reinterpret_cast<const char*>(name.name), name.name_length); StringPiece full_file_path(name); StringPiece leaf_file_path = full_file_path.substr(root_path_full.size()); if (!leaf_file_path.empty()) { Loading libs/androidfw/ZipFileRO.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ using namespace android; class _ZipEntryRO { public: ZipEntry entry; ZipString name; std::string_view name; void *cookie; _ZipEntryRO() : cookie(NULL) {} Loading Loading @@ -96,7 +96,7 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const { _ZipEntryRO* data = new _ZipEntryRO; data->name = ZipString(entryName); data->name = entryName; const int32_t error = FindEntry(mHandle, entryName, &(data->entry)); if (error) { Loading Loading @@ -194,14 +194,14 @@ int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, size_t bufLen) const { const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry); const uint16_t requiredSize = zipEntry->name.name_length + 1; const uint16_t requiredSize = zipEntry->name.length() + 1; if (bufLen < requiredSize) { ALOGW("Buffer too short, requires %d bytes for entry name", requiredSize); return requiredSize; } memcpy(buffer, zipEntry->name.name, requiredSize - 1); memcpy(buffer, zipEntry->name.data(), requiredSize - 1); buffer[requiredSize - 1] = '\0'; return 0; Loading tools/aapt2/io/ZipArchive.cpp +2 −5 Original line number Diff line number Diff line Loading @@ -115,12 +115,9 @@ std::unique_ptr<ZipFileCollection> ZipFileCollection::Create( using IterationEnder = std::unique_ptr<void, decltype(EndIteration)*>; IterationEnder iteration_ender(cookie, EndIteration); ZipString zip_entry_name; std::string zip_entry_path; ZipEntry zip_data; while ((result = Next(cookie, &zip_data, &zip_entry_name)) == 0) { std::string zip_entry_path = std::string(reinterpret_cast<const char*>(zip_entry_name.name), zip_entry_name.name_length); while ((result = Next(cookie, &zip_data, &zip_entry_path)) == 0) { std::string nested_path = path.to_string() + "@" + zip_entry_path; std::unique_ptr<IFile> file = util::make_unique<ZipFile>(collection->handle_, zip_data, Source(nested_path)); Loading Loading
libs/androidfw/ApkAssets.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path, return false; } ::ZipString name; std::string name; ::ZipEntry entry; // We need to hold back directories because many paths will contain them and we want to only Loading @@ -220,7 +220,7 @@ bool ApkAssets::ForEachFile(const std::string& root_path, int32_t result; while ((result = ::Next(cookie, &entry, &name)) == 0) { StringPiece full_file_path(reinterpret_cast<const char*>(name.name), name.name_length); StringPiece full_file_path(name); StringPiece leaf_file_path = full_file_path.substr(root_path_full.size()); if (!leaf_file_path.empty()) { Loading
libs/androidfw/ZipFileRO.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ using namespace android; class _ZipEntryRO { public: ZipEntry entry; ZipString name; std::string_view name; void *cookie; _ZipEntryRO() : cookie(NULL) {} Loading Loading @@ -96,7 +96,7 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const { _ZipEntryRO* data = new _ZipEntryRO; data->name = ZipString(entryName); data->name = entryName; const int32_t error = FindEntry(mHandle, entryName, &(data->entry)); if (error) { Loading Loading @@ -194,14 +194,14 @@ int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, size_t bufLen) const { const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry); const uint16_t requiredSize = zipEntry->name.name_length + 1; const uint16_t requiredSize = zipEntry->name.length() + 1; if (bufLen < requiredSize) { ALOGW("Buffer too short, requires %d bytes for entry name", requiredSize); return requiredSize; } memcpy(buffer, zipEntry->name.name, requiredSize - 1); memcpy(buffer, zipEntry->name.data(), requiredSize - 1); buffer[requiredSize - 1] = '\0'; return 0; Loading
tools/aapt2/io/ZipArchive.cpp +2 −5 Original line number Diff line number Diff line Loading @@ -115,12 +115,9 @@ std::unique_ptr<ZipFileCollection> ZipFileCollection::Create( using IterationEnder = std::unique_ptr<void, decltype(EndIteration)*>; IterationEnder iteration_ender(cookie, EndIteration); ZipString zip_entry_name; std::string zip_entry_path; ZipEntry zip_data; while ((result = Next(cookie, &zip_data, &zip_entry_name)) == 0) { std::string zip_entry_path = std::string(reinterpret_cast<const char*>(zip_entry_name.name), zip_entry_name.name_length); while ((result = Next(cookie, &zip_data, &zip_entry_path)) == 0) { std::string nested_path = path.to_string() + "@" + zip_entry_path; std::unique_ptr<IFile> file = util::make_unique<ZipFile>(collection->handle_, zip_data, Source(nested_path)); Loading