* src/cid/cidobjs.c (CID_Face_Done): fixed a memory leak, the subrs routines were never released when CID faces were destroyed
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
diff --git a/ChangeLog b/ChangeLog
index 191ab7b..699a553 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2001-12-21 David Turner <david@freetype.org>
+ * include/freetype/cache/ftcmanag.h, include/freetype/cache/ftcimage.h,
+ include/freetype/cache/ftcsbits.h: updating documentation to better
+ explain the use of the "anode" output parameter in lookup functions
+
* src/pshinter/pshglob.c (psh_globals_new): Replaced a floating
point constant with a fixed-float equivalent. For some reasons not
all compilers are capable of directly computing a floating pointer
diff --git a/include/freetype/cache/ftcimage.h b/include/freetype/cache/ftcimage.h
index bc75466..f12ee29 100644
--- a/include/freetype/cache/ftcimage.h
+++ b/include/freetype/cache/ftcimage.h
@@ -170,6 +170,7 @@ FT_BEGIN_HEADER
/* */
/* anode :: used to return the address of of the corresponding */
/* cache node after incrementing its reference count */
+ /* (see note below) */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
diff --git a/include/freetype/cache/ftcmanag.h b/include/freetype/cache/ftcmanag.h
index 44e2dab..7db644c 100644
--- a/include/freetype/cache/ftcmanag.h
+++ b/include/freetype/cache/ftcmanag.h
@@ -152,7 +152,7 @@ FT_BEGIN_HEADER
/* between abstract @FTC_FaceID values and real */
/* @FT_Face objects. */
/* */
- /* families :: XXX */
+ /* families :: global table of families. */
/* */
typedef struct FTC_ManagerRec_
{
diff --git a/include/freetype/cache/ftcsbits.h b/include/freetype/cache/ftcsbits.h
index 8e04c89..181cfd2 100644
--- a/include/freetype/cache/ftcsbits.h
+++ b/include/freetype/cache/ftcsbits.h
@@ -164,10 +164,9 @@ FT_BEGIN_HEADER
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
- /* anode :: An opaque cache node pointer that will be used */
- /* to release the sbit once it becomes unuseful. */
- /* Can be NULL, in which case this function will */
- /* have the same effect as @FTC_SBitCache_Lookup. XXX */
+ /* anode :: used to return the address of of the corresponding */
+ /* cache node after incrementing its reference count */
+ /* (see note below) */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -181,6 +180,17 @@ FT_BEGIN_HEADER
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
+ /* If "anode" is _not_ NULL, it receives the address of the cache */
+ /* node containing the bitmap, after increasing its reference */
+ /* count. This ensures that the node (as well as the image) will */
+ /* always be kept in the cache until you call @FTC_Node_Unref to */
+ /* "release" it. */
+ /* */
+ /* If "anode" is NULL, the cache node is left unchanged, which means */
+ /* that the bitmap could be flushed out of the cache on the next */
+ /* call to one of the caching sub-system APIs. Just don't assume */
+ /* that it's persistent.. */
+ /* */
FT_EXPORT( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageDesc* desc,
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index ad39013..5611291 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -446,7 +446,7 @@
if ( FILE_Seek( cid->data_offset + offsets[0] ) ||
FILE_Read( subr->code[0], data_len ) )
- goto Exit;
+ goto Fail;
/* set up pointers */
for ( count = 1; count <= num_subrs; count++ )
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index e2eb679..2d1e6b3 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -196,6 +196,25 @@
memory = face->root.memory;
+ /* release subrs */
+ if ( face->subrs )
+ {
+ FT_Int n;
+
+ for ( n = 0; n < cid->num_dicts; n++ )
+ {
+ CID_Subrs* subr = face->subrs + n;
+
+ if ( subr->code )
+ {
+ FREE( subr->code[0] );
+ FREE( subr->code );
+ }
+ }
+
+ FREE( face->subrs );
+ }
+
/* release FontInfo strings */
FREE( info->version );
FREE( info->notice );
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 34f29fe..4d4faf0 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -123,7 +123,7 @@
size->root.metrics.x_scale,
size->root.metrics.y_scale,
0, 0 );
- return error;
+ return error;
}