- removing a typo in ftccache.i that prevented it from compiling correctly - fixed the infamous bug that caused the cache to crash with large fonts. the hash table buckets array wasn't shrinked correctly during cache flushes..
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
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index ca74f4f..00ec2ac 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -211,7 +211,7 @@
cache->mask >>= 1;
p = cache->mask;
- if ( FT_RENEW_ARRAY( cache->buckets, ( mask + 1 ) * 2, mask ) )
+ if ( FT_RENEW_ARRAY( cache->buckets, ( mask + 1 ) * 2, (mask+1) ) )
{
FT_ERROR(( "ftc_node_hash_unlink: couldn't shunk buckets!\n" ));
goto Exit;
diff --git a/src/cache/ftccache.i b/src/cache/ftccache.i
index 3e7ce50..4cd38db 100644
--- a/src/cache/ftccache.i
+++ b/src/cache/ftccache.i
@@ -79,14 +79,16 @@
hash = query->hash;
#ifdef FTC_CACHE_USE_LINEAR_HASHING
- FT_UInt index;
+ {
+ FT_UInt index;
- index = hash & cache->mask;
- if ( index < cache->p )
- index = hash & ( cache->mask * 2 + 1 );
+ index = hash & cache->mask;
+ if ( index < cache->p )
+ index = hash & ( cache->mask * 2 + 1 );
- bucket = cache->buckets + index;
+ bucket = cache->buckets + index;
+ }
#else
bucket = cache->buckets + ( hash % cache->size );
#endif