diff options
author | Alexei Podtelezhnikov <apodtele@gmail.com> | 2021-04-26 17:21:51 -0400 |
---|---|---|
committer | Alexei Podtelezhnikov <apodtele@gmail.com> | 2021-04-26 17:21:51 -0400 |
commit | 8750e843df27a0798d1f998be609d326d53b1c3f (patch) | |
tree | 3a79d75245feec579d8776b972227ac3e12afe9e /src/cff | |
parent | 618d0834c711c5e47e04d2e61fd72a937bd8428e (diff) | |
download | freetype2-8750e843df27a0798d1f998be609d326d53b1c3f.tar.gz |
[cff] Avoid some memory zeroing.
* src/cff/cffparse.c (cff_parser_init): Tweak memory macro.
* src/cff/cffload.c (cff_index_load_offsets, cff_index_get_pointers,
cff_charset_load, cff_vstore_load): Ditto.
Diffstat (limited to 'src/cff')
-rw-r--r-- | src/cff/cffload.c | 27 | ||||
-rw-r--r-- | src/cff/cffparse.c | 2 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 23cba5071..9ad00d896 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -356,9 +356,9 @@ data_size = (FT_ULong)( idx->count + 1 ) * offsize; - if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) || - FT_STREAM_SEEK( idx->start + idx->hdr_size ) || - FT_FRAME_ENTER( data_size ) ) + if ( FT_QNEW_ARRAY( idx->offsets, idx->count + 1 ) || + FT_STREAM_SEEK( idx->start + idx->hdr_size ) || + FT_FRAME_ENTER( data_size ) ) goto Exit; poff = idx->offsets; @@ -427,7 +427,7 @@ new_size = idx->data_size + idx->count; if ( idx->count > 0 && - !FT_NEW_ARRAY( tbl, idx->count + 1 ) && + !FT_QNEW_ARRAY( tbl, idx->count + 1 ) && ( !pool || !FT_ALLOC( new_bytes, new_size ) ) ) { FT_ULong n, cur_offset; @@ -931,7 +931,7 @@ goto Exit; /* Allocate memory for sids. */ - if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) ) + if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) ) goto Exit; /* assign the .notdef glyph */ @@ -1024,7 +1024,7 @@ } /* Allocate memory for sids. */ - if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) ) + if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) ) goto Exit; /* Copy the predefined charset into the allocated memory. */ @@ -1042,7 +1042,7 @@ } /* Allocate memory for sids. */ - if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) ) + if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) ) goto Exit; /* Copy the predefined charset into the allocated memory. */ @@ -1060,7 +1060,7 @@ } /* Allocate memory for sids. */ - if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) ) + if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) ) goto Exit; /* Copy the predefined charset into the allocated memory. */ @@ -1086,7 +1086,6 @@ FT_FREE( charset->cids ); charset->format = 0; charset->offset = 0; - charset->sids = 0; } return error; @@ -1168,7 +1167,7 @@ /* make temporary copy of item variation data offsets; */ /* we'll parse region list first, then come back */ - if ( FT_NEW_ARRAY( dataOffsetArray, vstore->dataCount ) ) + if ( FT_QNEW_ARRAY( dataOffsetArray, vstore->dataCount ) ) goto Exit; for ( i = 0; i < vstore->dataCount; i++ ) @@ -1183,7 +1182,7 @@ FT_READ_USHORT( vstore->regionCount ) ) goto Exit; - if ( FT_NEW_ARRAY( vstore->varRegionList, vstore->regionCount ) ) + if ( FT_QNEW_ARRAY( vstore->varRegionList, vstore->regionCount ) ) goto Exit; for ( i = 0; i < vstore->regionCount; i++ ) @@ -1191,7 +1190,7 @@ CFF_VarRegion* region = &vstore->varRegionList[i]; - if ( FT_NEW_ARRAY( region->axisList, vstore->axisCount ) ) + if ( FT_QNEW_ARRAY( region->axisList, vstore->axisCount ) ) goto Exit; for ( j = 0; j < vstore->axisCount; j++ ) @@ -1213,7 +1212,7 @@ } /* use dataOffsetArray now to parse varData items */ - if ( FT_NEW_ARRAY( vstore->varData, vstore->dataCount ) ) + if ( FT_QNEW_ARRAY( vstore->varData, vstore->dataCount ) ) goto Exit; for ( i = 0; i < vstore->dataCount; i++ ) @@ -1235,7 +1234,7 @@ if ( FT_READ_USHORT( data->regionIdxCount ) ) goto Exit; - if ( FT_NEW_ARRAY( data->regionIndices, data->regionIdxCount ) ) + if ( FT_QNEW_ARRAY( data->regionIndices, data->regionIdxCount ) ) goto Exit; for ( j = 0; j < data->regionIdxCount; j++ ) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 464488d40..129ecaad3 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -62,7 +62,7 @@ parser->num_axes = num_axes; /* allocate the stack buffer */ - if ( FT_NEW_ARRAY( parser->stack, stackSize ) ) + if ( FT_QNEW_ARRAY( parser->stack, stackSize ) ) { FT_FREE( parser->stack ); goto Exit; |