X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/samples/layout/paragraph.cpp?ds=inline diff --git a/icuSources/samples/layout/paragraph.cpp b/icuSources/samples/layout/paragraph.cpp index 315ca04a..9a92b587 100644 --- a/icuSources/samples/layout/paragraph.cpp +++ b/icuSources/samples/layout/paragraph.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 1999-2005, International Business Machines + * Copyright (C) 1999-2015, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -19,11 +19,9 @@ #include "layout/ParagraphLayout.h" #include "RenderingSurface.h" -#include "ScriptCompositeFontInstance.h" #include "paragraph.h" #include "UnicodeReader.h" -#include "FontMap.h" #define MARGIN 10 #define LINE_GROW 32 @@ -80,7 +78,7 @@ Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns fLineCount(0), fLinesMax(LINE_GROW), fLinesGrow(LINE_GROW), fLines(NULL), fChars(NULL), fLineHeight(-1), fAscent(-1), fWidth(-1), fHeight(-1), fParagraphLevel(UBIDI_DEFAULT_LTR) { - static const LEUnicode separators[] = {CH_LF, CH_CR, CH_LSEP, CH_PSEP}; + static const LEUnicode separators[] = {CH_LF, CH_CR, CH_LSEP, CH_PSEP, 0x0000}; if (LE_FAILURE(status)) { return; @@ -117,6 +115,7 @@ Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns paragraphLayout = new ParagraphLayout(pStart, pEnd - pStart, &fr, NULL, NULL, locales, fParagraphLevel, FALSE, status); if (LE_FAILURE(status)) { + delete paragraphLayout; break; // return? something else? } @@ -165,8 +164,12 @@ Paragraph::~Paragraph() delete /*(LineInfo *)*/ fLines[line]; } + for (le_int32 paragraph = 0; paragraph < fParagraphCount; paragraph += 1) { + delete fParagraphLayout[paragraph]; + } + LE_DELETE_ARRAY(fLines); - delete fParagraphLayout; + LE_DELETE_ARRAY(fParagraphLayout); LE_DELETE_ARRAY(fChars); }