OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/json_reader.h" | 5 #include "base/json_reader.h" |
6 | 6 |
7 #include "base/float_util.h" | 7 #include "base/float_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 if (!ReadHexDigits(token, 4)) | 354 if (!ReadHexDigits(token, 4)) |
355 return kInvalidToken; | 355 return kInvalidToken; |
356 break; | 356 break; |
357 case '\\': | 357 case '\\': |
358 case '/': | 358 case '/': |
359 case 'b': | 359 case 'b': |
360 case 'f': | 360 case 'f': |
361 case 'n': | 361 case 'n': |
362 case 'r': | 362 case 'r': |
363 case 't': | 363 case 't': |
| 364 case 'v': |
364 case '"': | 365 case '"': |
365 break; | 366 break; |
366 default: | 367 default: |
367 return kInvalidToken; | 368 return kInvalidToken; |
368 } | 369 } |
369 } else if ('"' == c) { | 370 } else if ('"' == c) { |
370 ++token.length; | 371 ++token.length; |
371 return token; | 372 return token; |
372 } | 373 } |
373 ++token.length; | 374 ++token.length; |
(...skipping 25 matching lines...) Expand all Loading... |
399 break; | 400 break; |
400 case 'n': | 401 case 'n': |
401 decoded_str.push_back('\n'); | 402 decoded_str.push_back('\n'); |
402 break; | 403 break; |
403 case 'r': | 404 case 'r': |
404 decoded_str.push_back('\r'); | 405 decoded_str.push_back('\r'); |
405 break; | 406 break; |
406 case 't': | 407 case 't': |
407 decoded_str.push_back('\t'); | 408 decoded_str.push_back('\t'); |
408 break; | 409 break; |
| 410 case 'v': |
| 411 decoded_str.push_back('\v'); |
| 412 break; |
409 | 413 |
410 case 'x': | 414 case 'x': |
411 decoded_str.push_back((HexToInt(*(token.begin + i + 1)) << 4) + | 415 decoded_str.push_back((HexToInt(*(token.begin + i + 1)) << 4) + |
412 HexToInt(*(token.begin + i + 2))); | 416 HexToInt(*(token.begin + i + 2))); |
413 i += 2; | 417 i += 2; |
414 break; | 418 break; |
415 case 'u': | 419 case 'u': |
416 decoded_str.push_back((HexToInt(*(token.begin + i + 1)) << 12 ) + | 420 decoded_str.push_back((HexToInt(*(token.begin + i + 1)) << 12 ) + |
417 (HexToInt(*(token.begin + i + 2)) << 8) + | 421 (HexToInt(*(token.begin + i + 2)) << 8) + |
418 (HexToInt(*(token.begin + i + 3)) << 4) + | 422 (HexToInt(*(token.begin + i + 3)) << 4) + |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 default: | 575 default: |
572 ++json_pos_; | 576 ++json_pos_; |
573 } | 577 } |
574 } | 578 } |
575 } else { | 579 } else { |
576 return false; | 580 return false; |
577 } | 581 } |
578 return true; | 582 return true; |
579 } | 583 } |
580 | 584 |
OLD | NEW |