| Index: third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h b/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h
|
| index 7bce21cf0d16b0dd17eb778fbba02be36d04b0c9..1963fac804dfa51fe1f5801e507101bcdd03a77b 100644
|
| --- a/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h
|
| +++ b/third_party/protobuf/src/google/protobuf/wire_format_lite_inl.h
|
| @@ -251,7 +251,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive(
|
| uint32 tag,
|
| io::CodedInputStream* input,
|
| RepeatedField<CType>* values) {
|
| - GOOGLE_DCHECK_EQ(UInt32Size(tag), tag_size);
|
| + GOOGLE_DCHECK_EQ(UInt32Size(tag), static_cast<size_t>(tag_size));
|
| CType value;
|
| if (!ReadPrimitive<CType, DeclaredType>(input, &value))
|
| return false;
|
| @@ -329,8 +329,8 @@ bool WireFormatLite::ReadRepeatedPrimitiveNoInline(
|
| template <typename CType, enum WireFormatLite::FieldType DeclaredType>
|
| inline bool WireFormatLite::ReadPackedPrimitive(io::CodedInputStream* input,
|
| RepeatedField<CType>* values) {
|
| - uint32 length;
|
| - if (!input->ReadVarint32(&length)) return false;
|
| + int length;
|
| + if (!input->ReadVarintSizeAsInt(&length)) return false;
|
| io::CodedInputStream::Limit limit = input->PushLimit(length);
|
| while (input->BytesUntilLimit() > 0) {
|
| CType value;
|
| @@ -344,11 +344,11 @@ inline bool WireFormatLite::ReadPackedPrimitive(io::CodedInputStream* input,
|
| template <typename CType, enum WireFormatLite::FieldType DeclaredType>
|
| inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
|
| io::CodedInputStream* input, RepeatedField<CType>* values) {
|
| - uint32 length;
|
| - if (!input->ReadVarint32(&length)) return false;
|
| - const uint32 old_entries = values->size();
|
| - const uint32 new_entries = length / sizeof(CType);
|
| - const uint32 new_bytes = new_entries * sizeof(CType);
|
| + int length;
|
| + if (!input->ReadVarintSizeAsInt(&length)) return false;
|
| + const int old_entries = values->size();
|
| + const int new_entries = length / sizeof(CType);
|
| + const int new_bytes = new_entries * sizeof(CType);
|
| if (new_bytes != length) return false;
|
| // We would *like* to pre-allocate the buffer to write into (for
|
| // speed), but *must* avoid performing a very large allocation due
|
| @@ -382,7 +382,7 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
|
| #else
|
| values->Reserve(old_entries + new_entries);
|
| CType value;
|
| - for (uint32 i = 0; i < new_entries; ++i) {
|
| + for (int i = 0; i < new_entries; ++i) {
|
| if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
|
| values->AddAlreadyReserved(value);
|
| }
|
| @@ -392,7 +392,7 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
|
| // safely allocate. We read as much as we can into *values
|
| // without pre-allocating "length" bytes.
|
| CType value;
|
| - for (uint32 i = 0; i < new_entries; ++i) {
|
| + for (int i = 0; i < new_entries; ++i) {
|
| if (!ReadPrimitive<CType, DeclaredType>(input, &value)) return false;
|
| values->Add(value);
|
| }
|
| @@ -443,8 +443,8 @@ inline bool WireFormatLite::ReadGroup(int field_number,
|
| }
|
| inline bool WireFormatLite::ReadMessage(io::CodedInputStream* input,
|
| MessageLite* value) {
|
| - uint32 length;
|
| - if (!input->ReadVarint32(&length)) return false;
|
| + int length;
|
| + if (!input->ReadVarintSizeAsInt(&length)) return false;
|
| std::pair<io::CodedInputStream::Limit, int> p =
|
| input->IncrementRecursionDepthAndPushLimit(length);
|
| if (p.second < 0 || !value->MergePartialFromCodedStream(input)) return false;
|
| @@ -489,8 +489,8 @@ inline bool WireFormatLite::ReadGroupNoVirtualNoRecursionDepth(
|
| template<typename MessageType_WorkAroundCppLookupDefect>
|
| inline bool WireFormatLite::ReadMessageNoVirtual(
|
| io::CodedInputStream* input, MessageType_WorkAroundCppLookupDefect* value) {
|
| - uint32 length;
|
| - if (!input->ReadVarint32(&length)) return false;
|
| + int length;
|
| + if (!input->ReadVarintSizeAsInt(&length)) return false;
|
| std::pair<io::CodedInputStream::Limit, int> p =
|
| input->IncrementRecursionDepthAndPushLimit(length);
|
| if (p.second < 0 || !value->
|
| @@ -772,102 +772,96 @@ inline uint8* WireFormatLite::WriteBytesToArray(int field_number,
|
| }
|
|
|
|
|
| -inline uint8* WireFormatLite::WriteGroupToArray(int field_number,
|
| - const MessageLite& value,
|
| - uint8* target) {
|
| +inline uint8* WireFormatLite::InternalWriteGroupToArray(
|
| + int field_number, const MessageLite& value, bool deterministic,
|
| + uint8* target) {
|
| target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target);
|
| - target = value.SerializeWithCachedSizesToArray(target);
|
| + target = value.InternalSerializeWithCachedSizesToArray(deterministic, target);
|
| return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target);
|
| }
|
| -inline uint8* WireFormatLite::WriteMessageToArray(int field_number,
|
| - const MessageLite& value,
|
| - uint8* target) {
|
| +inline uint8* WireFormatLite::InternalWriteMessageToArray(
|
| + int field_number, const MessageLite& value, bool deterministic,
|
| + uint8* target) {
|
| target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
|
| target = io::CodedOutputStream::WriteVarint32ToArray(
|
| value.GetCachedSize(), target);
|
| - return value.SerializeWithCachedSizesToArray(target);
|
| + return value.InternalSerializeWithCachedSizesToArray(deterministic, target);
|
| }
|
|
|
| // See comment on ReadGroupNoVirtual to understand the need for this template
|
| // parameter name.
|
| template<typename MessageType_WorkAroundCppLookupDefect>
|
| -inline uint8* WireFormatLite::WriteGroupNoVirtualToArray(
|
| +inline uint8* WireFormatLite::InternalWriteGroupNoVirtualToArray(
|
| int field_number, const MessageType_WorkAroundCppLookupDefect& value,
|
| - uint8* target) {
|
| + bool deterministic, uint8* target) {
|
| target = WriteTagToArray(field_number, WIRETYPE_START_GROUP, target);
|
| - target = value.MessageType_WorkAroundCppLookupDefect
|
| - ::SerializeWithCachedSizesToArray(target);
|
| + target = value.InternalSerializeWithCachedSizesToArray(deterministic, target);
|
| return WriteTagToArray(field_number, WIRETYPE_END_GROUP, target);
|
| }
|
| template<typename MessageType_WorkAroundCppLookupDefect>
|
| -inline uint8* WireFormatLite::WriteMessageNoVirtualToArray(
|
| +inline uint8* WireFormatLite::InternalWriteMessageNoVirtualToArray(
|
| int field_number, const MessageType_WorkAroundCppLookupDefect& value,
|
| - uint8* target) {
|
| + bool deterministic, uint8* target) {
|
| target = WriteTagToArray(field_number, WIRETYPE_LENGTH_DELIMITED, target);
|
| target = io::CodedOutputStream::WriteVarint32ToArray(
|
| value.MessageType_WorkAroundCppLookupDefect::GetCachedSize(), target);
|
| - return value.MessageType_WorkAroundCppLookupDefect
|
| - ::SerializeWithCachedSizesToArray(target);
|
| + return value.InternalSerializeWithCachedSizesToArray(deterministic, target);
|
| }
|
|
|
| // ===================================================================
|
|
|
| -inline int WireFormatLite::Int32Size(int32 value) {
|
| +inline size_t WireFormatLite::Int32Size(int32 value) {
|
| return io::CodedOutputStream::VarintSize32SignExtended(value);
|
| }
|
| -inline int WireFormatLite::Int64Size(int64 value) {
|
| +inline size_t WireFormatLite::Int64Size(int64 value) {
|
| return io::CodedOutputStream::VarintSize64(static_cast<uint64>(value));
|
| }
|
| -inline int WireFormatLite::UInt32Size(uint32 value) {
|
| +inline size_t WireFormatLite::UInt32Size(uint32 value) {
|
| return io::CodedOutputStream::VarintSize32(value);
|
| }
|
| -inline int WireFormatLite::UInt64Size(uint64 value) {
|
| +inline size_t WireFormatLite::UInt64Size(uint64 value) {
|
| return io::CodedOutputStream::VarintSize64(value);
|
| }
|
| -inline int WireFormatLite::SInt32Size(int32 value) {
|
| +inline size_t WireFormatLite::SInt32Size(int32 value) {
|
| return io::CodedOutputStream::VarintSize32(ZigZagEncode32(value));
|
| }
|
| -inline int WireFormatLite::SInt64Size(int64 value) {
|
| +inline size_t WireFormatLite::SInt64Size(int64 value) {
|
| return io::CodedOutputStream::VarintSize64(ZigZagEncode64(value));
|
| }
|
| -inline int WireFormatLite::EnumSize(int value) {
|
| +inline size_t WireFormatLite::EnumSize(int value) {
|
| return io::CodedOutputStream::VarintSize32SignExtended(value);
|
| }
|
|
|
| -inline int WireFormatLite::StringSize(const string& value) {
|
| - return static_cast<int>(
|
| - io::CodedOutputStream::VarintSize32(static_cast<uint32>(value.size())) +
|
| - value.size());
|
| +inline size_t WireFormatLite::StringSize(const string& value) {
|
| + return LengthDelimitedSize(value.size());
|
| }
|
| -inline int WireFormatLite::BytesSize(const string& value) {
|
| - return static_cast<int>(
|
| - io::CodedOutputStream::VarintSize32(static_cast<uint32>(value.size())) +
|
| - value.size());
|
| +inline size_t WireFormatLite::BytesSize(const string& value) {
|
| + return LengthDelimitedSize(value.size());
|
| }
|
|
|
|
|
| -inline int WireFormatLite::GroupSize(const MessageLite& value) {
|
| - return value.ByteSize();
|
| +inline size_t WireFormatLite::GroupSize(const MessageLite& value) {
|
| + return value.ByteSizeLong();
|
| }
|
| -inline int WireFormatLite::MessageSize(const MessageLite& value) {
|
| - return LengthDelimitedSize(value.ByteSize());
|
| +inline size_t WireFormatLite::MessageSize(const MessageLite& value) {
|
| + return LengthDelimitedSize(value.ByteSizeLong());
|
| }
|
|
|
| // See comment on ReadGroupNoVirtual to understand the need for this template
|
| // parameter name.
|
| template<typename MessageType_WorkAroundCppLookupDefect>
|
| -inline int WireFormatLite::GroupSizeNoVirtual(
|
| +inline size_t WireFormatLite::GroupSizeNoVirtual(
|
| const MessageType_WorkAroundCppLookupDefect& value) {
|
| - return value.MessageType_WorkAroundCppLookupDefect::ByteSize();
|
| + return value.MessageType_WorkAroundCppLookupDefect::ByteSizeLong();
|
| }
|
| template<typename MessageType_WorkAroundCppLookupDefect>
|
| -inline int WireFormatLite::MessageSizeNoVirtual(
|
| +inline size_t WireFormatLite::MessageSizeNoVirtual(
|
| const MessageType_WorkAroundCppLookupDefect& value) {
|
| return LengthDelimitedSize(
|
| - value.MessageType_WorkAroundCppLookupDefect::ByteSize());
|
| + value.MessageType_WorkAroundCppLookupDefect::ByteSizeLong());
|
| }
|
|
|
| -inline int WireFormatLite::LengthDelimitedSize(int length) {
|
| +inline size_t WireFormatLite::LengthDelimitedSize(size_t length) {
|
| return io::CodedOutputStream::VarintSize32(length) + length;
|
| }
|
|
|
|
|