From 5a34a7bac2f144c7eefb1cdabfc3d8e018840473 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Fri, 17 Mar 2000 13:07:21 +0000 Subject: [PATCH] use stream->memory instead of malloc/free. --- src/macfond/fonddrvr.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/macfond/fonddrvr.c b/src/macfond/fonddrvr.c index 5a205ee29..3f68fe1df 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 @@ -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;