summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceUtils.cpp
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2017-05-31 20:48:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-05-31 20:48:06 +0000
commitf42c86660d15c50ff7431b89342e590bcc1bed37 (patch)
treeba24281263894153ec1d89b53e9ead0b0687b603 /tools/aapt2/ResourceUtils.cpp
parentd8d9758363524f454cfa1b39a460e461005c84a3 (diff)
parent5924d8c9ab7bd8614e8bd99864903ce9d50f3bf7 (diff)
Merge "AAPT2: Allow merging of Style attributes from overlays" into oc-dev
Diffstat (limited to 'tools/aapt2/ResourceUtils.cpp')
-rw-r--r--tools/aapt2/ResourceUtils.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp
index 1bb7d9beee45..818c8cec30f9 100644
--- a/tools/aapt2/ResourceUtils.cpp
+++ b/tools/aapt2/ResourceUtils.cpp
@@ -496,19 +496,17 @@ Maybe<int> ParseSdkVersion(const StringPiece& str) {
std::unique_ptr<BinaryPrimitive> TryParseBool(const StringPiece& str) {
if (Maybe<bool> maybe_result = ParseBool(str)) {
- android::Res_value value = {};
- value.dataType = android::Res_value::TYPE_INT_BOOLEAN;
-
- if (maybe_result.value()) {
- value.data = 0xffffffffu;
- } else {
- value.data = 0;
- }
- return util::make_unique<BinaryPrimitive>(value);
+ const uint32_t data = maybe_result.value() ? 0xffffffffu : 0u;
+ return util::make_unique<BinaryPrimitive>(android::Res_value::TYPE_INT_BOOLEAN, data);
}
return {};
}
+std::unique_ptr<BinaryPrimitive> MakeBool(bool val) {
+ return util::make_unique<BinaryPrimitive>(android::Res_value::TYPE_INT_BOOLEAN,
+ val ? 0xffffffffu : 0u);
+}
+
std::unique_ptr<BinaryPrimitive> TryParseInt(const StringPiece& str) {
std::u16string str16 = util::Utf8ToUtf16(str);
android::Res_value value;