Commit 039b9071f31a33070ee8467584adb309a1007e5b

Alexei Podtelezhnikov 2022-08-01T20:19:12

[cache] Remove some casts, clean up tracing. * src/cache/ftcbasic.c (FTC_ImageCache_Lookup, FTC_SBitCache_Lookup): Clean up tracing types. * src/cache/ftccache.c (ftc_node_destroy): Ditto. * src/cache/ftcmanag.c (FTC_Manager_Check): Ditto. (FTC_Manager_Check, FTC_Node_Unref): Remove a cast. * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto.

diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index 635b17d..68ca40e 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -320,7 +320,7 @@
 #if 0xFFFFFFFFUL > FT_UINT_MAX
     if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
       FT_TRACE1(( "FTC_ImageCache_Lookup:"
-                  " higher bits in load_flags 0x%x are dropped\n",
+                  " higher bits in load_flags 0x%lx are dropped\n",
                   (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
 #endif
 
@@ -518,7 +518,7 @@
 #if 0xFFFFFFFFUL > FT_UINT_MAX
     if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
       FT_TRACE1(( "FTC_ImageCache_Lookup:"
-                  " higher bits in load_flags 0x%x are dropped\n",
+                  " higher bits in load_flags 0x%lx are dropped\n",
                   (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
 #endif
 
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index ab4ad2f..199bf87 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -307,7 +307,7 @@
 #if 0
     /* check, just in case of general corruption :-) */
     if ( manager->num_nodes == 0 )
-      FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%d)\n",
+      FT_TRACE0(( "ftc_node_destroy: invalid cache node count (%u)\n",
                   manager->num_nodes ));
 #endif
   }
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 0ee1834..8e97a7b 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -295,7 +295,7 @@
       if ( error )
         goto Exit;
 
-      if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
+      if ( cmap_index < face->num_charmaps )
       {
         FT_CharMap  old, cmap  = NULL;
 
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index 49f037a..6d6b1e0 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -488,8 +488,8 @@
         FTC_Cache  cache = manager->caches[node->cache_index];
 
 
-        if ( (FT_UInt)node->cache_index >= manager->num_caches )
-          FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
+        if ( node->cache_index >= manager->num_caches )
+          FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %hu\n",
                       node->cache_index ));
         else
           weight += cache->clazz.node_weight( node, cache );
@@ -519,7 +519,7 @@
 
       if ( count != manager->num_nodes )
         FT_TRACE0(( "FTC_Manager_Check:"
-                    " invalid cache node count %d instead of %d\n",
+                    " invalid cache node count %u instead of %u\n",
                     manager->num_nodes, count ));
     }
   }
@@ -547,7 +547,7 @@
 #ifdef FT_DEBUG_ERROR
     FTC_Manager_Check( manager );
 
-    FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
+    FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %u\n",
                 manager->cur_weight, manager->max_weight,
                 manager->num_nodes ));
 #endif
@@ -693,9 +693,9 @@
   FTC_Node_Unref( FTC_Node     node,
                   FTC_Manager  manager )
   {
-    if ( node                                             &&
-         manager                                          &&
-         (FT_UInt)node->cache_index < manager->num_caches )
+    if ( node                                    &&
+         manager                                 &&
+         node->cache_index < manager->num_caches )
       node->ref_count--;
   }