* 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
diff --git a/ChangeLog b/ChangeLog
index f781a90..a24e9fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index 797d35f..f3e699c 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -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--;
}
diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h
index 6c9b9b9..8c0a7c9 100644
--- a/src/cache/ftccache.h
+++ b/src/cache/ftccache.h
@@ -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; \
diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h
index 1a5d12d..87a4199 100644
--- a/src/cache/ftcglyph.h
+++ b/src/cache/ftcglyph.h
@@ -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 */
diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c
index 5b18684..4eb3d91 100644
--- a/src/pshinter/pshmod.c
+++ b/src/pshinter/pshmod.c
@@ -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;
}
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index 63837b4..0289b85 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -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;