diff options
author | Adam Cozzette <acozzette@google.com> | 2017-04-27 14:55:53 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2017-04-27 14:55:53 -0700 |
commit | 9053033a5076f82cf18b823c31f352e95e5bfd8d (patch) | |
tree | 1d2a2611f56e786d7c3e40b8fd1b2e3d9aff9025 /src/google/protobuf/wire_format_lite.cc | |
parent | 067b1eec3bf852abaad0844999461baff8a5fdc8 (diff) | |
parent | a6189acd18b00611c1dc7042299ad75486f08a1a (diff) |
Merge remote-tracking branch 'remotes/google/3.3.x' into merge-3.3-to-master
Diffstat (limited to 'src/google/protobuf/wire_format_lite.cc')
-rw-r--r-- | src/google/protobuf/wire_format_lite.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc index 2299d51e..7987f7c4 100644 --- a/src/google/protobuf/wire_format_lite.cc +++ b/src/google/protobuf/wire_format_lite.cc @@ -47,8 +47,8 @@ #include <google/protobuf/io/zero_copy_stream.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h> - namespace google { + namespace protobuf { namespace internal { @@ -123,6 +123,8 @@ WireFormatLite::kWireTypeForFieldType[MAX_FIELD_TYPE + 1] = { bool WireFormatLite::SkipField( io::CodedInputStream* input, uint32 tag) { + // Field number 0 is illegal. + if (WireFormatLite::GetTagFieldNumber(tag) == 0) return false; switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { uint64 value; @@ -168,6 +170,8 @@ bool WireFormatLite::SkipField( bool WireFormatLite::SkipField( io::CodedInputStream* input, uint32 tag, io::CodedOutputStream* output) { + // Field number 0 is illegal. + if (WireFormatLite::GetTagFieldNumber(tag) == 0) return false; switch (WireFormatLite::GetTagWireType(tag)) { case WireFormatLite::WIRETYPE_VARINT: { uint64 value; @@ -340,6 +344,8 @@ bool WireFormatLite::ReadPackedEnumPreserveUnknowns( return true; } +#if !defined(PROTOBUF_LITTLE_ENDIAN) + namespace { void EncodeFixedSizeValue(float v, uint8* dest) { WireFormatLite::WriteFloatNoTagToArray(v, dest); @@ -370,6 +376,8 @@ void EncodeFixedSizeValue(bool v, uint8* dest) { } } // anonymous namespace +#endif // !defined(PROTOBUF_LITTLE_ENDIAN) + template <typename CType> static void WriteArray(const CType* a, int n, io::CodedOutputStream* output) { #if defined(PROTOBUF_LITTLE_ENDIAN) |