diff options
author | Feng Xiao <xiaofeng@google.com> | 2015-08-25 18:00:26 -0700 |
---|---|---|
committer | Feng Xiao <xiaofeng@google.com> | 2015-08-25 18:00:26 -0700 |
commit | 5da0b46811a103bd1a953f496d4bcd5ff45d3736 (patch) | |
tree | 0936b4a6d43832a8c9a671e4b780cd5e19bb398b /src | |
parent | ed91f89f73f703590444f7c9ed816f1e3c3d9221 (diff) | |
parent | ff7bdad231d037802fd457ee4fd65e0291d366d7 (diff) | |
download | protobuf-5da0b46811a103bd1a953f496d4bcd5ff45d3736.tar.gz protobuf-5da0b46811a103bd1a953f496d4bcd5ff45d3736.tar.bz2 protobuf-5da0b46811a103bd1a953f496d4bcd5ff45d3736.zip |
Merge pull request #734 from TeBoring/beta-1
Fix bugs on windows
Diffstat (limited to 'src')
-rw-r--r-- | src/google/protobuf/arena.h | 3 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_unittest.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/generated_message_reflection.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/map.h | 25 | ||||
-rw-r--r-- | src/google/protobuf/map_entry_lite.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/map_field.cc | 14 | ||||
-rw-r--r-- | src/google/protobuf/map_field_inl.h | 4 | ||||
-rwxr-xr-x | src/google/protobuf/stubs/hash.h | 20 | ||||
-rw-r--r-- | src/google/protobuf/stubs/int128.h | 10 | ||||
-rw-r--r-- | src/google/protobuf/stubs/mathutil.h | 16 | ||||
-rw-r--r-- | src/google/protobuf/stubs/status.cc | 1 | ||||
-rw-r--r-- | src/google/protobuf/util/internal/datapiece.h | 14 | ||||
-rw-r--r-- | src/google/protobuf/util/internal/default_value_objectwriter.h | 2 | ||||
-rw-r--r-- | src/google/protobuf/util/internal/json_objectwriter.cc | 9 | ||||
-rw-r--r-- | src/google/protobuf/util/internal/type_info.h | 2 | ||||
-rw-r--r-- | src/google/protobuf/util/internal/utility.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/util/json_util.h | 4 | ||||
-rw-r--r-- | src/google/protobuf/util/time_util.h | 31 | ||||
-rw-r--r-- | src/google/protobuf/util/type_resolver_util.h | 2 |
19 files changed, 110 insertions, 61 deletions
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index f06be4a3..074a9e54 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -32,6 +32,9 @@ #define GOOGLE_PROTOBUF_ARENA_H__ #include <limits> +#ifdef max +#undef max // Visual Studio defines this macro +#endif #if __cplusplus >= 201103L #include <google/protobuf/stubs/type_traits.h> #endif diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_unittest.cc index e5ef6ecd..7840cfaf 100644 --- a/src/google/protobuf/compiler/cpp/cpp_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_unittest.cc @@ -55,7 +55,9 @@ #include <google/protobuf/unittest.pb.h> #include <google/protobuf/unittest_optimize_for.pb.h> #include <google/protobuf/unittest_embed_optimize_for.pb.h> +#if !defined(_MSC_VER) // Too large for visual studio to compile #include <google/protobuf/unittest_enormous_descriptor.pb.h> +#endif #include <google/protobuf/unittest_no_generic_services.pb.h> #include <google/protobuf/test_util.h> #include <google/protobuf/compiler/cpp/cpp_helpers.h> @@ -133,6 +135,7 @@ TEST(GeneratedDescriptorTest, IdenticalDescriptors) { generated_decsriptor_proto.DebugString()); } +#if !defined(_MSC_VER) // Test that generated code has proper descriptors: // Touch a descriptor generated from an enormous message to validate special // handling for descriptors exceeding the C++ standard's recommended minimum @@ -143,6 +146,7 @@ TEST(GeneratedDescriptorTest, EnormousDescriptor) { EXPECT_TRUE(generated_descriptor != NULL); } +#endif #endif // !PROTOBUF_TEST_NO_DESCRIPTORS diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index 85ce6e2e..9ef78710 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -417,12 +417,12 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection { protected: void* MutableRawRepeatedField( Message* message, const FieldDescriptor* field, FieldDescriptor::CppType, - int ctype, const Descriptor* desc) const override; + int ctype, const Descriptor* desc) const; const void* GetRawRepeatedField( const Message& message, const FieldDescriptor* field, FieldDescriptor::CppType, int ctype, - const Descriptor* desc) const override; + const Descriptor* desc) const; virtual MessageFactory* GetMessageFactory() const; diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index c43df13e..8b61573d 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -592,7 +592,7 @@ class Map { typedef MapAllocator<std::pair<const Key, MapPair<Key, T>*> > Allocator; // Iterators - class LIBPROTOBUF_EXPORT const_iterator + class const_iterator : public std::iterator<std::forward_iterator_tag, value_type, ptrdiff_t, const value_type*, const value_type&> { typedef typename hash_map<Key, value_type*, hash<Key>, equal_to<Key>, @@ -853,6 +853,29 @@ struct hash<google::protobuf::MapKey> { return 0; } } + bool + operator()(const google::protobuf::MapKey& map_key1, + const google::protobuf::MapKey& map_key2) const { + switch (map_key1.type()) { +#define COMPARE_CPPTYPE(CPPTYPE, CPPTYPE_METHOD) \ + case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \ + return map_key1.Get##CPPTYPE_METHOD##Value() < \ + map_key2.Get##CPPTYPE_METHOD##Value(); + COMPARE_CPPTYPE(STRING, String) + COMPARE_CPPTYPE(INT64, Int64) + COMPARE_CPPTYPE(INT32, Int32) + COMPARE_CPPTYPE(UINT64, UInt64) + COMPARE_CPPTYPE(UINT32, UInt32) + COMPARE_CPPTYPE(BOOL, Bool) +#undef COMPARE_CPPTYPE + case google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE: + case google::protobuf::FieldDescriptor::CPPTYPE_FLOAT: + case google::protobuf::FieldDescriptor::CPPTYPE_ENUM: + case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE: + GOOGLE_LOG(FATAL) << "Can't get here."; + return true; + } + } }; GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h index 0e6ee013..7cdf1b93 100644 --- a/src/google/protobuf/map_entry_lite.h +++ b/src/google/protobuf/map_entry_lite.h @@ -292,7 +292,7 @@ class MapEntryLite : public MessageLite { // only takes references of given key and value. template <typename K, typename V, WireFormatLite::FieldType k_wire_type, WireFormatLite::FieldType v_wire_type, int default_enum> - class LIBPROTOBUF_EXPORT MapEntryWrapper + class MapEntryWrapper : public MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> { typedef MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> Base; typedef typename Base::KeyMapEntryAccessorType KeyMapEntryAccessorType; @@ -326,7 +326,7 @@ class MapEntryLite : public MessageLite { // the temporary. template <typename K, typename V, WireFormatLite::FieldType k_wire_type, WireFormatLite::FieldType v_wire_type, int default_enum> - class LIBPROTOBUF_EXPORT MapEnumEntryWrapper + class MapEnumEntryWrapper : public MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> { typedef MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> Base; typedef typename Base::KeyMapEntryAccessorType KeyMapEntryAccessorType; diff --git a/src/google/protobuf/map_field.cc b/src/google/protobuf/map_field.cc index d8879f24..eddc95c4 100644 --- a/src/google/protobuf/map_field.cc +++ b/src/google/protobuf/map_field.cc @@ -160,7 +160,7 @@ DynamicMapField::DynamicMapField(const Message* default_entry, DynamicMapField::~DynamicMapField() { // DynamicMapField owns map values. Need to delete them before clearing // the map. - for (typename Map<MapKey, MapValueRef>::iterator iter = map_.begin(); + for (Map<MapKey, MapValueRef>::iterator iter = map_.begin(); iter != map_.end(); ++iter) { iter->second.DeleteData(); } @@ -174,7 +174,7 @@ int DynamicMapField::size() const { bool DynamicMapField::ContainsMapKey( const MapKey& map_key) const { const Map<MapKey, MapValueRef>& map = GetMap(); - typename Map<MapKey, MapValueRef>::const_iterator iter = map.find(map_key); + Map<MapKey, MapValueRef>::const_iterator iter = map.find(map_key); return iter != map.end(); } @@ -246,7 +246,7 @@ Map<MapKey, MapValueRef>* DynamicMapField::MutableMap() { } void DynamicMapField::SetMapIteratorValue(MapIterator* map_iter) const { - typename Map<MapKey, MapValueRef>::const_iterator iter = + Map<MapKey, MapValueRef>::const_iterator iter = TypeDefinedMapFieldBase<MapKey, MapValueRef>::InternalGetIterator( map_iter); if (iter == map_.end()) return; @@ -272,7 +272,7 @@ void DynamicMapField::SyncRepeatedFieldWithMapNoLock() const { MapFieldBase::repeated_field_->Clear(); - for (typename Map<MapKey, MapValueRef>::const_iterator it = map_.begin(); + for (Map<MapKey, MapValueRef>::const_iterator it = map_.begin(); it != map_.end(); ++it) { Message* new_entry = default_entry_->New(); MapFieldBase::repeated_field_->AddAllocated(new_entry); @@ -350,12 +350,12 @@ void DynamicMapField::SyncMapWithRepeatedFieldNoLock() const { default_entry_->GetDescriptor()->FindFieldByName("value"); // DynamicMapField owns map values. Need to delete them before clearing // the map. - for (typename Map<MapKey, MapValueRef>::iterator iter = map->begin(); + for (Map<MapKey, MapValueRef>::iterator iter = map->begin(); iter != map->end(); ++iter) { iter->second.DeleteData(); } map->clear(); - for (typename RepeatedPtrField<Message>::iterator it = + for (RepeatedPtrField<Message>::iterator it = MapFieldBase::repeated_field_->begin(); it != MapFieldBase::repeated_field_->end(); ++it) { MapKey map_key; @@ -424,7 +424,7 @@ int DynamicMapField::SpaceUsedExcludingSelfNoLock() const { size += sizeof(map_); int map_size = map_.size(); if (map_size) { - typename Map<MapKey, MapValueRef>::const_iterator it = map_.begin(); + Map<MapKey, MapValueRef>::const_iterator it = map_.begin(); size += sizeof(it->first) * map_size; size += sizeof(it->second) * map_size; // If key is string, add the allocated space. diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h index 1a4ce937..16c4a08f 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -153,7 +153,9 @@ void TypeDefinedMapFieldBase<Key, T>::CopyIterator( const MapIterator& that_iter) const { InternalGetIterator(this_iter) = InternalGetIterator(&that_iter); this_iter->key_.SetType(that_iter.key_.type()); - this_iter->value_.SetType(that_iter.value_.type()); + // MapValueRef::type() fails when containing data is null. However, if + // this_iter points to MapEnd, data can be null. + this_iter->value_.SetType((FieldDescriptor::CppType)that_iter.value_.type_); SetMapIteratorValue(this_iter); } diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index 0d94ad80..c6f210f0 100755 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -103,8 +103,8 @@ # define GOOGLE_PROTOBUF_HAS_CXX11_HASH # define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare # elif _MSC_VER >= 1500 // Since Visual Studio 2008 -# define GOOGLE_PROTOBUF_HAS_TR1 -# define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare +# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP +# undef GOOGLE_PROTOBUF_HAVE_HASH_SET # elif _MSC_VER >= 1310 # define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext # include <hash_map> @@ -143,20 +143,10 @@ # define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set #endif -#ifndef GOOGLE_PROTOBUF_HASH_NAMESPACE -# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START -# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END -#elif !defined(GOOGLE_PROTOBUF_HAS_CXX11_HASH) && \ - defined(GOOGLE_PROTOBUF_HAS_TR1) -# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \ - namespace std { \ - namespace tr1 { +# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \ + namespace google { \ + namespace protobuf { # define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END }} -#else -# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \ - namespace GOOGLE_PROTOBUF_HASH_NAMESPACE { -# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END } -#endif #undef GOOGLE_PROTOBUF_HAS_CXX11_HASH #undef GOOGLE_PROTOBUF_HAS_TR1 diff --git a/src/google/protobuf/stubs/int128.h b/src/google/protobuf/stubs/int128.h index 1e63037f..1499bb76 100644 --- a/src/google/protobuf/stubs/int128.h +++ b/src/google/protobuf/stubs/int128.h @@ -48,7 +48,7 @@ struct uint128_pod; #endif // An unsigned 128-bit integer type. Thread-compatible. -class uint128 { +class LIBPROTOBUF_EXPORT uint128 { public: UINT128_CONSTEXPR uint128(); // Sets to 0, but don't trust on this behavior. UINT128_CONSTEXPR uint128(uint64 top, uint64 bottom); @@ -84,7 +84,8 @@ class uint128 { friend uint64 Uint128High64(const uint128& v); // We add "std::" to avoid including all of port.h. - friend std::ostream& operator<<(std::ostream& o, const uint128& b); + LIBPROTOBUF_EXPORT friend std::ostream& operator<<(std::ostream& o, + const uint128& b); private: static void DivModImpl(uint128 dividend, uint128 divisor, @@ -115,10 +116,11 @@ struct uint128_pod { uint64 lo; }; -extern const uint128_pod kuint128max; +LIBPROTOBUF_EXPORT extern const uint128_pod kuint128max; // allow uint128 to be logged -extern std::ostream& operator<<(std::ostream& o, const uint128& b); +LIBPROTOBUF_EXPORT extern std::ostream& operator<<(std::ostream& o, + const uint128& b); // Methods to access low and high pieces of 128-bit value. // Defined externally from uint128 to facilitate conversion diff --git a/src/google/protobuf/stubs/mathutil.h b/src/google/protobuf/stubs/mathutil.h index 99c4d452..3a1ef8a8 100644 --- a/src/google/protobuf/stubs/mathutil.h +++ b/src/google/protobuf/stubs/mathutil.h @@ -45,9 +45,21 @@ bool IsNan(T value) { return false; } template<> -inline bool IsNan(float value) { return isnan(value); } +inline bool IsNan(float value) { +#ifdef _MSC_VER + return _isnan(value); +#else + return isnan(value); +#endif +} template<> -inline bool IsNan(double value) { return isnan(value); } +inline bool IsNan(double value) { +#ifdef _MSC_VER + return _isnan(value); +#else + return isnan(value); +#endif +} template<typename T> bool AlmostEquals(T a, T b) { diff --git a/src/google/protobuf/stubs/status.cc b/src/google/protobuf/stubs/status.cc index 7314c563..dd1bd614 100644 --- a/src/google/protobuf/stubs/status.cc +++ b/src/google/protobuf/stubs/status.cc @@ -30,7 +30,6 @@ #include <google/protobuf/stubs/status.h> #include <ostream> -#include <stdint.h> #include <stdio.h> #include <string> #include <utility> diff --git a/src/google/protobuf/util/internal/datapiece.h b/src/google/protobuf/util/internal/datapiece.h index 30947252..2ab3fa88 100644 --- a/src/google/protobuf/util/internal/datapiece.h +++ b/src/google/protobuf/util/internal/datapiece.h @@ -193,13 +193,13 @@ class LIBPROTOBUF_EXPORT DataPiece { // Stored piece of data. union { - const int32 i32_; - const int64 i64_; - const uint32 u32_; - const uint64 u64_; - const double double_; - const float float_; - const bool bool_; + int32 i32_; + int64 i64_; + uint32 u32_; + uint64 u64_; + double double_; + float float_; + bool bool_; StringPiecePod str_; }; }; diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.h b/src/google/protobuf/util/internal/default_value_objectwriter.h index 2468c8d9..d4547601 100644 --- a/src/google/protobuf/util/internal/default_value_objectwriter.h +++ b/src/google/protobuf/util/internal/default_value_objectwriter.h @@ -57,7 +57,7 @@ namespace converter { // ObjectWriter when EndObject() is called on the root object. It also writes // out all non-repeated primitive fields that haven't been explicitly rendered // with their default values (0 for numbers, "" for strings, etc). -class DefaultValueObjectWriter : public ObjectWriter { +class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter { public: DefaultValueObjectWriter(TypeResolver* type_resolver, const google::protobuf::Type& type, diff --git a/src/google/protobuf/util/internal/json_objectwriter.cc b/src/google/protobuf/util/internal/json_objectwriter.cc index d88a81f9..f81e3306 100644 --- a/src/google/protobuf/util/internal/json_objectwriter.cc +++ b/src/google/protobuf/util/internal/json_objectwriter.cc @@ -37,6 +37,7 @@ #include <google/protobuf/stubs/common.h> #include <google/protobuf/util/internal/utility.h> #include <google/protobuf/util/internal/json_escaping.h> +#include <google/protobuf/stubs/mathlimits.h> #include <google/protobuf/stubs/strutil.h> namespace google { @@ -115,7 +116,9 @@ JsonObjectWriter* JsonObjectWriter::RenderUint64(StringPiece name, JsonObjectWriter* JsonObjectWriter::RenderDouble(StringPiece name, double value) { - if (isfinite(value)) return RenderSimple(name, SimpleDtoa(value)); + if (google::protobuf::MathLimits<double>::IsFinite(value)) { + return RenderSimple(name, SimpleDtoa(value)); + } // Render quoted with NaN/Infinity-aware DoubleAsString. return RenderString(name, DoubleAsString(value)); @@ -123,7 +126,9 @@ JsonObjectWriter* JsonObjectWriter::RenderDouble(StringPiece name, JsonObjectWriter* JsonObjectWriter::RenderFloat(StringPiece name, float value) { - if (isfinite(value)) return RenderSimple(name, SimpleFtoa(value)); + if (google::protobuf::MathLimits<float>::IsFinite(value)) { + return RenderSimple(name, SimpleFtoa(value)); + } // Render quoted with NaN/Infinity-aware FloatAsString. return RenderString(name, FloatAsString(value)); diff --git a/src/google/protobuf/util/internal/type_info.h b/src/google/protobuf/util/internal/type_info.h index e394e8cf..d8133176 100644 --- a/src/google/protobuf/util/internal/type_info.h +++ b/src/google/protobuf/util/internal/type_info.h @@ -44,7 +44,7 @@ namespace util { namespace converter { // Internal helper class for type resolving. Note that this class is not // thread-safe and should only be accessed in one thread. -class TypeInfo { +class LIBPROTOBUF_EXPORT TypeInfo { public: TypeInfo() {} virtual ~TypeInfo() {} diff --git a/src/google/protobuf/util/internal/utility.cc b/src/google/protobuf/util/internal/utility.cc index 9d80fa08..5d7dcc87 100644 --- a/src/google/protobuf/util/internal/utility.cc +++ b/src/google/protobuf/util/internal/utility.cc @@ -307,7 +307,7 @@ string DoubleAsString(double value) { } string FloatAsString(float value) { - if (isfinite(value)) return SimpleFtoa(value); + if (google::protobuf::MathLimits<float>::IsFinite(value)) return SimpleFtoa(value); return DoubleAsString(value); } diff --git a/src/google/protobuf/util/json_util.h b/src/google/protobuf/util/json_util.h index 614564cc..1718bfb5 100644 --- a/src/google/protobuf/util/json_util.h +++ b/src/google/protobuf/util/json_util.h @@ -80,7 +80,7 @@ inline util::Status BinaryToJsonStream( JsonOptions()); } -util::Status BinaryToJsonString( +LIBPROTOBUF_EXPORT util::Status BinaryToJsonString( TypeResolver* resolver, const string& type_url, const string& binary_input, @@ -107,7 +107,7 @@ util::Status JsonToBinaryStream( io::ZeroCopyInputStream* json_input, io::ZeroCopyOutputStream* binary_output); -util::Status JsonToBinaryString( +LIBPROTOBUF_EXPORT util::Status JsonToBinaryString( TypeResolver* resolver, const string& type_url, const string& json_input, diff --git a/src/google/protobuf/util/time_util.h b/src/google/protobuf/util/time_util.h index 11268157..58dbf8e6 100644 --- a/src/google/protobuf/util/time_util.h +++ b/src/google/protobuf/util/time_util.h @@ -31,13 +31,17 @@ #ifndef GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ #define GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__ -#include <sys/time.h> - #include <ctime> #include <ostream> #include <string> +#ifdef _MSC_VER +#include <winsock2.h> +#else +#include <sys/time.h> +#endif #include <google/protobuf/duration.pb.h> +#include <google/protobuf/stubs/port.h> #include <google/protobuf/timestamp.pb.h> namespace google { @@ -85,6 +89,9 @@ class LIBPROTOBUF_EXPORT TimeUtil { static string ToString(const Duration& duration); static bool FromString(const string& value, Duration* timestamp); +#ifdef GetCurrentTime +#undef GetCurrentTime // Visual Studio has macro GetCurrentTime +#endif // Gets the current UTC time. static Timestamp GetCurrentTime(); // Returns the Time representing "1970-01-01 00:00:00". @@ -153,12 +160,12 @@ namespace protobuf { // Overloaded operators for Duration. // // Assignment operators. -Duration& operator+=(Duration& d1, const Duration& d2); // NOLINT -Duration& operator-=(Duration& d1, const Duration& d2); // NOLINT -Duration& operator*=(Duration& d, int64 r); // NOLINT -Duration& operator*=(Duration& d, double r); // NOLINT -Duration& operator/=(Duration& d, int64 r); // NOLINT -Duration& operator/=(Duration& d, double r); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator+=(Duration& d1, const Duration& d2); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator-=(Duration& d1, const Duration& d2); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator*=(Duration& d, int64 r); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator*=(Duration& d, double r); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator/=(Duration& d, int64 r); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator/=(Duration& d, double r); // NOLINT // Overload for other integer types. template <typename T> Duration& operator*=(Duration& d, T r) { // NOLINT @@ -170,7 +177,7 @@ Duration& operator/=(Duration& d, T r) { // NOLINT int64 x = r; return d /= x; } -Duration& operator%=(Duration& d1, const Duration& d2); // NOLINT +LIBPROTOBUF_EXPORT Duration& operator%=(Duration& d1, const Duration& d2); // NOLINT // Relational operators. inline bool operator<(const Duration& d1, const Duration& d2) { if (d1.seconds() == d2.seconds()) { @@ -221,7 +228,7 @@ template<typename T> inline Duration operator/(Duration d, T r) { return d /= r; } -int64 operator/(const Duration& d1, const Duration& d2); +LIBPROTOBUF_EXPORT int64 operator/(const Duration& d1, const Duration& d2); inline Duration operator%(const Duration& d1, const Duration& d2) { Duration result = d1; @@ -236,7 +243,9 @@ inline ostream& operator<<(ostream& out, const Duration& d) { // Overloaded operators for Timestamp // // Assignement operators. +LIBPROTOBUF_EXPORT Timestamp& operator+=(Timestamp& t, const Duration& d); // NOLINT +LIBPROTOBUF_EXPORT Timestamp& operator-=(Timestamp& t, const Duration& d); // NOLINT // Relational operators. inline bool operator<(const Timestamp& t1, const Timestamp& t2) { @@ -273,7 +282,7 @@ inline Timestamp operator-(const Timestamp& t, const Duration& d) { Timestamp result = t; return result -= d; } -Duration operator-(const Timestamp& t1, const Timestamp& t2); +LIBPROTOBUF_EXPORT Duration operator-(const Timestamp& t1, const Timestamp& t2); inline ostream& operator<<(ostream& out, const Timestamp& t) { out << google::protobuf::util::TimeUtil::ToString(t); diff --git a/src/google/protobuf/util/type_resolver_util.h b/src/google/protobuf/util/type_resolver_util.h index 00cf9c13..c0ef3c1a 100644 --- a/src/google/protobuf/util/type_resolver_util.h +++ b/src/google/protobuf/util/type_resolver_util.h @@ -42,7 +42,7 @@ class TypeResolver; // Creates a TypeResolver that serves type information in the given descriptor // pool. Caller takes ownership of the returned TypeResolver. -TypeResolver* NewTypeResolverForDescriptorPool( +LIBPROTOBUF_EXPORT TypeResolver* NewTypeResolverForDescriptorPool( const string& url_prefix, const DescriptorPool* pool); } // namespace util |