Index: base/json/string_escape.cc |
diff --git a/base/json/string_escape.cc b/base/json/string_escape.cc |
index 3221a3c022029c8ed7f81bbf4e0403758a8c83ee..28b3ec6260074cce9a1abdf3c6a5da77f2a0b684 100644 |
--- a/base/json/string_escape.cc |
+++ b/base/json/string_escape.cc |
@@ -4,6 +4,9 @@ |
#include "base/json/string_escape.h" |
+#include <stdint.h> |
+ |
+#include <limits> |
#include <string> |
#include "base/strings/string_util.h" |
@@ -20,7 +23,7 @@ namespace { |
const char kU16EscapeFormat[] = "\\u%04X"; |
// The code point to output for an invalid input code unit. |
-const uint32 kReplacementCodePoint = 0xFFFD; |
+const uint32_t kReplacementCodePoint = 0xFFFD; |
// Used below in EscapeSpecialCodePoint(). |
static_assert('<' == 0x3C, "less than sign must be 0x3c"); |
@@ -28,7 +31,7 @@ static_assert('<' == 0x3C, "less than sign must be 0x3c"); |
// Try to escape the |code_point| if it is a known special character. If |
// successful, returns true and appends the escape sequence to |dest|. This |
// isn't required by the spec, but it's more readable by humans. |
-bool EscapeSpecialCodePoint(uint32 code_point, std::string* dest) { |
+bool EscapeSpecialCodePoint(uint32_t code_point, std::string* dest) { |
// WARNING: if you add a new case here, you need to update the reader as well. |
// Note: \v is in the reader, but not here since the JSON spec doesn't |
// allow it. |
@@ -80,12 +83,13 @@ bool EscapeJSONStringImpl(const S& str, bool put_in_quotes, std::string* dest) { |
if (put_in_quotes) |
dest->push_back('"'); |
- // Casting is necessary because ICU uses int32. Try and do so safely. |
- CHECK_LE(str.length(), static_cast<size_t>(kint32max)); |
- const int32 length = static_cast<int32>(str.length()); |
+ // Casting is necessary because ICU uses int32_t. Try and do so safely. |
+ CHECK_LE(str.length(), |
+ static_cast<size_t>(std::numeric_limits<int32_t>::max())); |
+ const int32_t length = static_cast<int32_t>(str.length()); |
- for (int32 i = 0; i < length; ++i) { |
- uint32 code_point; |
+ for (int32_t i = 0; i < length; ++i) { |
+ uint32_t code_point; |
if (!ReadUnicodeCharacter(str.data(), length, &i, &code_point)) { |
code_point = kReplacementCodePoint; |
did_replacement = true; |