From d64a2d9941c36a7bc2a7959ea10ab8363192ac14 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 29 Jun 2016 15:23:27 -0700 Subject: Integrated internal changes from Google This includes all internal changes from around May 20 to now. --- src/google/protobuf/map_type_handler.h | 42 +++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'src/google/protobuf/map_type_handler.h') 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 { 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 { 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::Write( template inline uint8* -MapTypeHandler::WriteToArray( - int field, const MapEntryAccessorType& value, uint8* output) { - return WireFormatLite::WriteMessageToArray(field, value, output); +MapTypeHandler::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::WriteToArray( } \ template \ inline uint8* \ - MapTypeHandler::WriteToArray( \ - int field, const MapEntryAccessorType& value, uint8* output) { \ + MapTypeHandler::InternalWriteToArray( \ + int field, const MapEntryAccessorType& value, bool, uint8* output) { \ return WireFormatLite::Write##DeclaredType##ToArray(field, value, output); \ } @@ -543,7 +556,7 @@ inline bool MapTypeHandler::MapEntryAccessorType& \ MapTypeHandler::GetExternalReference(const TypeOnMemory& value) { \ - return value.Get(&::google::protobuf::internal::GetEmptyString()); \ + return value.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template \ inline int \ @@ -564,7 +577,8 @@ inline bool MapTypeHandler \ inline void MapTypeHandler::Clear( \ TypeOnMemory* value, Arena* arena) { \ - value->ClearToEmpty(&::google::protobuf::internal::GetEmptyString(), arena); \ + value->ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), \ + arena); \ } \ template \ inline void \ @@ -577,12 +591,12 @@ inline bool MapTypeHandler \ inline void MapTypeHandler::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 \ void MapTypeHandler::DeleteNoArena( \ TypeOnMemory& value) { \ - value.DestroyNoArena(&::google::protobuf::internal::GetEmptyString()); \ + value.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template \ inline void MapTypeHandler::Initialize( \ TypeOnMemory* value, Arena* arena) { \ - value->UnsafeSetDefault(&::google::protobuf::internal::GetEmptyString()); \ + value->UnsafeSetDefault( \ + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template \ inline void \ @@ -606,7 +621,8 @@ inline bool MapTypeHandler::MapEntryAccessorType* \ MapTypeHandler::EnsureMutable( \ TypeOnMemory* value, Arena* arena) { \ - return value->Mutable(&::google::protobuf::internal::GetEmptyString(), arena); \ + return value->Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), \ + arena); \ } \ template \ inline const typename MapTypeHandler::DefaultIfNotInitialized(const TypeOnMemory& value, \ const TypeOnMemory& \ default_value) { \ - return value.Get(&::google::protobuf::internal::GetEmptyString()); \ + return value.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template \ inline bool MapTypeHandler