diff options
author | 2023-08-17 16:27:22 +0000 | |
---|---|---|
committer | 2023-09-12 22:31:10 +0000 | |
commit | 835dfe50a73c6f6de581aaa143c333af79bcca4d (patch) | |
tree | 0bec830cab5de4388aafc4af0e357bfc327be1a0 /tools/aapt/StringPool.cpp | |
parent | a235f8ba91dd467b245f680887e2a75507814b4e (diff) |
Don't depend on String8 cast to C string
Bug: 295394788
Test: m checkbuild
Change-Id: I6aa039b6b2a4944e3537ef133f8785890d957edd
Diffstat (limited to 'tools/aapt/StringPool.cpp')
-rw-r--r-- | tools/aapt/StringPool.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp index 8d0268393433..1af8d6f67bd3 100644 --- a/tools/aapt/StringPool.cpp +++ b/tools/aapt/StringPool.cpp @@ -472,13 +472,13 @@ status_t StringPool::writeStringBlock(const sp<AaptFile>& pool) ENCODE_LENGTH(strings, sizeof(uint8_t), encSize) - strncpy((char*)strings, encStr, encSize+1); + strncpy((char*)strings, encStr.c_str(), encSize + 1); } else { char16_t* strings = (char16_t*)dat; ENCODE_LENGTH(strings, sizeof(char16_t), strSize) - strcpy16_htod(strings, ent.value); + strcpy16_htod(strings, ent.value.c_str()); } strPos += totalSize; @@ -592,7 +592,7 @@ ssize_t StringPool::offsetForString(const String16& val) const ssize_t res = indices != NULL && indices->size() > 0 ? indices->itemAt(0) : -1; if (kIsDebug) { printf("Offset for string %s: %zd (%s)\n", String8(val).c_str(), res, - res >= 0 ? String8(mEntries[mEntryArray[res]].value).c_str() : String8()); + res >= 0 ? String8(mEntries[mEntryArray[res]].value).c_str() : ""); } return res; } |