aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/wire_format_lite.h
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2015-02-28 14:51:22 -0800
committerJisi Liu <jisi.liu@gmail.com>2015-02-28 17:06:49 -0800
commit885b612f74f133678bf82808c589331e4c59dad9 (patch)
treee5f3f65b41af477c52810053b8694896c8bcd1f7 /src/google/protobuf/wire_format_lite.h
parent1939efed2db35020b7830a4927f10feac47b6757 (diff)
downloadprotobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.gz
protobuf-885b612f74f133678bf82808c589331e4c59dad9.tar.bz2
protobuf-885b612f74f133678bf82808c589331e4c59dad9.zip
Down integrate from Google internal branch for C++ and Java.
- Maps for C++ lite - C++ Arena optimizations. - Java Lite runtime code size optimization. Change-Id: I7537a4357c1cb385d23f9e8aa7ffdfeefe079f13
Diffstat (limited to 'src/google/protobuf/wire_format_lite.h')
-rw-r--r--src/google/protobuf/wire_format_lite.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index acf88ead..76bc75a1 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -291,11 +291,20 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
template <typename CType, enum FieldType DeclaredType>
static bool ReadPackedPrimitiveNoInline(input, RepeatedField<CType>* value);
- // Read a packed enum field. Values for which is_valid() returns false are
- // dropped. If is_valid == NULL, no values are dropped.
+ // Read a packed enum field. If the is_valid function is not NULL, values for
+ // which is_valid(value) returns false are silently dropped.
static bool ReadPackedEnumNoInline(input,
bool (*is_valid)(int),
- RepeatedField<int>* value);
+ RepeatedField<int>* values);
+
+ // Read a packed enum field. If the is_valid function is not NULL, values for
+ // which is_valid(value) returns false are appended to unknown_fields_stream.
+ static bool ReadPackedEnumPreserveUnknowns(
+ input,
+ field_number,
+ bool (*is_valid)(int),
+ io::CodedOutputStream* unknown_fields_stream,
+ RepeatedField<int>* values);
// Read a string. ReadString(..., string* value) requires an existing string.
static inline bool ReadString(input, string* value);
@@ -647,7 +656,7 @@ inline double WireFormatLite::DecodeDouble(uint64 value) {
inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
// Note: the right-shift must be arithmetic
- return (n << 1) ^ (n >> 31);
+ return (static_cast<uint32>(n) << 1) ^ (n >> 31);
}
inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
@@ -656,7 +665,7 @@ inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
// Note: the right-shift must be arithmetic
- return (n << 1) ^ (n >> 63);
+ return (static_cast<uint64>(n) << 1) ^ (n >> 63);
}
inline int64 WireFormatLite::ZigZagDecode64(uint64 n) {