[bdf,pcf] Avoid some memory zeroing.
* src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties, pcf_load_font): Tweak memory macros. * src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto. * src/bdf/bdflib.c (_bdf_readstreami, bdf_create_property, _bdf_parse_glyphs, _bdf_parse_start): Ditto. (_bdf_add_property): Do not handle zero size.
This commit is contained in:
parent
f998eaf972
commit
c2d283143a
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2021-04-25 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||||
|
|
||||||
|
[bdf,pcf] Avoid some memory zeroing.
|
||||||
|
|
||||||
|
* src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties, pcf_load_font):
|
||||||
|
Tweak memory macros.
|
||||||
|
* src/bdf/bdfdrivr.c (BDF_Face_Init): Ditto.
|
||||||
|
* src/bdf/bdflib.c (_bdf_readstreami, bdf_create_property,
|
||||||
|
_bdf_parse_glyphs, _bdf_parse_start): Ditto.
|
||||||
|
(_bdf_add_property): Do not handle zero size.
|
||||||
|
|
||||||
2021-04-25 Issam E. Maghni <issam.e.maghni@mailbox.org>
|
2021-04-25 Issam E. Maghni <issam.e.maghni@mailbox.org>
|
||||||
|
|
||||||
* builds/meson/process_ftoption_h.py: Add LF at EOF.
|
* builds/meson/process_ftoption_h.py: Add LF at EOF.
|
||||||
|
|
|
@ -442,7 +442,7 @@ THE SOFTWARE.
|
||||||
bdfface->num_glyphs = (FT_Long)( font->glyphs_size + 1 );
|
bdfface->num_glyphs = (FT_Long)( font->glyphs_size + 1 );
|
||||||
|
|
||||||
bdfface->num_fixed_sizes = 1;
|
bdfface->num_fixed_sizes = 1;
|
||||||
if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) )
|
if ( FT_NEW( bdfface->available_sizes ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -451,8 +451,6 @@ THE SOFTWARE.
|
||||||
long value;
|
long value;
|
||||||
|
|
||||||
|
|
||||||
FT_ZERO( bsize );
|
|
||||||
|
|
||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
|
if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
|
||||||
{
|
{
|
||||||
|
|
|
@ -538,7 +538,7 @@
|
||||||
/* initial size and allocation of the input buffer */
|
/* initial size and allocation of the input buffer */
|
||||||
buf_size = 1024;
|
buf_size = 1024;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( buf, buf_size ) )
|
if ( FT_QALLOC( buf, buf_size ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
cb = callback;
|
cb = callback;
|
||||||
|
@ -599,7 +599,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
new_size = buf_size * 2;
|
new_size = buf_size * 2;
|
||||||
if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) )
|
if ( FT_QREALLOC( buf, buf_size, new_size ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
cursor = (ptrdiff_t)buf_size;
|
cursor = (ptrdiff_t)buf_size;
|
||||||
|
@ -850,13 +850,12 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
p = font->user_props + font->nuser_props;
|
p = font->user_props + font->nuser_props;
|
||||||
FT_ZERO( p );
|
|
||||||
|
|
||||||
n = ft_strlen( name ) + 1;
|
n = ft_strlen( name ) + 1;
|
||||||
if ( n > FT_ULONG_MAX )
|
if ( n > FT_ULONG_MAX )
|
||||||
return FT_THROW( Invalid_Argument );
|
return FT_THROW( Invalid_Argument );
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( p->name, n ) )
|
if ( FT_QALLOC( p->name, n ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_MEM_COPY( (char *)p->name, name, n );
|
FT_MEM_COPY( (char *)p->name, name, n );
|
||||||
|
@ -1159,21 +1158,12 @@
|
||||||
/* Allocate another property if this is overflowing. */
|
/* Allocate another property if this is overflowing. */
|
||||||
if ( font->props_used == font->props_size )
|
if ( font->props_used == font->props_size )
|
||||||
{
|
{
|
||||||
if ( font->props_size == 0 )
|
if ( FT_RENEW_ARRAY( font->props,
|
||||||
{
|
font->props_size,
|
||||||
if ( FT_NEW_ARRAY( font->props, 1 ) )
|
font->props_size + 1 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( FT_RENEW_ARRAY( font->props,
|
|
||||||
font->props_size,
|
|
||||||
font->props_size + 1 ) )
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp = font->props + font->props_size;
|
fp = font->props + font->props_size;
|
||||||
FT_ZERO( fp );
|
|
||||||
font->props_size++;
|
font->props_size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1438,7 +1428,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( p->glyph_name, slen + 1 ) )
|
if ( FT_QALLOC( p->glyph_name, slen + 1 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_MEM_COPY( p->glyph_name, s, slen + 1 );
|
FT_MEM_COPY( p->glyph_name, s, slen + 1 );
|
||||||
|
@ -1735,7 +1725,7 @@
|
||||||
else
|
else
|
||||||
glyph->bytes = (unsigned short)bitmap_size;
|
glyph->bytes = (unsigned short)bitmap_size;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( glyph->bitmap, glyph->bytes ) )
|
if ( FT_ALLOC( glyph->bitmap, glyph->bytes ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
p->row = 0;
|
p->row = 0;
|
||||||
|
@ -2055,7 +2045,7 @@
|
||||||
/* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
|
/* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
|
||||||
FT_FREE( p->font->name );
|
FT_FREE( p->font->name );
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( p->font->name, slen + 1 ) )
|
if ( FT_QALLOC( p->font->name, slen + 1 ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
FT_MEM_COPY( p->font->name, s, slen + 1 );
|
FT_MEM_COPY( p->font->name, s, slen + 1 );
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ THE SOFTWARE.
|
||||||
toc->count = FT_MIN( stream->size >> 4, 9 );
|
toc->count = FT_MIN( stream->size >> 4, 9 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )
|
if ( FT_QNEW_ARRAY( face->toc.tables, toc->count ) )
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
tables = face->toc.tables;
|
tables = face->toc.tables;
|
||||||
|
@ -540,7 +540,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
face->nprops = (int)nprops;
|
face->nprops = (int)nprops;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( props, nprops ) )
|
if ( FT_QNEW_ARRAY( props, nprops ) )
|
||||||
goto Bail;
|
goto Bail;
|
||||||
|
|
||||||
for ( i = 0; i < nprops; i++ )
|
for ( i = 0; i < nprops; i++ )
|
||||||
|
@ -607,12 +607,11 @@ THE SOFTWARE.
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate one more byte so that we have a final null byte */
|
/* allocate one more byte so that we have a final null byte */
|
||||||
if ( FT_NEW_ARRAY( strings, string_size + 1 ) )
|
if ( FT_QALLOC( strings, string_size + 1 ) ||
|
||||||
|
FT_STREAM_READ( strings, string_size ) )
|
||||||
goto Bail;
|
goto Bail;
|
||||||
|
|
||||||
error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );
|
strings[string_size] = '\0';
|
||||||
if ( error )
|
|
||||||
goto Bail;
|
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( properties, nprops ) )
|
if ( FT_NEW_ARRAY( properties, nprops ) )
|
||||||
goto Bail;
|
goto Bail;
|
||||||
|
@ -1532,7 +1531,7 @@ THE SOFTWARE.
|
||||||
{
|
{
|
||||||
l += ft_strlen( foundry_prop->value.atom ) + 1;
|
l += ft_strlen( foundry_prop->value.atom ) + 1;
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( root->family_name, l ) )
|
if ( FT_QALLOC( root->family_name, l ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
ft_strcpy( root->family_name, foundry_prop->value.atom );
|
ft_strcpy( root->family_name, foundry_prop->value.atom );
|
||||||
|
@ -1541,7 +1540,7 @@ THE SOFTWARE.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( FT_NEW_ARRAY( root->family_name, l ) )
|
if ( FT_QALLOC( root->family_name, l ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
ft_strcpy( root->family_name, prop->value.atom );
|
ft_strcpy( root->family_name, prop->value.atom );
|
||||||
|
@ -1565,7 +1564,7 @@ THE SOFTWARE.
|
||||||
root->num_glyphs = (FT_Long)face->nmetrics;
|
root->num_glyphs = (FT_Long)face->nmetrics;
|
||||||
|
|
||||||
root->num_fixed_sizes = 1;
|
root->num_fixed_sizes = 1;
|
||||||
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
|
if ( FT_NEW( root->available_sizes ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1573,8 +1572,6 @@ THE SOFTWARE.
|
||||||
FT_Short resolution_x = 0, resolution_y = 0;
|
FT_Short resolution_x = 0, resolution_y = 0;
|
||||||
|
|
||||||
|
|
||||||
FT_ZERO( bsize );
|
|
||||||
|
|
||||||
/* for simplicity, we take absolute values of integer properties */
|
/* for simplicity, we take absolute values of integer properties */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in New Issue