* src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink),

src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP), src/cache/ftcglyph.h
(FTC_GCACHE_LOOKUP_CMP), src/pshinter/pshmod.c (ps_hinter_init),
src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_load_hhea,
tt_face_get_metrics): Fix type-punning issues.
This commit is contained in:
Werner Lemberg 2007-05-16 15:19:42 +00:00
parent 6ae7ff0607
commit 95bc9d3a07
6 changed files with 55 additions and 24 deletions

View File

@ -1,3 +1,11 @@
2007-05-16 Werner Lemberg <wl@gnu.org>
* src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink),
src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP), src/cache/ftcglyph.h
(FTC_GCACHE_LOOKUP_CMP), src/pshinter/pshmod.c (ps_hinter_init),
src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_load_hhea,
tt_face_get_metrics): Fix type-punning issues.
2007-05-15 David Turner <david@freetype.org>
* include/freetype/config/ftstdlib.h,

12
src/cache/ftccache.c vendored
View File

@ -4,7 +4,7 @@
/* */
/* The FreeType internal cache interface (body). */
/* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -46,7 +46,10 @@
ftc_node_mru_link( FTC_Node node,
FTC_Manager manager )
{
FTC_MruNode_Prepend( (FTC_MruNode*)&manager->nodes_list,
void *nl = &manager->nodes_list;
FTC_MruNode_Prepend( (FTC_MruNode*)nl,
(FTC_MruNode)node );
manager->num_nodes++;
}
@ -57,7 +60,10 @@
ftc_node_mru_unlink( FTC_Node node,
FTC_Manager manager )
{
FTC_MruNode_Remove( (FTC_MruNode*)&manager->nodes_list,
void *nl = &manager->nodes_list;
FTC_MruNode_Remove( (FTC_MruNode*)nl,
(FTC_MruNode)node );
manager->num_nodes--;
}

View File

@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -233,10 +233,11 @@ FT_BEGIN_HEADER
\
{ \
FTC_Manager _manager = _cache->manager; \
void* _nl = &_manager->nodes_list; \
\
\
if ( _node != _manager->nodes_list ) \
FTC_MruNode_Up( (FTC_MruNode*)&_manager->nodes_list, \
FTC_MruNode_Up( (FTC_MruNode*)_nl, \
(FTC_MruNode)_node ); \
} \
goto _Ok; \

15
src/cache/ftcglyph.h vendored
View File

@ -4,7 +4,7 @@
/* */
/* FreeType abstract glyph cache (specification). */
/* */
/* Copyright 2000-2001, 2003, 2004, 2006 by */
/* Copyright 2000-2001, 2003, 2004, 2006, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -300,11 +300,14 @@ FT_BEGIN_HEADER
#else /* !FTC_INLINE */
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \
FTC_GQUERY( query ), (FTC_Node*)&(node) ); \
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
void* _n = &(node); \
\
\
error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \
FTC_GQUERY( query ), (FTC_Node*)_n ); \
FT_END_STMNT
#endif /* !FTC_INLINE */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType PostScript hinter module implementation (body). */
/* */
/* Copyright 2001, 2002 by */
/* Copyright 2001, 2002, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -51,6 +51,7 @@
ps_hinter_init( PS_Hinter_Module module )
{
FT_Memory memory = module->root.memory;
void* ph = &module->ps_hints;
ps_hints_init( &module->ps_hints, memory );
@ -58,10 +59,10 @@
psh_globals_funcs_init( &module->globals_funcs );
t1_hints_funcs_init( &module->t1_funcs );
module->t1_funcs.hints = (T1_Hints)&module->ps_hints;
module->t1_funcs.hints = (T1_Hints)ph;
t2_hints_funcs_init( &module->t2_funcs );
module->t2_funcs.hints = (T2_Hints)&module->ps_hints;
module->t2_funcs.hints = (T2_Hints)ph;
return 0;
}

View File

@ -110,40 +110,48 @@
FT_ULong table_len;
FT_Long num_shorts, num_longs, num_shorts_checked;
TT_LongMetrics * longs;
TT_LongMetrics* longs;
TT_ShortMetrics** shorts;
FT_Byte* p;
if ( vertical )
{
void* lm = &face->vertical.long_metrics;
void** sm = &face->vertical.short_metrics;
error = face->goto_table( face, TTAG_vmtx, stream, &table_len );
if ( error )
goto Fail;
num_longs = face->vertical.number_Of_VMetrics;
if ( (FT_ULong)num_longs > table_len / 4 )
num_longs = (FT_Long)(table_len / 4);
num_longs = (FT_Long)( table_len / 4 );
face->vertical.number_Of_VMetrics = 0;
longs = (TT_LongMetrics *)&face->vertical.long_metrics;
shorts = (TT_ShortMetrics**)&face->vertical.short_metrics;
longs = (TT_LongMetrics*)lm;
shorts = (TT_ShortMetrics**)sm;
}
else
{
void* lm = &face->horizontal.long_metrics;
void** sm = &face->horizontal.short_metrics;
error = face->goto_table( face, TTAG_hmtx, stream, &table_len );
if ( error )
goto Fail;
num_longs = face->horizontal.number_Of_HMetrics;
if ( (FT_ULong)num_longs > table_len / 4 )
num_longs = (FT_Long)(table_len / 4);
num_longs = (FT_Long)( table_len / 4 );
face->horizontal.number_Of_HMetrics = 0;
longs = (TT_LongMetrics *)&face->horizontal.long_metrics;
shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics;
longs = (TT_LongMetrics*)lm;
shorts = (TT_ShortMetrics**)sm;
}
/* never trust derived values */
@ -279,11 +287,14 @@
if ( vertical )
{
void *v = &face->vertical;
error = face->goto_table( face, TTAG_vhea, stream, 0 );
if ( error )
goto Fail;
header = (TT_HoriHeader*)&face->vertical;
header = (TT_HoriHeader*)v;
}
else
{
@ -415,8 +426,9 @@
FT_Short* abearing,
FT_UShort* aadvance )
{
TT_HoriHeader* header = vertical ? (TT_HoriHeader*)&face->vertical
: &face->horizontal;
void* v = &face->vertical;
void* h = &face->horizontal;
TT_HoriHeader* header = vertical ? (TT_HoriHeader*)v : h;
TT_LongMetrics longs_m;
FT_UShort k = header->number_Of_HMetrics;