diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-29 14:32:48 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-29 14:33:05 -0700 |
commit | d36c0c538a545fac5d9db6ba65c525246d4efa95 (patch) | |
tree | 3fd29af0f137dfaf5df892723e60600f674392b3 /src/google/protobuf/extension_set.h | |
parent | 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 (diff) | |
download | protobuf-d36c0c538a545fac5d9db6ba65c525246d4efa95.tar.gz protobuf-d36c0c538a545fac5d9db6ba65c525246d4efa95.tar.bz2 protobuf-d36c0c538a545fac5d9db6ba65c525246d4efa95.zip |
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/extension_set.h')
-rw-r--r-- | src/google/protobuf/extension_set.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index f5aa8de9..cb8ed217 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -416,7 +416,8 @@ class LIBPROTOBUF_EXPORT ExtensionSet { uint8* target) const; // For backward-compatibility, versions of two of the above methods that - // are never forced to serialize deterministically. + // serialize deterministically iff SetDefaultSerializationDeterministic() + // has been called. uint8* SerializeWithCachedSizesToArray(int start_field_number, int end_field_number, uint8* target) const; @@ -435,7 +436,11 @@ class LIBPROTOBUF_EXPORT ExtensionSet { // be linked in). It's up to the protocol compiler to avoid calling this on // such ExtensionSets (easy enough since lite messages don't implement // SpaceUsed()). - int SpaceUsedExcludingSelf() const; + size_t SpaceUsedExcludingSelfLong() const; + + int SpaceUsedExcludingSelf() const { + return internal::FromIntSize(SpaceUsedExcludingSelfLong()); + } private: @@ -457,7 +462,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet { virtual bool IsInitialized() const = 0; virtual int ByteSize() const = 0; - virtual int SpaceUsed() const = 0; + virtual size_t SpaceUsedLong() const = 0; virtual void MergeFrom(const LazyMessageExtension& other) = 0; virtual void Clear() = 0; @@ -556,7 +561,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet { void Clear(); int GetSize() const; void Free(); - int SpaceUsedExcludingSelf() const; + size_t SpaceUsedExcludingSelfLong() const; }; typedef std::map<int, Extension> ExtensionMap; @@ -620,7 +625,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet { // class. // Defined in extension_set_heavy.cc. - static inline int RepeatedMessage_SpaceUsedExcludingSelf( + static inline size_t RepeatedMessage_SpaceUsedExcludingSelfLong( RepeatedPtrFieldBase* field); // The Extension struct is small enough to be passed by value, so we use it @@ -1100,7 +1105,7 @@ template<typename Type> inline // parameter, and thus make an instance of ExtensionIdentifier have no // actual contents. However, if we did that, then using at extension // identifier would not necessarily cause the compiler to output any sort -// of reference to any simple defined in the extension's .pb.o file. Some +// of reference to any symbol defined in the extension's .pb.o file. Some // linkers will actually drop object files that are not explicitly referenced, // but that would be bad because it would cause this extension to not be // registered at static initialization, and therefore using it would crash. |