use stream->memory instead of malloc/free.
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
diff --git a/src/macfond/fonddrvr.c b/src/macfond/fonddrvr.c
index 5a205ee..3f68fe1 100644
--- a/src/macfond/fonddrvr.c
+++ b/src/macfond/fonddrvr.c
@@ -61,12 +61,6 @@
which is set to the FOND driver upon entering our init_face() --
gets *reset* to either the TT or the T1 driver. I had to make a minor
change to ftobjs.c to make this work.
-
- - Small note about memory: I use malloc() to allocate the buffer
- for the Type 1 data. Of course it would be better to do this
- through the library->memory stuff, but I can't access that from
- my stream->close() method! Maybe it would be better to use the
- Mac native NewPtr() and DisposePtr() calls.
*/
#include <ttobjs.h>
@@ -256,7 +250,7 @@
/* Read Type 1 data from the POST resources inside the LWFN file, return a
PFB buffer -- apparently FT doesn't like a pure binary T1 stream. */
static
- char* read_type1_data( FSSpec* lwfn_spec, unsigned long *size )
+ char* read_type1_data( FT_Memory memory, FSSpec* lwfn_spec, unsigned long *size )
{
short res_ref, res_id;
unsigned char *buffer, *p;
@@ -281,7 +275,7 @@
total_size += 2;
}
- buffer = malloc( total_size );
+ buffer = memory->alloc( memory, total_size );
if ( !buffer )
goto error;
@@ -347,7 +341,7 @@ error:
static
void lwfn_stream_close( FT_Stream stream )
{
- free( stream->base );
+ stream->memory->free( stream->memory, stream->base );
stream->descriptor.pointer = NULL;
stream->size = 0;
stream->base = 0;
@@ -427,13 +421,13 @@ error:
CloseResFile( res_ref ); /* XXX still need to read kerning! */
- type1_data = read_type1_data( &lwfn_spec, &size );
+ type1_data = read_type1_data( stream->memory, &lwfn_spec, &size );
if ( !type1_data )
{
return FT_Err_Out_Of_Memory;
}
- #if 1
+ #if 0
{
FILE* f;