freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master baa0f71 1/2: [cid] s/FT_ALLOC/FT_QALLOC/ and clean up


From: Werner Lemberg
Subject: [freetype2] master baa0f71 1/2: [cid] s/FT_ALLOC/FT_QALLOC/ and clean up.
Date: Fri, 23 Apr 2021 14:04:11 -0400 (EDT)

branch: master
commit baa0f71ddff8497a0e14fce9e3c74db034f3036d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [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.
---
 ChangeLog          |  7 +++++++
 src/cid/cidgload.c | 16 +++++++---------
 src/cid/cidload.c  |  4 ++--
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ab351d3..60d5d84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2021-04-23  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+       [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  <apodtele@gmail.com>
+
        [pfr] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
 
        * src/pfr/pfrload.c (pfr_extra_item_load_font_id, pfr_aux_name_load):
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 2c5c834..4dd9834 100644
--- 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;
     }
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 3669c7e..f898a0d 100644
--- 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,



reply via email to

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