[base] Make FT_Module_Class always const.

All uses of FT_Module_Class are decorated with const now.  Therefore,
it make sense to declare it as such to begin with.

* include/freetype/ftmodapi.h (FT_Module_Class): Decorate with const.
* include/freetype/internal/ftobjs.h (FT_Module): Updated.
* src/*: Update all other users.
This commit is contained in:
Alexei Podtelezhnikov 2025-08-31 07:28:32 -04:00
parent c6cf32de3b
commit 7b8a770aac
8 changed files with 49 additions and 49 deletions

View file

@ -232,7 +232,7 @@ FT_BEGIN_HEADER
* get_interface ::
* The interface requesting function.
*/
typedef struct FT_Module_Class_
typedef const struct FT_Module_Class_
{
FT_ULong module_flags;
FT_Long module_size;
@ -273,8 +273,8 @@ FT_BEGIN_HEADER
* if the module requires a version of FreeType that is too great.
*/
FT_EXPORT( FT_Error )
FT_Add_Module( FT_Library library,
const FT_Module_Class* clazz );
FT_Add_Module( FT_Library library,
FT_Module_Class* clazz );
/**************************************************************************

View file

@ -520,9 +520,9 @@ FT_BEGIN_HEADER
*/
typedef struct FT_ModuleRec_
{
const FT_Module_Class* clazz;
FT_Library library;
FT_Memory memory;
FT_Module_Class* clazz;
FT_Library library;
FT_Memory memory;
} FT_ModuleRec;
@ -1190,7 +1190,7 @@ FT_BEGIN_HEADER
*/
#define FT_DECLARE_MODULE( class_ ) \
FT_CALLBACK_TABLE \
const FT_Module_Class class_;
FT_Module_Class class_;
#define FT_DEFINE_ROOT_MODULE( \
flags_, \
@ -1217,32 +1217,32 @@ FT_BEGIN_HEADER
get_interface_, \
},
#define FT_DEFINE_MODULE( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_ ) \
FT_CALLBACK_TABLE_DEF \
const FT_Module_Class class_ = \
{ \
flags_, \
size_, \
\
name_, \
version_, \
requires_, \
\
interface_, \
\
init_, \
done_, \
get_interface_, \
#define FT_DEFINE_MODULE( \
class_, \
flags_, \
size_, \
name_, \
version_, \
requires_, \
interface_, \
init_, \
done_, \
get_interface_) \
FT_CALLBACK_TABLE_DEF \
FT_Module_Class class_ = \
{ \
flags_, \
size_, \
\
name_, \
version_, \
requires_, \
\
interface_, \
\
init_, \
done_, \
get_interface_, \
};

View file

@ -56,18 +56,18 @@
#undef FT_USE_MODULE
#ifdef __cplusplus
#define FT_USE_MODULE( type, x ) extern "C" const type x;
#define FT_USE_MODULE( type, x ) extern "C" type x;
#else
#define FT_USE_MODULE( type, x ) extern const type x;
#define FT_USE_MODULE( type, x ) extern type x;
#endif
#include FT_CONFIG_MODULES_H
#undef FT_USE_MODULE
#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
#define FT_USE_MODULE( type, x ) (FT_Module_Class*)&(x),
static
const FT_Module_Class* const ft_default_modules[] =
FT_Module_Class* const ft_default_modules[] =
{
#include FT_CONFIG_MODULES_H
0
@ -80,13 +80,13 @@
FT_Add_Default_Modules( FT_Library library )
{
FT_Error error;
const FT_Module_Class* const* cur;
FT_Module_Class* const* cur;
/* GCC 4.6 warns the type difference:
* FT_Module_Class** != const FT_Module_Class* const*
* FT_Module_Class** != FT_Module_Class* const*
*/
cur = (const FT_Module_Class* const*)ft_default_modules;
cur = (FT_Module_Class* const*)ft_default_modules;
/* test for valid `library' delayed to FT_Add_Module() */
while ( *cur )

View file

@ -5030,9 +5030,9 @@
static void
Destroy_Module( FT_Module module )
{
const FT_Module_Class* clazz = module->clazz;
FT_Library library = module->library;
FT_Memory memory = module->memory;
FT_Module_Class* clazz = module->clazz;
FT_Library library = module->library;
FT_Memory memory = module->memory;
if ( library && library->auto_hinter == module )
@ -5058,8 +5058,8 @@
/* documentation is in ftmodapi.h */
FT_EXPORT_DEF( FT_Error )
FT_Add_Module( FT_Library library,
const FT_Module_Class* clazz )
FT_Add_Module( FT_Library library,
FT_Module_Class* clazz )
{
FT_Error error;
FT_Memory memory;

View file

@ -269,7 +269,7 @@
FT_CALLBACK_TABLE_DEF
const FT_Module_Class gxv_module_class =
FT_Module_Class gxv_module_class =
{
0,
sizeof ( FT_ModuleRec ),

View file

@ -35,7 +35,7 @@
FT_BEGIN_HEADER
FT_EXPORT_VAR( const FT_Module_Class ) gxv_module_class;
FT_EXPORT_VAR( FT_Module_Class ) gxv_module_class;
FT_END_HEADER

View file

@ -262,7 +262,7 @@
FT_CALLBACK_TABLE_DEF
const FT_Module_Class otv_module_class =
FT_Module_Class otv_module_class =
{
0,
sizeof ( FT_ModuleRec ),

View file

@ -27,7 +27,7 @@
FT_BEGIN_HEADER
FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class;
FT_EXPORT_VAR( FT_Module_Class ) otv_module_class;
FT_END_HEADER