freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] GSoC-2019-moazin 62e8e1f 2/2: Fix TODOs.


From: Moazin Khatti
Subject: [freetype2] GSoC-2019-moazin 62e8e1f 2/2: Fix TODOs.
Date: Fri, 9 Aug 2019 09:18:52 -0400 (EDT)

branch: GSoC-2019-moazin
commit 62e8e1f2a82bcbe8cc25aa732bee7443482a0f82
Author: Moazin Khatti <address@hidden>
Commit: Moazin Khatti <address@hidden>

    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 4c88358..ecbc3ee 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 93795c8..0c28392 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 94d1760..41b0c4c 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 f7008f3..7acfcea 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]