diff options
Diffstat (limited to 'base/json/json_writer.cc')
-rw-r--r-- | base/json/json_writer.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/base/json/json_writer.cc b/base/json/json_writer.cc index abfead8007..19bc0da972 100644 --- a/base/json/json_writer.cc +++ b/base/json/json_writer.cc @@ -4,13 +4,17 @@ #include "base/json/json_writer.h" +#include <stdint.h> + #include <cmath> +#include <limits> #include "base/json/string_escape.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "build/build_config.h" namespace base { @@ -79,10 +83,10 @@ bool JSONWriter::BuildJSONString(const Value& node, size_t depth) { bool result = node.GetAsDouble(&value); DCHECK(result); if (omit_double_type_preservation_ && - value <= kint64max && - value >= kint64min && + value <= std::numeric_limits<int64_t>::max() && + value >= std::numeric_limits<int64_t>::min() && std::floor(value) == value) { - json_string_->append(Int64ToString(static_cast<int64>(value))); + json_string_->append(Int64ToString(static_cast<int64_t>(value))); return result; } std::string real = DoubleToString(value); |