aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2015-08-23 10:45:14 -0700
committerGravatar Bo Yang <teboring@google.com>2015-08-25 17:58:48 -0700
commitff7bdad231d037802fd457ee4fd65e0291d366d7 (patch)
tree12f437b32201cdbbfade6d63193e15483640716d /src/google/protobuf/stubs
parent839b180dbae98adf6caa54d0fb87b8d0a43081dc (diff)
Fix bugs on windows
Diffstat (limited to 'src/google/protobuf/stubs')
-rwxr-xr-xsrc/google/protobuf/stubs/hash.h20
-rw-r--r--src/google/protobuf/stubs/int128.h10
-rw-r--r--src/google/protobuf/stubs/mathutil.h16
-rw-r--r--src/google/protobuf/stubs/status.cc1
4 files changed, 25 insertions, 22 deletions
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>