debugging new cache hash table implementation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
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