freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master fce74b7 3/3: [cache] Miscellaneous clean-ups.


From: Werner Lemberg
Subject: [freetype2] master fce74b7 3/3: [cache] Miscellaneous clean-ups.
Date: Thu, 16 Sep 2021 17:08:55 -0400 (EDT)

branch: master
commit fce74b73653a6b871f6165ba289120c29044eb38
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [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.
---
 src/cache/ftccache.c | 9 ++++-----
 src/cache/ftccmap.c  | 7 +++----
 src/cache/ftcsbits.c | 6 +++---
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index fbca490..bae1481 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -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 );
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index cfce0a6..40b449b 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -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 -
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 7e24d81..362999f 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -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 */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]