Introduce FT_UINT_TO_POINTER macro (#50560).

We have to make a separate case for Windows 64's LLP64 data model.

* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro.

* src/truetype/ttgload.c (load_truetype_glyph): Use it.
This commit is contained in:
Werner Lemberg 2017-03-18 17:30:42 +01:00
parent 3e79254ae7
commit 7aeee3c50f
5 changed files with 41 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2017-03-18 Werner Lemberg <wl@gnu.org>
Introduce FT_UINT_TO_POINTER macro (#50560).
We have to make a separate case for Windows 64's LLP64 data model.
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
include/freetype/config/ftconfig.h (FT_UINT_TO_POINTER): New macro.
* src/truetype/ttgload.c (load_truetype_glyph): Use it.
2017-03-18 Werner Lemberg <wl@gnu.org>
* src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#50573).

View File

@ -365,6 +365,15 @@ FT_BEGIN_HEADER
#endif
#ifdef _WIN64
/* only 64bit Windows uses the LLP64 data model, i.e., */
/* 32bit integers, 64bit pointers */
#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x)
#else
#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
#endif
/*************************************************************************/
/* */
/* miscellaneous */

View File

@ -306,6 +306,15 @@ FT_BEGIN_HEADER
#endif
#ifdef _WIN64
/* only 64bit Windows uses the LLP64 data model, i.e., */
/* 32bit integers, 64bit pointers */
#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x)
#else
#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
#endif
/*************************************************************************/
/* */
/* miscellaneous */

View File

@ -333,6 +333,15 @@ FT_BEGIN_HEADER
#endif
#ifdef _WIN64
/* only 64bit Windows uses the LLP64 data model, i.e., */
/* 32bit integers, 64bit pointers */
#define FT_UINT_TO_POINTER( x ) (void*)(FT_UInt64)(x)
#else
#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
#endif
/*************************************************************************/
/* */
/* miscellaneous */

View File

@ -1711,7 +1711,7 @@
/* check whether we already have a composite glyph with this index */
if ( FT_List_Find( &loader->composites,
(void*)(unsigned long)glyph_index ) )
FT_UINT_TO_POINTER( glyph_index ) ) )
{
FT_TRACE1(( "TT_Load_Composite_Glyph:"
" infinite recursion detected\n" ));
@ -1720,13 +1720,13 @@
}
else if ( node )
node->data = (void*)(unsigned long)glyph_index;
node->data = FT_UINT_TO_POINTER( glyph_index );
else
{
if ( FT_NEW( node ) )
goto Exit;
node->data = (void*)(unsigned long)glyph_index;
node->data = FT_UINT_TO_POINTER( glyph_index );
FT_List_Add( &loader->composites, node );
}