From 992531723cad417b4035d54dbca598d19868b69a Mon Sep 17 00:00:00 2001 From: Nobuaki Sukegawa Date: Sat, 1 Aug 2015 12:37:49 +0900 Subject: [PATCH] Fix gcc C++11 build --- src/google/protobuf/util/field_comparator_test.cc | 2 +- src/google/protobuf/util/internal/utility.cc | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/google/protobuf/util/field_comparator_test.cc b/src/google/protobuf/util/field_comparator_test.cc index 748c7d11c8..845839acdf 100644 --- a/src/google/protobuf/util/field_comparator_test.cc +++ b/src/google/protobuf/util/field_comparator_test.cc @@ -34,8 +34,8 @@ #include #include -#include #include +#include namespace google { namespace protobuf { diff --git a/src/google/protobuf/util/internal/utility.cc b/src/google/protobuf/util/internal/utility.cc index 794777d44d..dfc4add292 100644 --- a/src/google/protobuf/util/internal/utility.cc +++ b/src/google/protobuf/util/internal/utility.cc @@ -30,10 +30,6 @@ #include -#include -#include -#include - #include #include #include @@ -301,8 +297,8 @@ bool IsMap(const google::protobuf::Field& field, } string DoubleAsString(double value) { - if (value == std::numeric_limits::infinity()) return "Infinity"; - if (value == -std::numeric_limits::infinity()) return "-Infinity"; + if (google::protobuf::MathLimits::IsPosInf(value)) return "Infinity"; + if (google::protobuf::MathLimits::IsNegInf(value)) return "-Infinity"; if (google::protobuf::MathLimits::IsNaN(value)) return "NaN"; return SimpleDtoa(value); @@ -320,8 +316,7 @@ bool SafeStrToFloat(StringPiece str, float *value) { } *value = static_cast(double_value); - if ((*value == numeric_limits::infinity()) || - (*value == -numeric_limits::infinity())) { + if (google::protobuf::MathLimits::IsInf(*value)) { return false; } return true;