diff options
Diffstat (limited to 'src/google/protobuf/map_type_handler.h')
-rw-r--r-- | src/google/protobuf/map_type_handler.h | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index f8ad7584..74e8bb50 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -164,6 +164,9 @@ 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* output); static inline uint8* WriteToArray(int field, const MapEntryAccessorType& value, uint8* output); @@ -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* output); \ static inline uint8* WriteToArray(int field, \ const MapEntryAccessorType& value, \ - uint8* output); \ + uint8* output) { \ + return InternalWriteToArray(field, value, false, output); \ + } \ static inline const MapEntryAccessorType& GetExternalReference( \ const TypeOnMemory& value); \ static inline void DeleteNoArena(const TypeOnMemory& x); \ @@ -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* output) { + return WireFormatLite::InternalWriteMessageToArray(field, value, + deterministic, output); } #define WRITE_METHOD(FieldType, DeclaredType) \ @@ -376,8 +388,9 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::WriteToArray( } \ template <typename Type> \ inline uint8* \ - MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::WriteToArray( \ - int field, const MapEntryAccessorType& value, uint8* output) { \ + MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ + Type>::InternalWriteToArray( \ + int field, const MapEntryAccessorType& value, bool, uint8* output) { \ return WireFormatLite::Write##DeclaredType##ToArray(field, value, output); \ } @@ -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(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template <typename Type> \ inline int \ @@ -564,7 +577,8 @@ 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 \ @@ -577,12 +591,12 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, 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,7 +605,8 @@ 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 \ @@ -606,7 +621,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 +631,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(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template <typename Type> \ inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \ |