@@ 111,22 111,22 @@ namespace core { namespace json {
void Reader::read_and_buffer_encoded_char() {
read_next_char();
- if (_char == 'u') {
+ if (_char == L'u') {
read_and_buffer_hex();
return;
}
- if (_char == '"' || _char == '\\' || _char == '/') {
+ if (_char == L'"' || _char == L'\\' || _char == L'/') {
- } else if (_char == 'b') {
+ } else if (_char == L'b') {
_char = 8;
- } else if (_char == 'f') {
+ } else if (_char == L'f') {
_char = 12;
- } else if (_char == 'n') {
+ } else if (_char == L'n') {
_char = 10;
- } else if (_char == 'r') {
+ } else if (_char == L'r') {
_char = 13;
- } else if (_char == 't') {
+ } else if (_char == L't') {
_char = 9;
} else {
generate_parse_error("Invalid character following \\ in a string.");
@@ 173,8 173,7 @@ namespace core { namespace json {
}
void Reader::buffer_wide_character(uint32_t wide_char) {
- static_assert(sizeof(uint32_t) == sizeof(wchar_t), "Wide character is assumed to be 32-bit");
- _char = wide_char;
+ _char = static_cast<wchar_t>(wide_char);
buffer_character();
}
@@ 195,8 194,8 @@ namespace core { namespace json {
while(true) {
read_next_char();
if (is_digit()) {
- number = number * 10 + (_char - '0');
- } else if (_char == 'e' || _char == '.') {
+ number = number * 10 + (_char - L'0');
+ } else if (_char == L'e' || _char == L'.') {
unread_char();
parse_float = true;
break;
@@ 224,7 223,7 @@ namespace core { namespace json {
void Reader::parse_decimal(int32_t integer, bool negative, float &number) {
read_next_char();
- if (_char == 'e') {
+ if (_char == L'e') {
float exponent = 0.0f;
parse_exponent(exponent);
number = static_cast<float>(integer) * powf(10.0f, exponent);
@@ 237,8 236,8 @@ namespace core { namespace json {
while(true) {
read_next_char();
if (is_digit()) {
- decimals += multiplier * (_char - '0');
- } else if (_char == 'e') {
+ decimals += multiplier * (_char - L'0');
+ } else if (_char == L'e') {
float exponent = 0.0f;
parse_exponent(exponent);
@@ 284,7 283,7 @@ namespace core { namespace json {
bool Reader::is_negative_number() {
peek_next_char();
- if (_char == '-') {
+ if (_char == L'-') {
read_next_char();
return true;
}