Fix gcc C++11 build

pull/674/head
Nobuaki Sukegawa 9 years ago
parent bfbf35da9e
commit 992531723c
  1. 2
      src/google/protobuf/util/field_comparator_test.cc
  2. 11
      src/google/protobuf/util/internal/utility.cc

@ -34,8 +34,8 @@
#include <google/protobuf/unittest.pb.h> #include <google/protobuf/unittest.pb.h>
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <gtest/gtest.h>
#include <google/protobuf/stubs/mathutil.h> #include <google/protobuf/stubs/mathutil.h>
#include <gtest/gtest.h>
namespace google { namespace google {
namespace protobuf { namespace protobuf {

@ -30,10 +30,6 @@
#include <google/protobuf/util/internal/utility.h> #include <google/protobuf/util/internal/utility.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/common.h>
#include <google/protobuf/wrappers.pb.h> #include <google/protobuf/wrappers.pb.h>
#include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.pb.h>
@ -301,8 +297,8 @@ bool IsMap(const google::protobuf::Field& field,
} }
string DoubleAsString(double value) { string DoubleAsString(double value) {
if (value == std::numeric_limits<double>::infinity()) return "Infinity"; if (google::protobuf::MathLimits<double>::IsPosInf(value)) return "Infinity";
if (value == -std::numeric_limits<double>::infinity()) return "-Infinity"; if (google::protobuf::MathLimits<double>::IsNegInf(value)) return "-Infinity";
if (google::protobuf::MathLimits<double>::IsNaN(value)) return "NaN"; if (google::protobuf::MathLimits<double>::IsNaN(value)) return "NaN";
return SimpleDtoa(value); return SimpleDtoa(value);
@ -320,8 +316,7 @@ bool SafeStrToFloat(StringPiece str, float *value) {
} }
*value = static_cast<float>(double_value); *value = static_cast<float>(double_value);
if ((*value == numeric_limits<float>::infinity()) || if (google::protobuf::MathLimits<float>::IsInf(*value)) {
(*value == -numeric_limits<float>::infinity())) {
return false; return false;
} }
return true; return true;

Loading…
Cancel
Save