OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkJSON.h" | 8 #include "SkJSON.h" |
9 #include "SkString.h" | 9 #include "SkString.h" |
10 | 10 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 case kInt: | 407 case kInt: |
408 SkDebugf("%d", slot->fValue.fInt); | 408 SkDebugf("%d", slot->fValue.fInt); |
409 break; | 409 break; |
410 case kFloat: | 410 case kFloat: |
411 SkDebugf("%g", slot->fValue.fFloat); | 411 SkDebugf("%g", slot->fValue.fFloat); |
412 break; | 412 break; |
413 case kBool: | 413 case kBool: |
414 SkDebugf("%s", slot->fValue.fBool ? "true" : "false"); | 414 SkDebugf("%s", slot->fValue.fBool ? "true" : "false"); |
415 break; | 415 break; |
416 default: | 416 default: |
417 SkASSERT(!"how did I get here"); | 417 SkDEBUGFAIL("how did I get here"); |
418 break; | 418 break; |
419 } | 419 } |
420 if (slot->fNext) { | 420 if (slot->fNext) { |
421 SkDebugf(","); | 421 SkDebugf(","); |
422 } | 422 } |
423 SkDebugf("\n"); | 423 SkDebugf("\n"); |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 void SkJSON::Array::dumpLevel(int level) const { | 427 void SkJSON::Array::dumpLevel(int level) const { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 483 } |
484 SkDebugf(" %g ", fArray.fFloats[last]); | 484 SkDebugf(" %g ", fArray.fFloats[last]); |
485 } break; | 485 } break; |
486 case kBool: { | 486 case kBool: { |
487 for (int i = 0; i < last; ++i) { | 487 for (int i = 0; i < last; ++i) { |
488 SkDebugf(" %s,", fArray.fBools[i] ? "true" : "false"); | 488 SkDebugf(" %s,", fArray.fBools[i] ? "true" : "false"); |
489 } | 489 } |
490 SkDebugf(" %s ", fArray.fInts[last] ? "true" : "false"); | 490 SkDebugf(" %s ", fArray.fInts[last] ? "true" : "false"); |
491 } break; | 491 } break; |
492 default: | 492 default: |
493 SkASSERT(!"unsupported array type"); | 493 SkDEBUGFAIL("unsupported array type"); |
494 break; | 494 break; |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 /////////////////////////////////////////////////////////////////////////////// | 498 /////////////////////////////////////////////////////////////////////////////// |
499 | 499 |
500 static const uint8_t gBytesPerType[] = { | 500 static const uint8_t gBytesPerType[] = { |
501 sizeof(SkJSON::Object*), | 501 sizeof(SkJSON::Object*), |
502 sizeof(SkJSON::Array*), | 502 sizeof(SkJSON::Array*), |
503 sizeof(char*), | 503 sizeof(char*), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 625 } |
626 | 626 |
627 void SkJSON::Array::setString(int index, const char str[]) { | 627 void SkJSON::Array::setString(int index, const char str[]) { |
628 SkASSERT((unsigned)index < (unsigned)fCount); | 628 SkASSERT((unsigned)index < (unsigned)fCount); |
629 char*& prev = fArray.fStrings[index]; | 629 char*& prev = fArray.fStrings[index]; |
630 if (prev != str) { | 630 if (prev != str) { |
631 free_string(prev); | 631 free_string(prev); |
632 prev = dup_string(str); | 632 prev = dup_string(str); |
633 } | 633 } |
634 } | 634 } |
OLD | NEW |