From cc8ca5b6a5478b40546d4206392eb1471454460d Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 19 Sep 2016 13:45:07 -0700 Subject: Integrate internal changes --- src/google/protobuf/wire_format.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/google/protobuf/wire_format.h') diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h index aaee21f0..de8ea574 100644 --- a/src/google/protobuf/wire_format.h +++ b/src/google/protobuf/wire_format.h @@ -85,7 +85,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // Compute the byte size of a tag. For groups, this includes both the start // and end tags. - static inline int TagSize(int field_number, FieldDescriptor::Type type); + static inline size_t TagSize(int field_number, FieldDescriptor::Type type); // These procedures can be used to implement the methods of Message which // handle parsing and serialization of the protocol buffer wire format @@ -122,7 +122,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // will have their ByteSize() methods called, so their sizes will be cached. // Therefore, calling this method is sufficient to allow you to call // WireFormat::SerializeWithCachedSizes() on the same object. - static int ByteSize(const Message& message); + static size_t ByteSize(const Message& message); // ----------------------------------------------------------------- // Helpers for dealing with unknown fields @@ -173,11 +173,11 @@ class LIBPROTOBUF_EXPORT WireFormat { uint8* target); // Compute the size of the UnknownFieldSet on the wire. - static int ComputeUnknownFieldsSize(const UnknownFieldSet& unknown_fields); + static size_t ComputeUnknownFieldsSize(const UnknownFieldSet& unknown_fields); // Same thing except for messages that have the message_set_wire_format // option. - static int ComputeUnknownMessageSetItemsSize( + static size_t ComputeUnknownMessageSetItemsSize( const UnknownFieldSet& unknown_fields); @@ -205,7 +205,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // Compute size of a single field. If the field is a message type, this // will call ByteSize() for the embedded message, insuring that it caches // its size. - static int FieldByteSize( + static size_t FieldByteSize( const FieldDescriptor* field, // Cannot be NULL const Message& message); @@ -218,7 +218,7 @@ class LIBPROTOBUF_EXPORT WireFormat { const FieldDescriptor* field, const Message& message, io::CodedOutputStream* output); - static int MessageSetItemByteSize( + static size_t MessageSetItemByteSize( const FieldDescriptor* field, const Message& message); @@ -226,7 +226,7 @@ class LIBPROTOBUF_EXPORT WireFormat { // only includes the size of the raw data, and not the size of the total // length, but for other length-delimited types, the size of the length is // included. - static int FieldDataOnlyByteSize( + static size_t FieldDataOnlyByteSize( const FieldDescriptor* field, // Cannot be NULL const Message& message); @@ -301,7 +301,8 @@ inline uint32 WireFormat::MakeTag(const FieldDescriptor* field) { return WireFormatLite::MakeTag(field->number(), WireTypeForField(field)); } -inline int WireFormat::TagSize(int field_number, FieldDescriptor::Type type) { +inline size_t WireFormat::TagSize(int field_number, + FieldDescriptor::Type type) { // Some compilers don't like enum -> enum casts, so we implicit_cast to // int first. return WireFormatLite::TagSize(field_number, -- cgit v1.2.3