freetype-commit
[Top][All Lists]
Advanced

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

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


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [cff] Avoid some memory zeroing.
Date: Mon, 26 Apr 2021 21:22:26 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

3 changed files:

Changes:

  • ChangeLog
    1
    +2021-04-26  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[cff] Avoid some memory zeroing.
    
    4
    +
    
    5
    +	* src/cff/cffparse.c (cff_parser_init): Tweak memory macro.
    
    6
    +	* src/cff/cffload.c (cff_index_load_offsets, cff_index_get_pointers,
    
    7
    +	cff_charset_load, cff_vstore_load): Ditto.
    
    8
    +
    
    1 9
     2021-04-26  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2 10
     
    
    3 11
     	[pfr] Avoid some memory zeroing.
    

  • src/cff/cffload.c
    ... ... @@ -356,9 +356,9 @@
    356 356
     
    
    357 357
           data_size = (FT_ULong)( idx->count + 1 ) * offsize;
    
    358 358
     
    
    359
    -      if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||
    
    360
    -           FT_STREAM_SEEK( idx->start + idx->hdr_size ) ||
    
    361
    -           FT_FRAME_ENTER( data_size )                  )
    
    359
    +      if ( FT_QNEW_ARRAY( idx->offsets, idx->count + 1 ) ||
    
    360
    +           FT_STREAM_SEEK( idx->start + idx->hdr_size )  ||
    
    361
    +           FT_FRAME_ENTER( data_size )                   )
    
    362 362
             goto Exit;
    
    363 363
     
    
    364 364
           poff   = idx->offsets;
    
    ... ... @@ -427,7 +427,7 @@
    427 427
         new_size = idx->data_size + idx->count;
    
    428 428
     
    
    429 429
         if ( idx->count > 0                                &&
    
    430
    -         !FT_NEW_ARRAY( tbl, idx->count + 1 )          &&
    
    430
    +         !FT_QNEW_ARRAY( tbl, idx->count + 1 )         &&
    
    431 431
              ( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
    
    432 432
         {
    
    433 433
           FT_ULong  n, cur_offset;
    
    ... ... @@ -931,7 +931,7 @@
    931 931
             goto Exit;
    
    932 932
     
    
    933 933
           /* Allocate memory for sids. */
    
    934
    -      if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
    
    934
    +      if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
    
    935 935
             goto Exit;
    
    936 936
     
    
    937 937
           /* assign the .notdef glyph */
    
    ... ... @@ -1024,7 +1024,7 @@
    1024 1024
             }
    
    1025 1025
     
    
    1026 1026
             /* Allocate memory for sids. */
    
    1027
    -        if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
    
    1027
    +        if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
    
    1028 1028
               goto Exit;
    
    1029 1029
     
    
    1030 1030
             /* Copy the predefined charset into the allocated memory. */
    
    ... ... @@ -1042,7 +1042,7 @@
    1042 1042
             }
    
    1043 1043
     
    
    1044 1044
             /* Allocate memory for sids. */
    
    1045
    -        if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
    
    1045
    +        if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
    
    1046 1046
               goto Exit;
    
    1047 1047
     
    
    1048 1048
             /* Copy the predefined charset into the allocated memory.     */
    
    ... ... @@ -1060,7 +1060,7 @@
    1060 1060
             }
    
    1061 1061
     
    
    1062 1062
             /* Allocate memory for sids. */
    
    1063
    -        if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
    
    1063
    +        if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
    
    1064 1064
               goto Exit;
    
    1065 1065
     
    
    1066 1066
             /* Copy the predefined charset into the allocated memory.     */
    
    ... ... @@ -1086,7 +1086,6 @@
    1086 1086
           FT_FREE( charset->cids );
    
    1087 1087
           charset->format = 0;
    
    1088 1088
           charset->offset = 0;
    
    1089
    -      charset->sids   = 0;
    
    1090 1089
         }
    
    1091 1090
     
    
    1092 1091
         return error;
    
    ... ... @@ -1168,7 +1167,7 @@
    1168 1167
     
    
    1169 1168
           /* make temporary copy of item variation data offsets; */
    
    1170 1169
           /* we'll parse region list first, then come back       */
    
    1171
    -      if ( FT_NEW_ARRAY( dataOffsetArray, vstore->dataCount ) )
    
    1170
    +      if ( FT_QNEW_ARRAY( dataOffsetArray, vstore->dataCount ) )
    
    1172 1171
             goto Exit;
    
    1173 1172
     
    
    1174 1173
           for ( i = 0; i < vstore->dataCount; i++ )
    
    ... ... @@ -1183,7 +1182,7 @@
    1183 1182
                FT_READ_USHORT( vstore->regionCount )         )
    
    1184 1183
             goto Exit;
    
    1185 1184
     
    
    1186
    -      if ( FT_NEW_ARRAY( vstore->varRegionList, vstore->regionCount ) )
    
    1185
    +      if ( FT_QNEW_ARRAY( vstore->varRegionList, vstore->regionCount ) )
    
    1187 1186
             goto Exit;
    
    1188 1187
     
    
    1189 1188
           for ( i = 0; i < vstore->regionCount; i++ )
    
    ... ... @@ -1191,7 +1190,7 @@
    1191 1190
             CFF_VarRegion*  region = &vstore->varRegionList[i];
    
    1192 1191
     
    
    1193 1192
     
    
    1194
    -        if ( FT_NEW_ARRAY( region->axisList, vstore->axisCount ) )
    
    1193
    +        if ( FT_QNEW_ARRAY( region->axisList, vstore->axisCount ) )
    
    1195 1194
               goto Exit;
    
    1196 1195
     
    
    1197 1196
             for ( j = 0; j < vstore->axisCount; j++ )
    
    ... ... @@ -1213,7 +1212,7 @@
    1213 1212
           }
    
    1214 1213
     
    
    1215 1214
           /* use dataOffsetArray now to parse varData items */
    
    1216
    -      if ( FT_NEW_ARRAY( vstore->varData, vstore->dataCount ) )
    
    1215
    +      if ( FT_QNEW_ARRAY( vstore->varData, vstore->dataCount ) )
    
    1217 1216
             goto Exit;
    
    1218 1217
     
    
    1219 1218
           for ( i = 0; i < vstore->dataCount; i++ )
    
    ... ... @@ -1235,7 +1234,7 @@
    1235 1234
             if ( FT_READ_USHORT( data->regionIdxCount ) )
    
    1236 1235
               goto Exit;
    
    1237 1236
     
    
    1238
    -        if ( FT_NEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
    
    1237
    +        if ( FT_QNEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
    
    1239 1238
               goto Exit;
    
    1240 1239
     
    
    1241 1240
             for ( j = 0; j < data->regionIdxCount; j++ )
    

  • src/cff/cffparse.c
    ... ... @@ -62,7 +62,7 @@
    62 62
         parser->num_axes    = num_axes;
    
    63 63
     
    
    64 64
         /* allocate the stack buffer */
    
    65
    -    if ( FT_NEW_ARRAY( parser->stack, stackSize ) )
    
    65
    +    if ( FT_QNEW_ARRAY( parser->stack, stackSize ) )
    
    66 66
         {
    
    67 67
           FT_FREE( parser->stack );
    
    68 68
           goto Exit;
    


  • reply via email to

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