summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Krzysztof Kosiński <krzysio@google.com> 2022-08-06 08:24:47 +0000
committer Krzysztof Kosiński <krzysio@google.com> 2022-08-06 08:24:47 +0000
commit92d263378a73aed451852f68e33422530ae9ab9d (patch)
tree37a0e702637ce5be0ec3c08180e9f8523c43dd21
parent1d81f1e0a3ba7cbec25375e69876f3a56974216a (diff)
aapt2: Fix deprecated proto API usage.
Bug: 203713560 Test: presubmit Change-Id: Ie8bb2c010cff1c2e861918496290d1ef6dd6daef
-rw-r--r--tools/aapt2/format/Container.cpp4
-rw-r--r--tools/aapt2/io/Util.h3
2 files changed, 3 insertions, 4 deletions
diff --git a/tools/aapt2/format/Container.cpp b/tools/aapt2/format/Container.cpp
index 9cef7b3d2ce3..1ff6c4996b91 100644
--- a/tools/aapt2/format/Container.cpp
+++ b/tools/aapt2/format/Container.cpp
@@ -76,7 +76,7 @@ bool ContainerWriter::AddResTableEntry(const pb::ResourceTable& table) {
coded_out.WriteLittleEndian32(kResTable);
// Write the aligned size.
- const ::google::protobuf::uint64 size = table.ByteSize();
+ const size_t size = table.ByteSizeLong();
const int padding = CalculatePaddingForAlignment(size);
coded_out.WriteLittleEndian64(size);
@@ -109,7 +109,7 @@ bool ContainerWriter::AddResFileEntry(const pb::internal::CompiledFile& file,
coded_out.WriteLittleEndian32(kResFile);
// Write the aligned size.
- const ::google::protobuf::uint32 header_size = file.ByteSize();
+ const size_t header_size = file.ByteSizeLong();
const int header_padding = CalculatePaddingForAlignment(header_size);
const ::google::protobuf::uint64 data_size = in->TotalSize();
const int data_padding = CalculatePaddingForAlignment(data_size);
diff --git a/tools/aapt2/io/Util.h b/tools/aapt2/io/Util.h
index 5cb8206db23c..1b48a288d255 100644
--- a/tools/aapt2/io/Util.h
+++ b/tools/aapt2/io/Util.h
@@ -131,8 +131,7 @@ class ProtoInputStreamReader {
template <typename T> bool ReadMessage(T *message) {
ZeroCopyInputAdaptor adapter(in_);
google::protobuf::io::CodedInputStream coded_stream(&adapter);
- coded_stream.SetTotalBytesLimit(std::numeric_limits<int32_t>::max(),
- coded_stream.BytesUntilTotalBytesLimit());
+ coded_stream.SetTotalBytesLimit(std::numeric_limits<int32_t>::max());
return message->ParseFromCodedStream(&coded_stream);
}