summaryrefslogtreecommitdiffstats
path: root/src/cache
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache')
-rw-r--r--src/cache/ftcbasic.c95
-rw-r--r--src/cache/ftccache.c18
-rw-r--r--src/cache/ftccache.h18
-rw-r--r--src/cache/ftccback.h2
-rw-r--r--src/cache/ftccmap.c19
-rw-r--r--src/cache/ftcglyph.c4
-rw-r--r--src/cache/ftcglyph.h4
-rw-r--r--src/cache/ftcmanag.h2
-rw-r--r--src/cache/ftcmru.c2
-rw-r--r--src/cache/ftcsbits.c14
-rw-r--r--src/cache/ftcsbits.h2
11 files changed, 84 insertions, 96 deletions
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index 01be88c..ac3290c 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType basic cache interface (body). */
/* */
-/* Copyright 2003-2007, 2009-2011, 2013, 2014 by */
+/* Copyright 2003-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -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_
@@ -110,10 +110,9 @@
return result;
if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
- {
- FT_TRACE1(( "ftc_basic_family_get_count: too large number of glyphs " ));
- FT_TRACE1(( "in this face, truncated\n", face->num_glyphs ));
- }
+ FT_TRACE1(( "ftc_basic_family_get_count:"
+ " too large number of glyphs in this face, truncated\n",
+ face->num_glyphs ));
if ( !error )
result = (FT_UInt)face->num_glyphs;
@@ -139,8 +138,10 @@
FT_Face face = size->face;
- error = FT_Load_Glyph( face, gindex,
- family->attrs.load_flags | FT_LOAD_RENDER );
+ error = FT_Load_Glyph(
+ face,
+ gindex,
+ (FT_Int)family->attrs.load_flags | FT_LOAD_RENDER );
if ( !error )
*aface = face;
}
@@ -170,7 +171,9 @@
{
face = size->face;
- error = FT_Load_Glyph( face, gindex, family->attrs.load_flags );
+ error = FT_Load_Glyph( face,
+ gindex,
+ (FT_Int)family->attrs.load_flags );
if ( !error )
{
if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP ||
@@ -284,10 +287,10 @@
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 */
+ /* some argument checks are delayed to `FTC_Cache_Lookup' */
if ( !aglyph )
{
error = FT_THROW( Invalid_Argument );
@@ -298,18 +301,15 @@
if ( anode )
*anode = NULL;
- {
- if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
- {
- FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
- FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));
- }
+ if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX )
+ FT_TRACE1(( "FTC_ImageCache_Lookup:"
+ " higher bits in load_flags 0x%x are dropped\n",
+ (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
- query.attrs.scaler.face_id = type->face_id;
- query.attrs.scaler.width = type->width;
- query.attrs.scaler.height = type->height;
- query.attrs.load_flags = (FT_UInt)type->flags;
- }
+ query.attrs.scaler.face_id = type->face_id;
+ query.attrs.scaler.width = type->width;
+ query.attrs.scaler.height = type->height;
+ query.attrs.load_flags = (FT_UInt)type->flags;
query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */
@@ -360,10 +360,10 @@
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 */
+ /* some argument checks are delayed to `FTC_Cache_Lookup' */
if ( !aglyph || !scaler )
{
error = FT_THROW( Invalid_Argument );
@@ -374,12 +374,11 @@
if ( anode )
*anode = NULL;
- /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
+ /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */
if ( load_flags > FT_UINT_MAX )
- {
- FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
- FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
- }
+ FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
+ " higher bits in load_flags 0x%x are dropped\n",
+ load_flags & ~((FT_ULong)FT_UINT_MAX) ));
query.attrs.scaler = scaler[0];
query.attrs.load_flags = (FT_UInt)load_flags;
@@ -471,30 +470,27 @@
FT_Error error;
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
- FT_PtrDist hash;
+ FT_Offset hash;
if ( anode )
*anode = NULL;
- /* other argument checks delayed to FTC_Cache_Lookup */
+ /* other argument checks delayed to `FTC_Cache_Lookup' */
if ( !ansbit )
return FT_THROW( Invalid_Argument );
*ansbit = NULL;
- {
- if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
- {
- FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
- FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));
- }
+ if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX )
+ FT_TRACE1(( "FTC_ImageCache_Lookup:"
+ " higher bits in load_flags 0x%x are dropped\n",
+ (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
- query.attrs.scaler.face_id = type->face_id;
- query.attrs.scaler.width = type->width;
- query.attrs.scaler.height = type->height;
- query.attrs.load_flags = (FT_UInt)type->flags;
- }
+ query.attrs.scaler.face_id = type->face_id;
+ query.attrs.scaler.width = type->width;
+ query.attrs.scaler.height = type->height;
+ query.attrs.load_flags = (FT_UInt)type->flags;
query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */
@@ -549,24 +545,23 @@
FT_Error error;
FTC_BasicQueryRec query;
FTC_Node node = 0; /* make compiler happy */
- FT_PtrDist hash;
+ FT_Offset hash;
if ( anode )
*anode = NULL;
- /* other argument checks delayed to FTC_Cache_Lookup */
+ /* other argument checks delayed to `FTC_Cache_Lookup' */
if ( !ansbit || !scaler )
return FT_THROW( Invalid_Argument );
*ansbit = NULL;
- /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
+ /* `FT_Load_Glyph' and `FT_Load_Char' take FT_UInt flags */
if ( load_flags > FT_UINT_MAX )
- {
- FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
- FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
- }
+ FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
+ " higher bits in load_flags 0x%x are dropped\n",
+ load_flags & ~((FT_ULong)FT_UINT_MAX) ));
query.attrs.scaler = scaler[0];
query.attrs.load_flags = (FT_UInt)load_flags;
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index f20dd45..d8c5b99 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType internal cache interface (body). */
/* */
-/* Copyright 2000-2007, 2009-2011, 2013 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -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 )
{
diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h
index 4155f32..4e17c7a 100644
--- a/src/cache/ftccache.h
+++ b/src/cache/ftccache.h
@@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
-/* Copyright 2000-2007, 2009-2011, 2013 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -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; \
\
diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h
index 9528279..b3237d5 100644
--- a/src/cache/ftccback.h
+++ b/src/cache/ftccback.h
@@ -4,7 +4,7 @@
/* */
/* Callback functions of the caching sub-system (specification only). */
/* */
-/* Copyright 2004-2006, 2011, 2013 by */
+/* Copyright 2004-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index b2e9609..b826222 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
/* */
/* FreeType CharMap cache (body) */
/* */
-/* Copyright 2000-2014 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -63,8 +63,6 @@
} FTC_CMapQueryRec, *FTC_CMapQuery;
#define FTC_CMAP_QUERY( x ) ((FTC_CMapQuery)(x))
-#define FTC_CMAP_QUERY_HASH( x ) \
- FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )
/* the cmap cache node */
typedef struct FTC_CMapNodeRec_
@@ -78,8 +76,6 @@
} FTC_CMapNodeRec, *FTC_CMapNode;
#define FTC_CMAP_NODE( x ) ( (FTC_CMapNode)( x ) )
-#define FTC_CMAP_NODE_HASH( x ) \
- FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )
/* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */
/* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */
@@ -242,7 +238,7 @@
FTC_Node node;
FT_Error error;
FT_UInt gindex = 0;
- FT_PtrDist hash;
+ FT_Offset hash;
FT_Int no_cmap_change = 0;
@@ -263,11 +259,14 @@
return 0;
}
+ if ( !face_id )
+ return 0;
+
query.face_id = face_id;
query.cmap_index = (FT_UInt)cmap_index;
query.char_code = char_code;
- hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );
+ hash = FTC_CMAP_HASH( face_id, (FT_UInt)cmap_index, char_code );
#if 1
FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
@@ -301,12 +300,6 @@
if ( error )
goto Exit;
-#ifdef FT_MAX_CHARMAP_CACHEABLE
- /* something rotten can happen with rogue clients */
- if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE )
- return 0; /* XXX: should return appropriate error */
-#endif
-
if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
{
FT_CharMap old, cmap = NULL;
diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c
index 441e177..343b8a7 100644
--- a/src/cache/ftcglyph.c
+++ b/src/cache/ftcglyph.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Glyph Image (FT_Glyph) cache (body). */
/* */
-/* Copyright 2000-2001, 2003, 2004, 2006, 2009, 2011 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -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 )
diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h
index 5fed19c..6cadbe2 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, 2007, 2011 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -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 );
diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h
index 0aec33c..c6787b7 100644
--- a/src/cache/ftcmanag.h
+++ b/src/cache/ftcmanag.h
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
-/* Copyright 2000-2001, 2003, 2004, 2006, 2010, 2013 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c
index dc8b4cc..10ce4f3 100644
--- a/src/cache/ftcmru.c
+++ b/src/cache/ftcmru.c
@@ -4,7 +4,7 @@
/* */
/* FreeType MRU support (body). */
/* */
-/* Copyright 2003, 2004, 2006, 2009 by */
+/* Copyright 2003-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 6df1c19..8141719 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
/* */
/* FreeType sbits manager (body). */
/* */
-/* Copyright 2000-2006, 2009-2011, 2013 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -52,7 +52,7 @@
if ( pitch < 0 )
pitch = -pitch;
- size = (FT_ULong)( pitch * bitmap->rows );
+ size = (FT_ULong)pitch * bitmap->rows;
if ( !FT_ALLOC( sbit->buffer, size ) )
FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
@@ -142,12 +142,12 @@
goto BadGlyph;
}
- /* Check that our values fit into 8-bit containers! */
+ /* Check whether our values fit into 8-bit containers! */
/* If this is not the case, our bitmap is too large */
/* and we will leave it as `missing' with sbit.buffer = 0 */
-#define CHECK_CHAR( d ) ( temp = (FT_Char)d, temp == d )
-#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d )
+#define CHECK_CHAR( d ) ( temp = (FT_Char)d, (FT_Int) temp == (FT_Int) d )
+#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, (FT_UInt)temp == (FT_UInt)d )
/* horizontal advance in pixels */
xadvance = ( slot->advance.x + 32 ) >> 6;
@@ -181,7 +181,7 @@
/* now, compute size */
if ( asize )
- *asize = FT_ABS( sbit->pitch ) * sbit->height;
+ *asize = (FT_ULong)FT_ABS( sbit->pitch ) * sbit->height;
} /* glyph loading successful */
@@ -302,7 +302,7 @@
pitch = -pitch;
/* add the size of a given glyph image */
- size += pitch * sbit->height;
+ size += (FT_Offset)pitch * sbit->height;
}
}
diff --git a/src/cache/ftcsbits.h b/src/cache/ftcsbits.h
index df55dca..5a2fa1a 100644
--- a/src/cache/ftcsbits.h
+++ b/src/cache/ftcsbits.h
@@ -4,7 +4,7 @@
/* */
/* A small-bitmap cache (specification). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2006, 2011 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */