OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkString.h" | 10 #include "SkString.h" |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 other.validate(); | 619 other.validate(); |
620 | 620 |
621 SkTSwap<Rec*>(fRec, other.fRec); | 621 SkTSwap<Rec*>(fRec, other.fRec); |
622 #ifdef SK_DEBUG | 622 #ifdef SK_DEBUG |
623 SkTSwap<const char*>(fStr, other.fStr); | 623 SkTSwap<const char*>(fStr, other.fStr); |
624 #endif | 624 #endif |
625 } | 625 } |
626 | 626 |
627 /////////////////////////////////////////////////////////////////////////////// | 627 /////////////////////////////////////////////////////////////////////////////// |
628 | 628 |
629 SkAutoUCS2::SkAutoUCS2(const char utf8[]) { | |
630 size_t len = strlen(utf8); | |
631 fUCS2 = (uint16_t*)sk_malloc_throw((len + 1) * sizeof(uint16_t)); | |
632 | |
633 uint16_t* dst = fUCS2; | |
634 for (;;) { | |
635 SkUnichar uni = SkUTF8_NextUnichar(&utf8); | |
636 *dst++ = SkToU16(uni); | |
637 if (uni == 0) { | |
638 break; | |
639 } | |
640 } | |
641 fCount = (int)(dst - fUCS2); | |
642 } | |
643 | |
644 SkAutoUCS2::~SkAutoUCS2() { | |
645 sk_free(fUCS2); | |
646 } | |
647 | |
648 /////////////////////////////////////////////////////////////////////////////// | |
649 | |
650 SkString SkStringPrintf(const char* format, ...) { | 629 SkString SkStringPrintf(const char* format, ...) { |
651 SkString formattedOutput; | 630 SkString formattedOutput; |
652 char buffer[kBufferSize]; | 631 char buffer[kBufferSize]; |
653 ARGS_TO_BUFFER(format, buffer, kBufferSize); | 632 ARGS_TO_BUFFER(format, buffer, kBufferSize); |
654 formattedOutput.set(buffer); | 633 formattedOutput.set(buffer); |
655 return formattedOutput; | 634 return formattedOutput; |
656 } | 635 } |
657 | 636 |
658 #undef VSNPRINTF | 637 #undef VSNPRINTF |
659 #undef SNPRINTF | 638 #undef SNPRINTF |
OLD | NEW |