[sfnt] Avoid some memory zeroing.
* src/sfnt/sfobjs.c (sfnt_open_font, sfnt_init_face, tt_name_ascii_from_{utf16,other}): Tweak allocaton macros. * src/sfnt/ttload.c (tt_face_load_name): Ditto.
This commit is contained in:
parent
b8968d666e
commit
dc42f826af
|
@ -1,3 +1,11 @@
|
||||||
|
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||||
|
|
||||||
|
[sfnt] Avoid some memory zeroing.
|
||||||
|
|
||||||
|
* src/sfnt/sfobjs.c (sfnt_open_font, sfnt_init_face,
|
||||||
|
tt_name_ascii_from_{utf16,other}): Tweak allocaton macros.
|
||||||
|
* src/sfnt/ttload.c (tt_face_load_name): Ditto.
|
||||||
|
|
||||||
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
|
2021-05-01 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||||
|
|
||||||
* src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocaton macros.
|
* src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocaton macros.
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
len = (FT_UInt)entry->stringLength / 2;
|
len = (FT_UInt)entry->stringLength / 2;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( string, len + 1 ) )
|
if ( FT_QNEW_ARRAY( string, len + 1 ) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for ( n = 0; n < len; n++ )
|
for ( n = 0; n < len; n++ )
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
|
|
||||||
len = (FT_UInt)entry->stringLength;
|
len = (FT_UInt)entry->stringLength;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( string, len + 1 ) )
|
if ( FT_QNEW_ARRAY( string, len + 1 ) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for ( n = 0; n < len; n++ )
|
for ( n = 0; n < len; n++ )
|
||||||
|
@ -446,7 +446,7 @@
|
||||||
return FT_THROW( Array_Too_Large );
|
return FT_THROW( Array_Too_Large );
|
||||||
|
|
||||||
/* now read the offsets of each font in the file */
|
/* now read the offsets of each font in the file */
|
||||||
if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
|
if ( FT_QNEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
|
if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
|
||||||
|
@ -464,7 +464,7 @@
|
||||||
face->ttc_header.version = 1 << 16;
|
face->ttc_header.version = 1 << 16;
|
||||||
face->ttc_header.count = 1;
|
face->ttc_header.count = 1;
|
||||||
|
|
||||||
if ( FT_NEW( face->ttc_header.offsets ) )
|
if ( FT_QNEW( face->ttc_header.offsets ) )
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
face->ttc_header.offsets[0] = offset;
|
face->ttc_header.offsets[0] = offset;
|
||||||
|
@ -643,8 +643,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
|
if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
|
||||||
!( FT_ALLOC( default_values, num_axes * 4 ) ||
|
!( FT_QALLOC( default_values, num_axes * 4 ) ||
|
||||||
FT_ALLOC( instance_values, num_axes * 4 ) ) )
|
FT_QALLOC( instance_values, num_axes * 4 ) ) )
|
||||||
{
|
{
|
||||||
/* the current stream position is 16 bytes after the table start */
|
/* the current stream position is 16 bytes after the table start */
|
||||||
FT_ULong array_start = FT_STREAM_POS() - 16 + offset;
|
FT_ULong array_start = FT_STREAM_POS() - 16 + offset;
|
||||||
|
|
|
@ -917,7 +917,7 @@
|
||||||
storage_start += 2 + 4 * table->numLangTagRecords;
|
storage_start += 2 + 4 * table->numLangTagRecords;
|
||||||
|
|
||||||
/* allocate language tag records array */
|
/* allocate language tag records array */
|
||||||
if ( FT_NEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
|
if ( FT_QNEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
|
||||||
FT_FRAME_ENTER( table->numLangTagRecords * 4 ) )
|
FT_FRAME_ENTER( table->numLangTagRecords * 4 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
@ -948,7 +948,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate name records array */
|
/* allocate name records array */
|
||||||
if ( FT_NEW_ARRAY( table->names, table->numNameRecords ) ||
|
if ( FT_QNEW_ARRAY( table->names, table->numNameRecords ) ||
|
||||||
FT_FRAME_ENTER( table->numNameRecords * 12 ) )
|
FT_FRAME_ENTER( table->numNameRecords * 12 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
@ -993,7 +993,7 @@
|
||||||
|
|
||||||
/* reduce array size to the actually used elements */
|
/* reduce array size to the actually used elements */
|
||||||
count = (FT_UInt)( entry - table->names );
|
count = (FT_UInt)( entry - table->names );
|
||||||
(void)FT_RENEW_ARRAY( table->names,
|
(void)FT_QRENEW_ARRAY( table->names,
|
||||||
table->numNameRecords,
|
table->numNameRecords,
|
||||||
count );
|
count );
|
||||||
table->numNameRecords = count;
|
table->numNameRecords = count;
|
||||||
|
|
Loading…
Reference in New Issue