patch submitted by alean2...@gmail.com
git-svn-id: http://skia.googlecode.com/svn/trunk@1094
2bbb7eff-a529-9590-31e7-
b0007b416f81
/////////////////////////////////////////////////////////////////////////////////
-SkAutoUCS2::SkAutoUCS2(const char utf8[])
-{
+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);
+ for (;;) {
+ SkUnichar uni = SkUTF8_NextUnichar(&utf8);
*dst++ = SkToU16(uni);
- if (uni == 0)
+ if (uni == 0) {
break;
+ }
}
fCount = (int)(dst - fUCS2);
}
-SkAutoUCS2::~SkAutoUCS2()
-{
- delete[] fUCS2;
+SkAutoUCS2::~SkAutoUCS2() {
+ sk_free(fUCS2);
}