[cache] Miscellaneous clean-ups.

* src/cache/ftccache.c (ftc_get_top_node_for_hash, FTC_Cache_Clear):
Remove barely used variables.
(ftc_cache_add): Adjust casting.
* src/cache/ftccmap.c (FTC_CMapCache_Lookup): Remove casting.
* src/cache/ftcsbits.c (ftc_snode_load): Remove casting.
This commit is contained in:
Alexei Podtelezhnikov 2021-09-16 17:03:19 -04:00
parent 79d14cc256
commit fce74b7365
3 changed files with 10 additions and 12 deletions

View File

@ -90,15 +90,14 @@
ftc_get_top_node_for_hash( FTC_Cache cache, ftc_get_top_node_for_hash( FTC_Cache cache,
FT_Offset hash ) FT_Offset hash )
{ {
FTC_Node* pnode;
FT_Offset idx; FT_Offset idx;
idx = hash & cache->mask; idx = hash & cache->mask;
if ( idx < cache->p ) if ( idx < cache->p )
idx = hash & ( 2 * cache->mask + 1 ); idx = hash & ( 2 * cache->mask + 1 );
pnode = cache->buckets + idx;
return pnode; return cache->buckets + idx;
} }
#endif /* !FTC_INLINE */ #endif /* !FTC_INLINE */
@ -360,7 +359,7 @@
for ( i = 0; i < count; i++ ) for ( i = 0; i < count; i++ )
{ {
FTC_Node *pnode = cache->buckets + i, next, node = *pnode; FTC_Node node = cache->buckets[i], next;
while ( node ) while ( node )
@ -417,7 +416,7 @@
FTC_Node node ) FTC_Node node )
{ {
node->hash = hash; node->hash = hash;
node->cache_index = (FT_UInt16)cache->index; node->cache_index = (FT_UShort)cache->index;
node->ref_count = 0; node->ref_count = 0;
ftc_node_hash_link( node, cache ); ftc_node_hash_link( node, cache );

7
src/cache/ftccmap.c vendored
View File

@ -273,12 +273,11 @@
if ( error ) if ( error )
goto Exit; goto Exit;
FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) < FT_ASSERT( char_code - FTC_CMAP_NODE( node )->first <
FTC_CMAP_INDICES_MAX ); FTC_CMAP_INDICES_MAX );
/* something rotten can happen with rogue clients */ /* something rotten can happen with rogue clients */
if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >= if ( char_code - FTC_CMAP_NODE( node )->first >= FTC_CMAP_INDICES_MAX )
FTC_CMAP_INDICES_MAX ) )
return 0; /* XXX: should return appropriate error */ return 0; /* XXX: should return appropriate error */
gindex = FTC_CMAP_NODE( node )->indices[char_code - gindex = FTC_CMAP_NODE( node )->indices[char_code -

View File

@ -111,7 +111,7 @@
FTC_SFamilyClass clazz; FTC_SFamilyClass clazz;
if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count ) if ( gindex - gnode->gindex >= snode->count )
{ {
FT_ERROR(( "ftc_snode_load: invalid glyph index" )); FT_ERROR(( "ftc_snode_load: invalid glyph index" ));
return FT_THROW( Invalid_Argument ); return FT_THROW( Invalid_Argument );
@ -342,8 +342,8 @@
if (list_changed) if (list_changed)
*list_changed = FALSE; *list_changed = FALSE;
result = FT_BOOL( gnode->family == gquery->family && result = FT_BOOL( gnode->family == gquery->family &&
(FT_UInt)( gindex - gnode->gindex ) < snode->count ); gindex - gnode->gindex < snode->count );
if ( result ) if ( result )
{ {
/* check if we need to load the glyph bitmap now */ /* check if we need to load the glyph bitmap now */