diff options
author | Elliott Hughes <enh@google.com> | 2019-06-14 15:28:38 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2019-06-17 16:05:19 -0700 |
commit | a65cae9e7f47905ee1f55c2fa142eaff1109fc8b (patch) | |
tree | 98b23ce65e764039867096426d4052ee21874a66 /libs/androidfw/ZipFileRO.cpp | |
parent | f4c10e8bc26699a7e8efaebfd0d617aca9cb7718 (diff) |
Move off ZipString and over to std::string/std::string_view as appropriate.
(Cherrypick to AOSP master, resolving merge conflicts.)
Bug: http://b/129068177
Test: treehugger
Change-Id: Ib46761d89772d3a3c655a39df573fd305c117d19
Merged-In: Ib46761d89772d3a3c655a39df573fd305c117d19
Diffstat (limited to 'libs/androidfw/ZipFileRO.cpp')
-rw-r--r-- | libs/androidfw/ZipFileRO.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp index ee5f7783635d..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,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) { @@ -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; |