shithub: freetype+ttf2subf

Download patch

ref: ec95f9c9212e9bf9371471f845903bb0e895807d
parent: d911cb5392bd558642fcd6e85d6224618b8e1421
author: Alexei Podtelezhnikov <apodtele@gmail.com>
date: Sun May 2 14:30:22 EDT 2021

[bdf,pcf] Avoid memory zeroing (contd.).

* src/bdf/bdflib.c (bdf_create_property, _bdf_add_comment,
_bdf_add_property, bdf_load_font): Tweak allocation macros.
* src/pcf/pcfread.c (pcf_get_properties, pcf_get_metrics): Ditto.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-04-25  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[bdf,pcf] Avoid memory zeroing (contd.).
+
+	* src/bdf/bdflib.c (bdf_create_property, _bdf_add_comment,
+	_bdf_add_property, bdf_load_font): Tweak allocation macros.
+	* src/pcf/pcfread.c (pcf_get_properties, pcf_get_metrics): Ditto.
+
 2021-05-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
 	* src/cid/cidload.c (cid_read_subrs): Tweak allocaton macro.
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -844,9 +844,9 @@
     if ( ft_hash_str_lookup( name, &(font->proptbl) ) )
       goto Exit;
 
-    if ( FT_RENEW_ARRAY( font->user_props,
-                         font->nuser_props,
-                         font->nuser_props + 1 ) )
+    if ( FT_QRENEW_ARRAY( font->user_props,
+                          font->nuser_props,
+                          font->nuser_props + 1 ) )
       goto Exit;
 
     p = font->user_props + font->nuser_props;
@@ -941,9 +941,9 @@
     FT_Error   error  = FT_Err_Ok;
 
 
-    if ( FT_RENEW_ARRAY( font->comments,
-                         font->comments_len,
-                         font->comments_len + len + 1 ) )
+    if ( FT_QRENEW_ARRAY( font->comments,
+                          font->comments_len,
+                          font->comments_len + len + 1 ) )
       goto Exit;
 
     cp = font->comments + font->comments_len;
@@ -1158,9 +1158,9 @@
     /* Allocate another property if this is overflowing. */
     if ( font->props_used == font->props_size )
     {
-      if ( FT_RENEW_ARRAY( font->props,
-                           font->props_size,
-                           font->props_size + 1 ) )
+      if ( FT_QRENEW_ARRAY( font->props,
+                            font->props_size,
+                            font->props_size + 1 ) )
         goto Exit;
 
       fp = font->props + font->props_size;
@@ -2279,9 +2279,9 @@
 
       if ( p->font->comments_len > 0 )
       {
-        if ( FT_RENEW_ARRAY( p->font->comments,
-                             p->font->comments_len,
-                             p->font->comments_len + 1 ) )
+        if ( FT_QRENEW_ARRAY( p->font->comments,
+                              p->font->comments_len,
+                              p->font->comments_len + 1 ) )
           goto Fail;
 
         p->font->comments[p->font->comments_len] = 0;
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -613,7 +613,7 @@
 
     strings[string_size] = '\0';
 
-    if ( FT_NEW_ARRAY( properties, nprops ) )
+    if ( FT_QNEW_ARRAY( properties, nprops ) )
       goto Bail;
 
     face->properties = properties;
@@ -766,7 +766,7 @@
 
     face->nmetrics = nmetrics + 1;
 
-    if ( FT_NEW_ARRAY( face->metrics, face->nmetrics ) )
+    if ( FT_QNEW_ARRAY( face->metrics, face->nmetrics ) )
       return error;
 
     /* we handle glyph index 0 later on */