From b122db09537fa40dd0af76ab1120b06aa143328c Mon Sep 17 00:00:00 2001 From: Moazin Khatti Date: Fri, 9 Aug 2019 18:03:41 +0500 Subject: [PATCH] Fix TODOs. --- include/freetype/svgrender.h | 2 -- src/base/ftglyph.c | 1 - src/sfnt/ttsvg.c | 18 ++++++++---------- src/svg/svgtypes.c | 1 - 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/include/freetype/svgrender.h b/include/freetype/svgrender.h index 4c883580a..ecbc3ee0c 100644 --- a/include/freetype/svgrender.h +++ b/include/freetype/svgrender.h @@ -167,8 +167,6 @@ FT_BEGIN_HEADER FT_UShort units_per_EM; FT_UShort start_glyph_id; FT_UShort end_glyph_id; - /* TODO: (OT-SVG) Not storing glyph_index here for now. Might need to - * at some point. Review this! */ } FT_SVG_DocumentRec; /************************************************************************** diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 93795c89f..0c283928d 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -395,7 +395,6 @@ FT_SVG_Document document; - /* TODO: (OT-SVG) this probably creates a memory leak. Fix it */ if ( FT_NEW( document ) ) return error; diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c index 94d176062..41b0c4c1f 100644 --- a/src/sfnt/ttsvg.c +++ b/src/sfnt/ttsvg.c @@ -35,7 +35,6 @@ #include "ttsvg.h" - /* TODO: (OT-SVG) Decide whether to add documentation here or not */ typedef struct Svg_ { @@ -253,9 +252,6 @@ tt_face_load_svg_doc( FT_GlyphSlot glyph, FT_UInt glyph_index ) { - - /* TODO: (OT-SVG) properly clean stuff here on errors */ - FT_Byte* doc_list; /* Pointer to the Svg Document List */ FT_UShort num_entries; /* Total no of entires in doc list */ @@ -274,7 +270,8 @@ FT_SVG_Document svg_document = glyph->other; - /* handle svg being 0x0 situation here */ + FT_ASSERT( !( svg == NULL ) ); + doc_list = svg->svg_doc_list; num_entries = FT_NEXT_USHORT( doc_list ); @@ -282,7 +279,7 @@ &doc_offset, &doc_length, &start_glyph_id, &end_glyph_id ); if ( error != FT_Err_Ok ) - return error; + goto Exit; doc_list = svg->svg_doc_list; /* Reset to so we can use it again */ doc_list = (FT_Byte*)( doc_list + doc_offset ); @@ -302,16 +299,16 @@ (FT_ULong)doc_list[doc_length - 3] << 8 | (FT_ULong)doc_list[doc_length - 4]; - uncomp_buffer = (FT_Byte*) memory->alloc(memory, uncomp_size); - glyph->internal->flags |= FT_GLYPH_OWN_GZIP_SVG; + uncomp_buffer = (FT_Byte*) memory->alloc( memory, uncomp_size ); error = FT_Gzip_Uncompress( memory, uncomp_buffer, &uncomp_size, doc_list, doc_length ); if ( error != FT_Err_Ok ) { + memory->free( memory, uncomp_buffer ); error = FT_THROW( Invalid_Table ); - return error; + goto Exit; } - + glyph->internal->flags |= FT_GLYPH_OWN_GZIP_SVG; doc_list = uncomp_buffer; doc_length = uncomp_size; } @@ -329,6 +326,7 @@ glyph->other = svg_document; +Exit: return FT_Err_Ok; } diff --git a/src/svg/svgtypes.c b/src/svg/svgtypes.c index f7008f330..7acfcea28 100644 --- a/src/svg/svgtypes.c +++ b/src/svg/svgtypes.c @@ -2,7 +2,6 @@ * * svgtypes.h * - * TODO: * The FreeType svg renderer internal types (specification). * * Copyright (C) 1996-2019 by