From ca0247af92ca62c84449f2d4aaf926c27e0e302f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 19 Aug 2025 23:39:02 -0400 Subject: [PATCH] [truetype] Fix compilation without bytecode. Fixes #1351 and various warnings about unused variables. * src/truetype/ttinterp.c: Put the entire body under #ifdef. * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Relocate some declarations. * src/truetype/ttinterp.h: Remove some #ifdef conditions. * src/truetype/ttobjs.c (tt_size_done): Modified. --- src/truetype/ttgload.c | 6 +++--- src/truetype/ttinterp.c | 6 +++--- src/truetype/ttinterp.h | 4 ---- src/truetype/ttobjs.c | 7 +++---- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 0abfb0b92..61731a503 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1181,8 +1181,6 @@ { FT_Error error; FT_Outline* outline = &loader->gloader->base.outline; - FT_Stream stream = loader->stream; - FT_UShort n_ins; FT_UInt i; @@ -1201,8 +1199,10 @@ #ifdef TT_USE_BYTECODE_INTERPRETER { - TT_ExecContext exec = loader->exec; + TT_ExecContext exec = loader->exec; FT_Memory memory = exec->memory; + FT_Stream stream = loader->stream; + FT_UShort n_ins; if ( exec->glyphSize ) diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index cfad9d77a..d400e478d 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -20,6 +20,9 @@ /* issues; many thanks! */ +#ifdef TT_USE_BYTECODE_INTERPRETER + + #include #include #include @@ -34,9 +37,6 @@ #endif -#ifdef TT_USE_BYTECODE_INTERPRETER - - /************************************************************************** * * The macro FT_COMPONENT is used in trace mode. It is an implicit diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index c485371e5..f0e7cee9c 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -401,7 +401,6 @@ FT_BEGIN_HEADER extern const TT_GraphicsState tt_default_graphics_state; -#ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( void ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, @@ -411,7 +410,6 @@ FT_BEGIN_HEADER FT_LOCAL( void ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ /************************************************************************** @@ -438,7 +436,6 @@ FT_BEGIN_HEADER TT_New_Context( TT_Driver driver ); -#ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( void ) TT_Done_Context( TT_ExecContext exec ); @@ -454,7 +451,6 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) TT_Run_Context( TT_ExecContext exec, TT_Size size ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ /************************************************************************** diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index ac54e01a5..e9a73bdf4 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1156,11 +1156,10 @@ FT_LOCAL_DEF( void ) tt_size_done( FT_Size ttsize ) /* TT_Size */ { - TT_Size size = (TT_Size)ttsize; - - #ifdef TT_USE_BYTECODE_INTERPRETER - tt_size_done_bytecode( size ); + tt_size_done_bytecode( (TT_Size)ttsize ); +#else + FT_UNUSED( ttsize ); #endif }