Index: third_party/protobuf/src/google/protobuf/map_type_handler.h |
diff --git a/third_party/protobuf/src/google/protobuf/map_type_handler.h b/third_party/protobuf/src/google/protobuf/map_type_handler.h |
index f8ad7584a4eb2a5406f6d19ddee0d5dfe5c1f636..ac987cbc1c147d643d972c1b9b0f55d733f1f3b2 100644 |
--- a/third_party/protobuf/src/google/protobuf/map_type_handler.h |
+++ b/third_party/protobuf/src/google/protobuf/map_type_handler.h |
@@ -158,15 +158,18 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> { |
MapWireFieldTypeTraits<WireFormatLite::TYPE_MESSAGE, Type>::kIsEnum; |
// Functions used in parsing and serialization. =================== |
- static inline int ByteSize(const MapEntryAccessorType& value); |
+ static inline size_t ByteSize(const MapEntryAccessorType& value); |
static inline int GetCachedSize(const MapEntryAccessorType& value); |
static inline bool Read(io::CodedInputStream* input, |
MapEntryAccessorType* value); |
static inline void Write(int field, const MapEntryAccessorType& value, |
io::CodedOutputStream* output); |
+ static inline uint8* InternalWriteToArray(int field, |
+ const MapEntryAccessorType& value, |
+ bool deterministic, uint8* target); |
static inline uint8* WriteToArray(int field, |
const MapEntryAccessorType& value, |
- uint8* output); |
+ uint8* target); |
// Functions to manipulate data on memory. ======================== |
static inline const Type& GetExternalReference(const Type* value); |
@@ -220,9 +223,16 @@ class MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type> { |
MapEntryAccessorType* value); \ |
static inline void Write(int field, const MapEntryAccessorType& value, \ |
io::CodedOutputStream* output); \ |
+ static inline uint8* InternalWriteToArray( \ |
+ int field, \ |
+ const MapEntryAccessorType& value, \ |
+ bool deterministic, \ |
+ uint8* target); \ |
static inline uint8* WriteToArray(int field, \ |
const MapEntryAccessorType& value, \ |
- uint8* output); \ |
+ uint8* target) { \ |
+ return InternalWriteToArray(field, value, false, target); \ |
+ } \ |
static inline const MapEntryAccessorType& GetExternalReference( \ |
const TypeOnMemory& value); \ |
static inline void DeleteNoArena(const TypeOnMemory& x); \ |
@@ -266,7 +276,7 @@ MAP_HANDLER(BOOL) |
#undef MAP_HANDLER |
template <typename Type> |
-inline int |
+inline size_t |
MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::ByteSize( |
const MapEntryAccessorType& value) { |
return WireFormatLite::MessageSizeNoVirtual(value); |
@@ -362,9 +372,11 @@ inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Write( |
template <typename Type> |
inline uint8* |
-MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::WriteToArray( |
- int field, const MapEntryAccessorType& value, uint8* output) { |
- return WireFormatLite::WriteMessageToArray(field, value, output); |
+MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::InternalWriteToArray( |
+ int field, const MapEntryAccessorType& value, bool deterministic, |
+ uint8* target) { |
+ return WireFormatLite::InternalWriteMessageToArray(field, value, |
+ deterministic, target); |
} |
#define WRITE_METHOD(FieldType, DeclaredType) \ |
@@ -376,9 +388,10 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::WriteToArray( |
} \ |
template <typename Type> \ |
inline uint8* \ |
- MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::WriteToArray( \ |
- int field, const MapEntryAccessorType& value, uint8* output) { \ |
- return WireFormatLite::Write##DeclaredType##ToArray(field, value, output); \ |
+ MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |
+ Type>::InternalWriteToArray( \ |
+ int field, const MapEntryAccessorType& value, bool, uint8* target) { \ |
+ return WireFormatLite::Write##DeclaredType##ToArray(field, value, target); \ |
} |
WRITE_METHOD(STRING , String) |
@@ -543,7 +556,7 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, |
Type>::MapEntryAccessorType& \ |
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |
Type>::GetExternalReference(const TypeOnMemory& value) { \ |
- return value.Get(&::google::protobuf::internal::GetEmptyString()); \ |
+ return value.Get(); \ |
} \ |
template <typename Type> \ |
inline int \ |
@@ -564,25 +577,24 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, |
template <typename Type> \ |
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \ |
TypeOnMemory* value, Arena* arena) { \ |
- value->ClearToEmpty(&::google::protobuf::internal::GetEmptyString(), arena); \ |
+ value->ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), \ |
+ arena); \ |
} \ |
template <typename Type> \ |
- inline void \ |
- MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |
- Type>::ClearMaybeByDefaultEnum(TypeOnMemory* value, \ |
- Arena* arena, \ |
- int default_enum) { \ |
+ inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ |
+ ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \ |
+ int default_enum) { \ |
Clear(value, arena); \ |
} \ |
template <typename Type> \ |
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \ |
const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \ |
- to->Set(&::google::protobuf::internal::GetEmptyString(), from, arena); \ |
+ to->Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from, arena); \ |
} \ |
template <typename Type> \ |
void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::DeleteNoArena( \ |
TypeOnMemory& value) { \ |
- value.DestroyNoArena(&::google::protobuf::internal::GetEmptyString()); \ |
+ value.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ |
} \ |
template <typename Type> \ |
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |
@@ -591,14 +603,13 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, |
inline void \ |
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \ |
TypeOnMemory* value, Arena* arena) { \ |
- value->UnsafeSetDefault(&::google::protobuf::internal::GetEmptyString()); \ |
+ value->UnsafeSetDefault( \ |
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ |
} \ |
template <typename Type> \ |
- inline void \ |
- MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |
- Type>::InitializeMaybeByDefaultEnum(TypeOnMemory* value, \ |
- int default_enum_value, \ |
- Arena* arena) { \ |
+ inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \ |
+ InitializeMaybeByDefaultEnum(TypeOnMemory* value, \ |
+ int default_enum_value, Arena* arena) { \ |
Initialize(value, arena); \ |
} \ |
template <typename Type> \ |
@@ -606,7 +617,8 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, |
Type>::MapEntryAccessorType* \ |
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \ |
TypeOnMemory* value, Arena* arena) { \ |
- return value->Mutable(&::google::protobuf::internal::GetEmptyString(), arena); \ |
+ return value->Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), \ |
+ arena); \ |
} \ |
template <typename Type> \ |
inline const typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |
@@ -615,7 +627,7 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, |
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \ |
const TypeOnMemory& \ |
default_value) { \ |
- return value.Get(&::google::protobuf::internal::GetEmptyString()); \ |
+ return value.Get(); \ |
} \ |
template <typename Type> \ |
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |