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

7
src/cache/ftccmap.c vendored
View File

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

View File

@ -111,7 +111,7 @@
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" ));
return FT_THROW( Invalid_Argument );
@ -342,8 +342,8 @@
if (list_changed)
*list_changed = FALSE;
result = FT_BOOL( gnode->family == gquery->family &&
(FT_UInt)( gindex - gnode->gindex ) < snode->count );
result = FT_BOOL( gnode->family == gquery->family &&
gindex - gnode->gindex < snode->count );
if ( result )
{
/* check if we need to load the glyph bitmap now */