Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: src/sfnt/SkOTUtils.cpp

Issue 560653004: SkData can allocate room for its contents in the same block (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox, change fPtr to non const Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | src/utils/SkTextureCompressor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sfnt/SkOTUtils.cpp
diff --git a/src/sfnt/SkOTUtils.cpp b/src/sfnt/SkOTUtils.cpp
index e76d1da08c428a24122fae12185ff9f46bd9ffb7..0e009528b4dcd1aa14f70a22f611cdd684ee3088 100644
--- a/src/sfnt/SkOTUtils.cpp
+++ b/src/sfnt/SkOTUtils.cpp
@@ -83,8 +83,8 @@ SkData* SkOTUtils::RenameFont(SkStream* fontData, const char* fontName, int font
size_t originalDataSize = fontData->getLength() - oldNameTablePhysicalSize;
size_t newDataSize = originalDataSize + nameTablePhysicalSize;
- SK_OT_BYTE* data = static_cast<SK_OT_BYTE*>(sk_malloc_throw(newDataSize));
- SkAutoTUnref<SkData> rewrittenFontData(SkData::NewFromMalloc(data, newDataSize));
+ SkAutoTUnref<SkData> rewrittenFontData(SkData::NewUninitialized(newDataSize));
+ SK_OT_BYTE* data = static_cast<SK_OT_BYTE*>(rewrittenFontData->writable_data());
if (fontData->read(data, oldNameTableOffset) < oldNameTableOffset) {
return NULL;
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | src/utils/SkTextureCompressor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698