shithub: freetype+ttf2subf

Download patch

ref: baa0f71ddff8497a0e14fce9e3c74db034f3036d
parent: b3438ccb31ba137f5f43c2c6da7be423629292e0
author: Alexei Podtelezhnikov <[email protected]>
date: Fri Apr 23 09:48:34 EDT 2021

[cid] s/FT_ALLOC/FT_QALLOC/ and clean up.

* src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
* src/cid/cidload.c (cid_face_open, cid_read_subrs): Ditto.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2021-04-23  Alexei Podtelezhnikov  <[email protected]>
 
+	[cid] s/FT_ALLOC/FT_QALLOC/ and clean up.
+
+	* src/cid/cidgload.c (cid_load_glyph): Do not zero out the buffer.
+        * src/cid/cidload.c (cid_face_open, cid_read_subrs): Ditto.
+
+2021-04-23  Alexei Podtelezhnikov  <[email protected]>
+
 	[pfr] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
 
 	* src/pfr/pfrload.c (pfr_extra_item_load_font_id, pfr_aux_name_load):
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -85,10 +85,10 @@
       if ( glyph_data.length != 0 )
       {
         glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );
-        (void)FT_ALLOC( charstring, glyph_length );
-        if ( !error )
-          ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
-                     glyph_length );
+
+        if ( !FT_QALLOC( charstring, glyph_length ) )
+          FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
+                       glyph_length );
       }
 
       inc->funcs->free_glyph_data( inc->object, &glyph_data );
@@ -130,11 +130,9 @@
       }
 
       glyph_length = off2 - off1;
-      if ( glyph_length == 0 )
-        goto Exit;
-      if ( FT_ALLOC( charstring, glyph_length ) )
-        goto Exit;
-      if ( FT_STREAM_READ_AT( cid->data_offset + off1,
+
+      if ( FT_QALLOC( charstring, glyph_length )         ||
+           FT_STREAM_READ_AT( cid->data_offset + off1,
                               charstring, glyph_length ) )
         goto Exit;
     }
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -590,7 +590,7 @@
       data_len = offsets[num_subrs] - offsets[0];
 
       if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
-           FT_ALLOC( subr->code[0], data_len )       )
+           FT_QALLOC( subr->code[0], data_len )      )
         goto Fail;
 
       if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
@@ -812,7 +812,7 @@
       }
 
       /* we must convert the data section from hexadecimal to binary */
-      if ( FT_ALLOC( face->binary_data, parser->binary_length )    ||
+      if ( FT_QALLOC( face->binary_data, parser->binary_length )   ||
            FT_SET_ERROR( cid_hex_to_binary( face->binary_data,
                                             parser->binary_length,
                                             parser->data_offset,