From a299dfda6bbcec93b532b7ad3d118a9609fa9b75 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Thu, 19 May 2011 13:52:16 +0100 Subject: Use adoptPtr() and adoptArrayPtr() when setting OwnPtr and OwnArrayPtr We should not be using OwnPtr/OwnArrayPtr::set() - see LOOSE_OWN_PTR and LOOSE_OWN_ARRAY_PTR in OwnPtr.h and OwnArrayPtr.h. LOOSE_OWN_ARRAY_PTR will be removed in http://trac.webkit.org/changeset/77785 so fixing now to avoid later problems. Change-Id: I81552b1bc5e1555a3d46e0db1f9916c68878c751 --- .../WebCore/platform/graphics/android/FontAndroid.cpp | 6 ++++-- .../WebCore/platform/graphics/android/HarfbuzzSkia.cpp | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'Source/WebCore') diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp index 6966e7d..a4fb51b 100644 --- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp @@ -49,6 +49,8 @@ #include #include #include +#include +#include #include #endif @@ -817,12 +819,12 @@ const TextRun& TextRunWalker::getNormalizedTextRun(const TextRun& originalRun, sourceText = normalizedString.getBuffer(); } - normalizedBuffer.set(new UChar[normalizedBufferLength + 1]); + normalizedBuffer = adoptArrayPtr(new UChar[normalizedBufferLength + 1]); normalizeSpacesAndMirrorChars(sourceText, originalRun.rtl(), normalizedBuffer.get(), normalizedBufferLength); - normalizedRun.set(new TextRun(originalRun)); + normalizedRun = adoptPtr(new TextRun(originalRun)); normalizedRun->setText(normalizedBuffer.get(), normalizedBufferLength); return *normalizedRun; } diff --git a/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp b/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp index 81841f2..7c3a6b4 100644 --- a/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp +++ b/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp @@ -27,13 +27,14 @@ #include "config.h" #include "FontPlatformData.h" -#include "wtf/OwnArrayPtr.h" -#include "SkFontHost.h" -#include "SkPaint.h" -#include "SkPath.h" -#include "SkPoint.h" -#include "SkRect.h" +#include +#include +#include +#include +#include +#include +#include extern "C" { #include "harfbuzz-shaper.h" @@ -80,7 +81,7 @@ static void glyphsToAdvances(HB_Font hbFont, const HB_Glyph* glyphs, hb_uint32 n font->setupPaint(&paint); paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); - OwnArrayPtr glyphs16(new uint16_t[numGlyphs]); + OwnArrayPtr glyphs16 = adoptArrayPtr(new uint16_t[numGlyphs]); if (!glyphs16.get()) return; for (unsigned i = 0; i < numGlyphs; ++i) @@ -106,7 +107,7 @@ static HB_Bool canRender(HB_Font hbFont, const HB_UChar16* characters, hb_uint32 font->setupPaint(&paint); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); - OwnArrayPtr glyphs16(new uint16_t[length]); + OwnArrayPtr glyphs16 = adoptArrayPtr(new uint16_t[length]); glyphs16.get(); int numGlyphs = paint.textToGlyphs(characters, length * sizeof(uint16_t), glyphs16.get()); -- cgit v1.1