* src/type42/t42drivr.c: Clean up interface.

Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
This commit is contained in:
Werner Lemberg 2023-05-07 07:19:44 +02:00
parent 7cc5dfa297
commit ff0ef828c9
1 changed files with 27 additions and 16 deletions

View File

@ -56,33 +56,41 @@
*
*/
static FT_Error
t42_get_glyph_name( T42_Face face,
FT_CALLBACK_DEF( FT_Error )
t42_get_glyph_name( FT_Face face, /* T42_Face */
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
{
FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );
T42_Face t42face = (T42_Face)face;
FT_STRCPYN( buffer,
t42face->type1.glyph_names[glyph_index],
buffer_max );
return FT_Err_Ok;
}
static FT_UInt
t42_get_name_index( T42_Face face,
FT_CALLBACK_DEF( FT_UInt )
t42_get_name_index( FT_Face face, /* T42_Face */
const FT_String* glyph_name )
{
FT_Int i;
T42_Face t42face = (T42_Face)face;
FT_Int i;
for ( i = 0; i < face->type1.num_glyphs; i++ )
for ( i = 0; i < t42face->type1.num_glyphs; i++ )
{
FT_String* gname = face->type1.glyph_names[i];
FT_String* gname = t42face->type1.glyph_names[i];
if ( glyph_name[0] == gname[0] && !ft_strcmp( glyph_name, gname ) )
return (FT_UInt)ft_strtol( (const char *)face->type1.charstrings[i],
NULL, 10 );
return (FT_UInt)ft_strtol(
(const char *)t42face->type1.charstrings[i],
NULL,
10 );
}
return 0;
@ -102,10 +110,13 @@
*
*/
static const char*
t42_get_ps_font_name( T42_Face face )
FT_CALLBACK_DEF( const char* )
t42_get_ps_font_name( FT_Face face ) /* T42_Face */
{
return (const char*)face->type1.font_name;
T42_Face t42face = (T42_Face)face;
return (const char*)t42face->type1.font_name;
}
@ -121,7 +132,7 @@
*
*/
static FT_Error
FT_CALLBACK_DEF( FT_Error )
t42_ps_get_font_info( FT_Face face,
PS_FontInfoRec* afont_info )
{
@ -131,7 +142,7 @@
}
static FT_Error
FT_CALLBACK_DEF( FT_Error )
t42_ps_get_font_extra( FT_Face face,
PS_FontExtraRec* afont_extra )
{
@ -141,7 +152,7 @@
}
static FT_Int
FT_CALLBACK_DEF( FT_Int )
t42_ps_has_glyph_names( FT_Face face )
{
FT_UNUSED( face );