freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [sfnt] Avoid some memory zeroing.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [sfnt] Avoid some memory zeroing.
Date: Sat, 01 May 2021 16:47:21 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

3 changed files:

Changes:

  • ChangeLog
    1
    +2021-05-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[sfnt] Avoid some memory zeroing.
    
    4
    +
    
    5
    +	* src/sfnt/sfobjs.c (sfnt_open_font, sfnt_init_face,
    
    6
    +	tt_name_ascii_from_{utf16,other}): Tweak allocaton macros.
    
    7
    +	* src/sfnt/ttload.c (tt_face_load_name): Ditto.
    
    8
    +
    
    1 9
     2021-05-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2 10
     
    
    3 11
     	* src/sfnt/ttpost.c (load_format_{20,25}): Tweak allocaton macros.
    

  • src/sfnt/sfobjs.c
    ... ... @@ -65,7 +65,7 @@
    65 65
     
    
    66 66
         len = (FT_UInt)entry->stringLength / 2;
    
    67 67
     
    
    68
    -    if ( FT_NEW_ARRAY( string, len + 1 ) )
    
    68
    +    if ( FT_QNEW_ARRAY( string, len + 1 ) )
    
    69 69
           return NULL;
    
    70 70
     
    
    71 71
         for ( n = 0; n < len; n++ )
    
    ... ... @@ -100,7 +100,7 @@
    100 100
     
    
    101 101
         len = (FT_UInt)entry->stringLength;
    
    102 102
     
    
    103
    -    if ( FT_NEW_ARRAY( string, len + 1 ) )
    
    103
    +    if ( FT_QNEW_ARRAY( string, len + 1 ) )
    
    104 104
           return NULL;
    
    105 105
     
    
    106 106
         for ( n = 0; n < len; n++ )
    
    ... ... @@ -446,7 +446,7 @@
    446 446
             return FT_THROW( Array_Too_Large );
    
    447 447
     
    
    448 448
           /* now read the offsets of each font in the file */
    
    449
    -      if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
    
    449
    +      if ( FT_QNEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
    
    450 450
             return error;
    
    451 451
     
    
    452 452
           if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
    
    ... ... @@ -464,7 +464,7 @@
    464 464
           face->ttc_header.version = 1 << 16;
    
    465 465
           face->ttc_header.count   = 1;
    
    466 466
     
    
    467
    -      if ( FT_NEW( face->ttc_header.offsets ) )
    
    467
    +      if ( FT_QNEW( face->ttc_header.offsets ) )
    
    468 468
             return error;
    
    469 469
     
    
    470 470
           face->ttc_header.offsets[0] = offset;
    
    ... ... @@ -643,8 +643,8 @@
    643 643
            */
    
    644 644
     
    
    645 645
           if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
    
    646
    -           !( FT_ALLOC( default_values, num_axes * 4 )  ||
    
    647
    -              FT_ALLOC( instance_values, num_axes * 4 ) )     )
    
    646
    +           !( FT_QALLOC(  default_values, num_axes * 4 ) ||
    
    647
    +              FT_QALLOC( instance_values, num_axes * 4 ) )     )
    
    648 648
           {
    
    649 649
             /* the current stream position is 16 bytes after the table start */
    
    650 650
             FT_ULong  array_start = FT_STREAM_POS() - 16 + offset;
    

  • src/sfnt/ttload.c
    ... ... @@ -917,8 +917,8 @@
    917 917
           storage_start += 2 + 4 * table->numLangTagRecords;
    
    918 918
     
    
    919 919
           /* allocate language tag records array */
    
    920
    -      if ( FT_NEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
    
    921
    -           FT_FRAME_ENTER( table->numLangTagRecords * 4 )            )
    
    920
    +      if ( FT_QNEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
    
    921
    +           FT_FRAME_ENTER( table->numLangTagRecords * 4 )             )
    
    922 922
             goto Exit;
    
    923 923
     
    
    924 924
           /* load language tags */
    
    ... ... @@ -948,8 +948,8 @@
    948 948
         }
    
    949 949
     
    
    950 950
         /* allocate name records array */
    
    951
    -    if ( FT_NEW_ARRAY( table->names, table->numNameRecords ) ||
    
    952
    -         FT_FRAME_ENTER( table->numNameRecords * 12 )        )
    
    951
    +    if ( FT_QNEW_ARRAY( table->names, table->numNameRecords ) ||
    
    952
    +         FT_FRAME_ENTER( table->numNameRecords * 12 )         )
    
    953 953
           goto Exit;
    
    954 954
     
    
    955 955
         /* load name records */
    
    ... ... @@ -993,9 +993,9 @@
    993 993
     
    
    994 994
           /* reduce array size to the actually used elements */
    
    995 995
           count = (FT_UInt)( entry - table->names );
    
    996
    -      (void)FT_RENEW_ARRAY( table->names,
    
    997
    -                            table->numNameRecords,
    
    998
    -                            count );
    
    996
    +      (void)FT_QRENEW_ARRAY( table->names,
    
    997
    +                             table->numNameRecords,
    
    998
    +                             count );
    
    999 999
           table->numNameRecords = count;
    
    1000 1000
         }
    
    1001 1001
     
    


  • reply via email to

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