summaryrefslogtreecommitdiff
path: root/tools/aapt2/util/Util.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-11-13 23:55:20 +0000
committerRyan Mitchell <rtmitchell@google.com>2020-11-13 23:55:20 +0000
commit55ef6167a2c235bd88c7216238b2001b46795b79 (patch)
tree5a63ff5e6b8a0ade4ce5aa2c4d663d62a7d993d9 /tools/aapt2/util/Util.cpp
parent6ca48473e533a8b89abac6294a0bb8130b8c8c89 (diff)
Revert "libandroidfw hardening for IncFs"
Revert "Move map_ptr to incfs namspace" Revert submission 12787270 Reason for revert: b/173250495 Reverted Changes: I5cd1bc8a2:libandroidfw hardening for IncFs Ice5dbcfb2:Move map_ptr to incfs namspace I29ccdc8ed:Do not cache bag parent stack until requested I1e9e9acaa:Cache resolved theme values Change-Id: Ib90ef68339710086df41e9abe0833a542d03a74f
Diffstat (limited to 'tools/aapt2/util/Util.cpp')
-rw-r--r--tools/aapt2/util/Util.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/aapt2/util/Util.cpp b/tools/aapt2/util/Util.cpp
index ef33c3463a81..37ce65e4fe5b 100644
--- a/tools/aapt2/util/Util.cpp
+++ b/tools/aapt2/util/Util.cpp
@@ -531,15 +531,19 @@ bool ExtractResFilePathParts(const StringPiece& path, StringPiece* out_prefix,
}
StringPiece16 GetString16(const android::ResStringPool& pool, size_t idx) {
- if (auto str = pool.stringAt(idx)) {
- return *str;
+ size_t len;
+ const char16_t* str = pool.stringAt(idx, &len);
+ if (str != nullptr) {
+ return StringPiece16(str, len);
}
return StringPiece16();
}
std::string GetString(const android::ResStringPool& pool, size_t idx) {
- if (auto str = pool.string8At(idx)) {
- return ModifiedUtf8ToUtf8(str->to_string());
+ size_t len;
+ const char* str = pool.string8At(idx, &len);
+ if (str != nullptr) {
+ return ModifiedUtf8ToUtf8(std::string(str, len));
}
return Utf16ToUtf8(GetString16(pool, idx));
}