diff options
author | Bo Yang <teboring@google.com> | 2015-08-23 10:45:14 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2015-08-25 17:58:48 -0700 |
commit | ff7bdad231d037802fd457ee4fd65e0291d366d7 (patch) | |
tree | 12f437b32201cdbbfade6d63193e15483640716d /src/google/protobuf/util/internal | |
parent | 839b180dbae98adf6caa54d0fb87b8d0a43081dc (diff) |
Fix bugs on windows
Diffstat (limited to 'src/google/protobuf/util/internal')
5 files changed, 17 insertions, 12 deletions
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 2d63de00..d4ac6f77 100644 --- a/src/google/protobuf/util/internal/utility.cc +++ b/src/google/protobuf/util/internal/utility.cc @@ -311,7 +311,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); } |