[cache] Replace `FT_PtrDist' with `FT_Offset'.

* src/cache/ftccache.h (FTC_NodeRec): `FT_Offset' (a.k.a. `size_t')
is a better choice for `hash' to hold a pointer than `FT_PtrDist'
(a.k.a. `ptrdiff_t'), especially since the latter is signed,
causing zillions of signedness warnings.  [Note that `hash' was of
type `FT_UInt32' before the change to `FT_PtrDist.]
Update all users.

* src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccmap.c,
src/cache/ftcglyph.c, src/cache/ftcglyph.h: Updated.
This commit is contained in:
Werner Lemberg 2015-02-23 08:20:27 +01:00
parent 4d1f7af17b
commit 3aaebe3a91
7 changed files with 40 additions and 26 deletions

View File

@ -1,3 +1,17 @@
2015-02-23 Werner Lemberg <wl@gnu.org>
[cache] Replace `FT_PtrDist' with `FT_Offset'.
* src/cache/ftccache.h (FTC_NodeRec): `FT_Offset' (a.k.a. `size_t')
is a better choice for `hash' to hold a pointer than `FT_PtrDist'
(a.k.a. `ptrdiff_t'), especially since the latter is signed,
causing zillions of signedness warnings. [Note that `hash' was of
type `FT_UInt32' before the change to `FT_PtrDist.]
Update all users.
* src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccmap.c,
src/cache/ftcglyph.c, src/cache/ftcglyph.h: Updated.
2015-02-23 Werner Lemberg <wl@gnu.org>
[smooth, raster] Re-enable standalone compilation.
@ -306,7 +320,7 @@
type to `FT_Long'.
(CONST_FT_RFORK_RULE_ARRAY_BEGIN): Add `static' keyword.
* include/internal/ftstream.h (FT_Stream_Pos): Return `FT_ULong'.
* include/internal/ftstream.h (FT_Stream_Pos): Return `FT_ULong'.
* src/base/ftoutln.c, src/base/ftrfork.c, src/base/ftstream.c:
Signedess fixes.

12
src/cache/ftcbasic.c vendored
View File

@ -45,8 +45,8 @@
FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \
(a)->load_flags == (b)->load_flags )
#define FTC_BASIC_ATTR_HASH( a ) \
( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags )
#define FTC_BASIC_ATTR_HASH( a ) \
( FTC_SCALER_HASH( &(a)->scaler ) + 31 * (a)->load_flags )
typedef struct FTC_BasicQueryRec_
@ -283,7 +283,7 @@
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
FT_Error error;
FT_PtrDist hash;
FT_Offset hash;
/* some argument checks are delayed to `FTC_Cache_Lookup' */
@ -356,7 +356,7 @@
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
FT_Error error;
FT_PtrDist hash;
FT_Offset hash;
/* some argument checks are delayed to `FTC_Cache_Lookup' */
@ -466,7 +466,7 @@
FT_Error error;
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
FT_PtrDist hash;
FT_Offset hash;
if ( anode )
@ -541,7 +541,7 @@
FT_Error error;
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
FT_PtrDist hash;
FT_Offset hash;
if ( anode )

16
src/cache/ftccache.c vendored
View File

@ -88,16 +88,16 @@
* body for FTC_NODE__TOP_FOR_HASH( cache, hash )
*/
FT_LOCAL_DEF( FTC_Node* )
ftc_get_top_node_for_hash( FTC_Cache cache,
FT_PtrDist hash )
ftc_get_top_node_for_hash( FTC_Cache cache,
FT_Offset hash )
{
FTC_Node* pnode;
FT_UInt idx;
FT_Offset idx;
idx = (FT_UInt)( hash & cache->mask );
idx = hash & cache->mask;
if ( idx < cache->p )
idx = (FT_UInt)( hash & ( 2 * cache->mask + 1 ) );
idx = hash & ( 2 * cache->mask + 1 );
pnode = cache->buckets + idx;
return pnode;
}
@ -414,7 +414,7 @@
static void
ftc_cache_add( FTC_Cache cache,
FT_PtrDist hash,
FT_Offset hash,
FTC_Node node )
{
node->hash = hash;
@ -442,7 +442,7 @@
FT_LOCAL_DEF( FT_Error )
FTC_Cache_NewNode( FTC_Cache cache,
FT_PtrDist hash,
FT_Offset hash,
FT_Pointer query,
FTC_Node *anode )
{
@ -481,7 +481,7 @@
FT_LOCAL_DEF( FT_Error )
FTC_Cache_Lookup( FTC_Cache cache,
FT_PtrDist hash,
FT_Offset hash,
FT_Pointer query,
FTC_Node *anode )
{

16
src/cache/ftccache.h vendored
View File

@ -24,8 +24,8 @@
FT_BEGIN_HEADER
#define _FTC_FACE_ID_HASH( i ) \
((FT_PtrDist)(( (FT_PtrDist)(i) >> 3 ) ^ ( (FT_PtrDist)(i) << 7 )))
#define _FTC_FACE_ID_HASH( i ) \
( ( (FT_Offset)(i) >> 3 ) ^ ( (FT_Offset)(i) << 7 ) )
/* handle to cache object */
typedef struct FTC_CacheRec_* FTC_Cache;
@ -59,7 +59,7 @@ FT_BEGIN_HEADER
{
FTC_MruNodeRec mru; /* circular mru list pointer */
FTC_Node link; /* used for hashing */
FT_PtrDist hash; /* used for hashing too */
FT_Offset hash; /* used for hashing too */
FT_UShort cache_index; /* index of cache the node belongs to */
FT_Short ref_count; /* reference count for this node */
@ -80,8 +80,8 @@ FT_BEGIN_HEADER
: ( ( hash ) & ( cache )->mask ) ) )
#else
FT_LOCAL( FTC_Node* )
ftc_get_top_node_for_hash( FTC_Cache cache,
FT_PtrDist hash );
ftc_get_top_node_for_hash( FTC_Cache cache,
FT_Offset hash );
#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \
ftc_get_top_node_for_hash( ( cache ), ( hash ) )
#endif
@ -179,14 +179,14 @@ FT_BEGIN_HEADER
#ifndef FTC_INLINE
FT_LOCAL( FT_Error )
FTC_Cache_Lookup( FTC_Cache cache,
FT_PtrDist hash,
FT_Offset hash,
FT_Pointer query,
FTC_Node *anode );
#endif
FT_LOCAL( FT_Error )
FTC_Cache_NewNode( FTC_Cache cache,
FT_PtrDist hash,
FT_Offset hash,
FT_Pointer query,
FTC_Node *anode );
@ -211,7 +211,7 @@ FT_BEGIN_HEADER
FT_BEGIN_STMNT \
FTC_Node *_bucket, *_pnode, _node; \
FTC_Cache _cache = FTC_CACHE(cache); \
FT_PtrDist _hash = (FT_PtrDist)(hash); \
FT_Offset _hash = (FT_Offset)(hash); \
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \
FT_Bool _list_changed = FALSE; \
\

2
src/cache/ftccmap.c vendored
View File

@ -242,7 +242,7 @@
FTC_Node node;
FT_Error error;
FT_UInt gindex = 0;
FT_PtrDist hash;
FT_Offset hash;
FT_Int no_cmap_change = 0;

View File

@ -185,7 +185,7 @@
FT_LOCAL_DEF( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
FT_PtrDist hash,
FT_Offset hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode )

View File

@ -260,7 +260,7 @@ FT_BEGIN_HEADER
#ifndef FTC_INLINE
FT_LOCAL( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
FT_PtrDist hash,
FT_Offset hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode );