diff options
Diffstat (limited to 'libs/androidfw/ZipFileRO.cpp')
-rw-r--r-- | libs/androidfw/ZipFileRO.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp index 6e2ca60cc3d3..e77ac3df474c 100644 --- a/libs/androidfw/ZipFileRO.cpp +++ b/libs/androidfw/ZipFileRO.cpp @@ -39,7 +39,7 @@ using namespace android; class _ZipEntryRO { public: ZipEntry entry; - ZipString name; + std::string_view name; void *cookie; _ZipEntryRO() : cookie(NULL) {} @@ -96,9 +96,9 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const { _ZipEntryRO* data = new _ZipEntryRO; - data->name = ZipString(entryName); + data->name = entryName; - const int32_t error = FindEntry(mHandle, data->name, &(data->entry)); + const int32_t error = FindEntry(mHandle, entryName, &(data->entry)); if (error) { delete data; return NULL; @@ -149,11 +149,8 @@ bool ZipFileRO::startIteration(void** cookie) { bool ZipFileRO::startIteration(void** cookie, const char* prefix, const char* suffix) { _ZipEntryRO* ze = new _ZipEntryRO; - ZipString pe(prefix ? prefix : ""); - ZipString se(suffix ? suffix : ""); int32_t error = StartIteration(mHandle, &(ze->cookie), - prefix ? &pe : NULL, - suffix ? &se : NULL); + prefix ? prefix : "", suffix ? suffix : ""); if (error) { ALOGW("Could not start iteration over %s: %s", mFileName != NULL ? mFileName : "<null>", ErrorCodeString(error)); @@ -197,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; |