diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-18 16:03:59 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-18 16:03:59 +0000 |
commit | e61a86cfa00ea393ecc4a71fca94e1d476a37ecc (patch) | |
tree | f6ec6c793f279f8226ea40283e707cf3c716e12b /src/core/SkString.cpp | |
parent | 8bf4c0ab7b4acd25566459fc464027c5760d0e5e (diff) |
Guard against most unintentionally ephemeral SkAutoFoo instantiations.
I think I applied the trick everywhere possible. Limitations:
- can't be used with templated classes
- all constructors and destructors must be defined inline
A couple of the SkAutoFoo were unused in Skia, Chromium, and Android, so I
deleted them. This change caught the same bugs Cary found in SkPath, plus one
more in SampleApp.
BUG=
R=reed@google.com, caryclark@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/72603005
git-svn-id: http://skia.googlecode.com/svn/trunk@12301 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkString.cpp')
-rw-r--r-- | src/core/SkString.cpp | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp index 4e5e204e8c..7b3c265314 100644 --- a/src/core/SkString.cpp +++ b/src/core/SkString.cpp @@ -626,27 +626,6 @@ void SkString::swap(SkString& other) { /////////////////////////////////////////////////////////////////////////////// -SkAutoUCS2::SkAutoUCS2(const char utf8[]) { - size_t len = strlen(utf8); - fUCS2 = (uint16_t*)sk_malloc_throw((len + 1) * sizeof(uint16_t)); - - uint16_t* dst = fUCS2; - for (;;) { - SkUnichar uni = SkUTF8_NextUnichar(&utf8); - *dst++ = SkToU16(uni); - if (uni == 0) { - break; - } - } - fCount = (int)(dst - fUCS2); -} - -SkAutoUCS2::~SkAutoUCS2() { - sk_free(fUCS2); -} - -/////////////////////////////////////////////////////////////////////////////// - SkString SkStringPrintf(const char* format, ...) { SkString formattedOutput; char buffer[kBufferSize]; |