Commit f47d5f0b39f130c3d9d297f64fef2ef3a5635349

David Turner 2002-06-07T22:09:20

debugging new cache hash table implementation

diff --git a/include/freetype/cache/ftccache.h b/include/freetype/cache/ftccache.h
index 9da9891..0a0e6ec 100644
--- a/include/freetype/cache/ftccache.h
+++ b/include/freetype/cache/ftccache.h
@@ -24,7 +24,7 @@
 #undef   FTC_CACHE_USE_INLINE
 
 /* define to use linear hash table */
-#undef   FTC_CACHE_USE_LINEAR_HASHING
+#define  FTC_CACHE_USE_LINEAR_HASHING
 
 FT_BEGIN_HEADER
 
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 9fd37ee..41d2855 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -257,8 +257,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*   Don't define any of these macros to compile in `release' mode!      */
   /*                                                                       */
-#undef  FT_DEBUG_LEVEL_ERROR
-#undef  FT_DEBUG_LEVEL_TRACE
+#define FT_DEBUG_LEVEL_ERROR
+#define FT_DEBUG_LEVEL_TRACE
 
 
   /*************************************************************************/
@@ -273,7 +273,7 @@ FT_BEGIN_HEADER
   /*   Note that the memory debugger is only activated at runtime when     */
   /*   when the _environment_ variable "FT_DEBUG_MEMORY" is also defined!  */
   /*                                                                       */
-#undef  FT_DEBUG_MEMORY
+#define FT_DEBUG_MEMORY
 
 
   /*************************************************************************/
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index da04562..51522d5 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -84,6 +84,8 @@
     }
     else
     {
+      FT_ASSERT( manager->num_nodes == 0 );
+
       node->mru_next = node;
       node->mru_prev = node;
     }
@@ -98,21 +100,23 @@
   ftc_node_mru_unlink( FTC_Node     node,
                        FTC_Manager  manager )
   {
+    FTC_Node  first = manager->nodes_list;
     FTC_Node  prev  = node->mru_prev;
     FTC_Node  next  = node->mru_next;
-    FTC_Node  first = manager->nodes_list;
 
+    FT_ASSERT( first != NULL && manager->num_nodes > 0 );
+    FT_ASSERT( next->mru_prev == node );
+    FT_ASSERT( prev->mru_next == node );
 
-    prev->mru_next = next;
     next->mru_prev = prev;
+    prev->mru_next = next;
 
-    if ( node->mru_next == first )
+    if ( node == first )
     {
-      /* this is the last node in the list; update its head pointer */
-      if ( node == first )
+      if ( node == next )
         manager->nodes_list = NULL;
       else
-        first->mru_prev = prev;
+        manager->nodes_list = next;
     }
 
     node->mru_next = NULL;
@@ -848,7 +852,7 @@
             goto Exit;
           }
 
-          pnode = &(*pnode)->link;
+          pnode = &node->link;
         }
       }
 
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 6b774ad..f4ec779 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -348,6 +348,8 @@
       FT_UInt  offset = (FT_UInt)( char_code - node->first );
 
 
+      FT_ASSERT( offset < FTC_CMAP_INDICES_MAX );
+
       gindex = node->indices[offset];
       if ( gindex == FTC_CMAP_UNKNOWN )
       {
diff --git a/src/type42/rules.mk b/src/type42/rules.mk
index 3e8ea9d..02cca1f 100644
--- a/src/type42/rules.mk
+++ b/src/type42/rules.mk
@@ -45,7 +45,7 @@ T42_DRV_OBJ_S := $(OBJ_)type42.$O
 
 # Type42 driver source file for single build
 #
-T42_DRV_SRC_S := $(T42_DIR_)t42drivr.c
+T42_DRV_SRC_S := $(T42_DIR_)type42.c
 
 
 # Type42 driver - single object