* src/bdf/bdflib.c (bdf_parse_*_): Minor improvements.

This commit is contained in:
Alexei Podtelezhnikov 2025-01-10 22:55:13 -05:00
parent cf451e5ff3
commit ff5872b4da
1 changed files with 26 additions and 44 deletions

View File

@ -1283,28 +1283,22 @@
void* call_data,
void* client_data )
{
bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
bdf_font_t* font = p->font;
bdf_glyph_t* glyph;
FT_Memory memory = font->memory;
FT_Error error = FT_Err_Ok;
int c, mask_index;
char* s;
unsigned char* bp;
unsigned long i, slen, nibbles;
bdf_line_func_t_* next;
bdf_parse_t_* p;
bdf_glyph_t* glyph;
bdf_font_t* font;
FT_Memory memory;
FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno ); /* only used in debug mode */
next = (bdf_line_func_t_ *)call_data;
p = (bdf_parse_t_ *) client_data;
font = p->font;
memory = font->memory;
/* Check for a comment. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
@ -1762,20 +1756,19 @@
void* call_data,
void* client_data )
{
bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
FT_Error error = FT_Err_Ok;
unsigned long vlen;
bdf_line_func_t_* next;
bdf_parse_t_* p;
char* name;
char* value;
char nbuf[BUFSIZE];
FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno );
next = (bdf_line_func_t_ *)call_data;
p = (bdf_parse_t_ *) client_data;
/* Check for the end of the properties. */
if ( _bdf_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
{
@ -1865,24 +1858,18 @@
void* call_data,
void* client_data )
{
unsigned long slen;
bdf_line_func_t_* next;
bdf_parse_t_* p;
bdf_font_t* font;
char *s;
bdf_line_func_t_* next = (bdf_line_func_t_ *)call_data;
bdf_parse_t_* p = (bdf_parse_t_ *) client_data;
FT_Memory memory = NULL;
FT_Memory memory = p->memory;
FT_Error error = FT_Err_Ok;
unsigned long slen;
char *s;
FT_UNUSED( lineno ); /* only used in debug mode */
next = (bdf_line_func_t_ *)call_data;
p = (bdf_parse_t_ *) client_data;
if ( p->font )
memory = p->font->memory;
/* Check for a comment. This is done to handle those fonts that have */
/* comments before the STARTFONT line for some reason. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
@ -1904,8 +1891,6 @@
if ( !( p->flags & BDF_START_ ) )
{
memory = p->memory;
if ( _bdf_strncmp( line, "STARTFONT", 9 ) != 0 )
{
/* we don't emit an error message since this code gets */
@ -1915,27 +1900,24 @@
}
p->flags = BDF_START_;
font = p->font = NULL;
if ( FT_NEW( font ) )
if ( FT_NEW( p->font ) )
goto Exit;
p->font = font;
font->memory = p->memory;
p->font->memory = memory;
{ /* setup */
bdf_property_t* prop = (bdf_property_t*)bdf_properties_;
FT_Hash proptbl = &p->font->proptbl;
size_t i;
bdf_property_t* prop;
error = ft_hash_str_init( &(font->proptbl), memory );
error = ft_hash_str_init( proptbl, memory );
if ( error )
goto Exit;
for ( i = 0, prop = (bdf_property_t*)bdf_properties_;
i < num_bdf_properties_; i++, prop++ )
for ( i = 0; i < num_bdf_properties_; i++, prop++ )
{
error = ft_hash_str_insert( prop->name, i,
&(font->proptbl), memory );
error = ft_hash_str_insert( prop->name, i, proptbl, memory );
if ( error )
goto Exit;
}