Cleanups.
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
diff --git a/ChangeLog b/ChangeLog
index 1214c2f..f842f31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -84,7 +84,8 @@
* src/pcf/pcfdriver.c, src/pfr/pfrsbit.c,
src/sfnt/ttsbit.c, src/type42/t42objs.c, src/winfonts/winfnt.c:
- * src/cache/ftlru.c: Fixed an invalid assertion check.
+ * src/cache/ftlru.c (FT_LruList_Lookup): Fixed an invalid assertion
+ check.
* src/autohint/ahglyph.c (ah_outline_load): Add two scaling
arguments.
@@ -92,8 +93,8 @@
* src/autohint/ahhint.c (ah_hinter_load): Updated.
* src/autohint/ahglobal.c (ah_hinter_compute_widths): Updated.
- * src/cache/ftccache.c: Fixed small bug that could crash the cache
- in rare circumstances (mostly with broken fonts).
+ * src/cache/ftccache.c (ftc_family_done): Fixed small bug that could
+ crash the cache in rare circumstances (mostly with broken fonts).
2003-03-15 David Turner <david@freetype.org>
@@ -119,9 +120,17 @@
Handle new environment variables.
* docs/DEBUG.TXT: Updated.
- * src/cache/ftccache.c, src/cache/ftccmap.c, src/cache/ftcsbits.c,
- src/cache/ftlru.c: Fixed the cache sub-system to correctly deal with
- out-of-memory conditions.
+ Fixed the cache sub-system to correctly deal with out-of-memory
+ conditions.
+
+ * src/cache/ftccache.c (ftc_node_destroy): Comment out generic
+ check.
+ (ftc_cache_lookup): Implement loop.
+ * src/cache/ftccmap.c: Define FT_COMPONENT.
+ * src/cache/ftcsbits.c (ftc_sbit_node_load): Handle
+ FT_Err_Out_Of_Memory.
+ * src/cache/ftlru.c: Include FT_INTERNAL_DEBUG_H.
+ (FT_LruList_Lookup): Implement loop.
* src/pfr/pfrobjs.c, src/pfr/pfrsbits.c: Fixing compiler warnings
and a small memory leak.
@@ -142,8 +151,9 @@
2003-02-25 Anthony Fok <anthony@thizlinux.com>
- * src/cache/ftccmap.c: The cmap cache now supports UCS-4 charmaps
- when available in Asian fonts.
+ * src/cache/ftccmap.c: Include FT_TRUETYPE_IDS_H.
+ (ftc_cmap_family_init): The cmap cache now
+ supports UCS-4 charmaps when available in Asian fonts.
* src/sfnt/ttload.c, src/base/ftobjs.c: Changed "asian" to "Asian"
in comments.
@@ -218,10 +228,10 @@
* src/pfr/pfrsbit.c: Removed compiler warnings.
- * src/cache/ftccmap.c: Changed an FT_ERROR into an FT_TRACE1 since
- it caused "ftview" and others to dump too much junk when trying to
- display a waterfall with a font without a Unicode charmap (e.g.
- SYMBOL.TTF).
+ * src/cache/ftccmap.c (ftc_cmap_family_init): Changed an FT_ERROR
+ into an FT_TRACE1 since it caused "ftview" and others to dump too
+ much junk when trying to display a waterfall with a font without a
+ Unicode charmap (e.g. SYMBOL.TTF).
Implemented FT_CONFIG_CHESTER_BLUE_SCALE, corresponding to the last
patch from David Chester, but with a much simpler (and saner)
@@ -423,7 +433,7 @@
invalid values for large negative angle differences (resulting in
incorrect stroker computations, among other things).
- * src/cache/ftccache.c (ftc_node_unlink): Removing incorrect
+ * src/cache/ftccache.c (ftc_node_hash_unlink): Removing incorrect
assertion, and changing code to avoid hash table size contraction.
* src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: Adding
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index a12fedc..2ba9b03 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType internal cache interface (body). */
/* */
-/* Copyright 2000-2001, 2002 by */
+/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -196,7 +196,7 @@
FTC_Node* pold;
- if ( old_index+1 <= FTC_HASH_INITIAL_SIZE )
+ if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE )
goto Exit;
if ( p == 0 )
@@ -567,24 +567,24 @@
manager = cache->manager;
- /* here's a small note explaining what's hapenning in the code below.
+ /* here's a small note explaining what's happening in the code below.
*
- * we need to deal intelligently with out-of-memory (OOM) conditions
+ * We need to deal intelligently with out-of-memory (OOM) conditions
* when trying to create a new family or cache node during the lookup.
*
- * when an OOM is detected, we'll try to free one or more "old" nodes
- * from the cache, then try again. it may be necessary to do that several
- * times, so a loop is needed.
+ * When an OOM is detected, we try to free one or more "old" nodes
+ * from the cache, then try again. It may be necessary to do that
+ * several times, so a loop is needed.
*
- * the local variable "free_count" holds the number of "old" nodes to
- * discard on each attempt. it starts at 1 and doubles on each iteration.
- * the loop stops when:
+ * The local variable "free_count" holds the number of "old" nodes to
+ * discard on each attempt. It starts at 1 and doubles on each
+ * iteration. The loop stops when:
*
* - a non-OOM error is detected
* - a succesful lookup is performed
* - there are no more unused nodes in the cache
*
- * for the record, remember that all used nodes appear _before_
+ * For the record, remember that all used nodes appear _before_
* unused ones in the manager's MRU node list.
*/
@@ -747,13 +747,14 @@
if ( error != FT_Err_Out_Of_Memory )
goto Exit;
- /* there is not enough memory, try to release some unused nodes
+ /* There is not enough memory; try to release some unused nodes
* from the cache to make room for a new one.
*/
{
- FT_UInt new_count;
+ FT_UInt new_count;
- new_count = 1 + free_count*2;
+
+ new_count = 1 + free_count * 2;
/* check overflow and bounds */
if ( new_count < free_count || free_count > manager->num_nodes )
@@ -763,22 +764,24 @@
/* try to remove "new_count" nodes from the list */
{
- FTC_Node first = manager->nodes_list;
- FTC_Node node;
+ FTC_Node first = manager->nodes_list;
+ FTC_Node node;
+
- if ( first == NULL ) /* empty list ! */
+ if ( first == NULL ) /* empty list! */
goto Exit;
- /* go to last node - it's a circular list */
+ /* go to last node - it's a circular list */
node = first->mru_prev;
for ( ; node && new_count > 0; new_count-- )
{
FTC_Node prev = node->mru_prev;
- /* used nodes always appear before unused one in the MRU
- * list. if we find one here, we'd better stop right now
- * our iteration
- */
+
+ /* Used nodes always appear before unused one in the MRU
+ * list. If we find one here, we'd better stop right now
+ * our iteration.
+ */
if ( node->ref_count > 0 )
{
/* if there are no unused nodes in the list, we'd better exit */