diff options
author | Adam Cozzette <acozzette@gmail.com> | 2018-07-09 09:35:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-09 09:35:48 -0700 |
commit | e1845779ed1115dd61eb2a3b8f0a78c252ca5b2b (patch) | |
tree | fdb892e4e34269f6b3bbb6f629a912d4c63c2d70 /src/google/protobuf/generated_message_util.h | |
parent | f7ada1280fac4af717d478e6a9765d3f02b418b3 (diff) | |
parent | a9abc7831e45257d334cfa682746b6cadf9e95d9 (diff) |
Merge pull request #4878 from acozzette/fix-msvc-initialization
Fix initialization with Visual Studio
Diffstat (limited to 'src/google/protobuf/generated_message_util.h')
-rw-r--r-- | src/google/protobuf/generated_message_util.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index 706df383..04f68a6e 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -109,6 +109,13 @@ namespace internal { LIBPROTOBUF_EXPORT double Infinity(); LIBPROTOBUF_EXPORT double NaN(); +LIBPROTOBUF_EXPORT void InitProtobufDefaults(); + +// This used by proto1 +inline const std::string& GetEmptyString() { + InitProtobufDefaults(); + return GetEmptyStringAlreadyInited(); +} // True if IsInitialized() is true for all elements of t. Type is expected // to be a RepeatedPtrField<some message type>. It's useful to have this @@ -137,8 +144,6 @@ bool AllAreInitializedWeak(const ::google::protobuf::RepeatedPtrField<T>& t) { return true; } -LIBPROTOBUF_EXPORT void InitProtobufDefaults(); - struct LIBPROTOBUF_EXPORT FieldMetadata { uint32 offset; // offset of this field in the struct uint32 tag; // field * 8 + wire_type @@ -368,6 +373,17 @@ inline void InitSCC(SCCInfoBase* scc) { if (GOOGLE_PREDICT_FALSE(status != SCCInfoBase::kInitialized)) InitSCCImpl(scc); } +LIBPROTOBUF_EXPORT void DestroyMessage(const void* message); +LIBPROTOBUF_EXPORT void DestroyString(const void* s); +// Destroy (not delete) the message +inline void OnShutdownDestroyMessage(const void* ptr) { + OnShutdownRun(DestroyMessage, ptr); +} +// Destroy the string (call string destructor) +inline void OnShutdownDestroyString(const std::string* ptr) { + OnShutdownRun(DestroyString, ptr); +} + } // namespace internal } // namespace protobuf |