diff options
author | 2023-03-31 22:37:42 +0000 | |
---|---|---|
committer | 2023-04-03 22:50:25 +0000 | |
commit | f24b9a438d4246607d14eaa04d405c089cb758db (patch) | |
tree | 97a70da03e609314ff07e2d52096a1b1523dd172 /tools/aapt2/ResourceValues.cpp | |
parent | 00558ac53ab84e3ddc9e356452a32c8a0b8ab437 (diff) |
Add additional check on float precision after parsing, only compile the
value when precision is not lost.
Bug: b/69347762
Test: Verified affected atests pass
Change-Id: I8e4fcd420a924f0e949bfd3a8aae23d1e7d582b1
Diffstat (limited to 'tools/aapt2/ResourceValues.cpp')
-rw-r--r-- | tools/aapt2/ResourceValues.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/aapt2/ResourceValues.cpp b/tools/aapt2/ResourceValues.cpp index a5754e0d168f..728e35a266b7 100644 --- a/tools/aapt2/ResourceValues.cpp +++ b/tools/aapt2/ResourceValues.cpp @@ -22,12 +22,12 @@ #include <set> #include <sstream> -#include "android-base/stringprintf.h" -#include "androidfw/ResourceTypes.h" - #include "Resource.h" #include "ResourceUtils.h" #include "ValueVisitor.h" +#include "android-base/stringprintf.h" +#include "androidfw/ResourceTypes.h" +#include "io/StringStream.h" #include "util/Util.h" using ::aapt::text::Printer; @@ -487,6 +487,15 @@ void BinaryPrimitive::PrettyPrint(Printer* printer) const { } } +std::string BinaryPrimitive::toPrettyString() const { + std::string str; + io::StringOutputStream out(&str); + text::Printer printer(&out); + this->PrettyPrint(&printer); + out.Flush(); + return str; +} + Attribute::Attribute(uint32_t t) : type_mask(t), min_int(std::numeric_limits<int32_t>::min()), |