* include/freetype/internal/ftmemory.h, and a lot of other files !!:

changed the names of memory macros. Examples:

              MEM_Set   => FT_MEM_SET
              MEM_Copy  => FT_MEM_COPY
              MEM_Move  => FT_MEM_MOVE

              ALLOC     => FT_ALLOC
              FREE      => FT_FREE
              REALLOC   = >FT_REALLOC

            FT_NEW was introduced to allocate a new object from a _typed_
            pointer..

            note that ALLOC_ARRAY and REALLOC_ARRAY have been replaced
            by FT_NEW_ARRAY and FT_RENEW_ARRAY which take _typed_ pointer
            arguments.

            This results in _lots_ of sources being changed, but makes the
            code more generic and less error-prone..
This commit is contained in:
David Turner 2002-03-22 13:52:37 +00:00
parent a890c29cb0
commit e459d742e6
57 changed files with 653 additions and 667 deletions

View File

@ -1,5 +1,28 @@
2002-03-22 David Turner <david@freetype.org> 2002-03-22 David Turner <david@freetype.org>
* include/freetype/internal/ftmemory.h, and a lot of other files !!:
changed the names of memory macros. Examples:
MEM_Set => FT_MEM_SET
MEM_Copy => FT_MEM_COPY
MEM_Move => FT_MEM_MOVE
ALLOC => FT_ALLOC
FREE => FT_FREE
REALLOC = >FT_REALLOC
FT_NEW was introduced to allocate a new object from a _typed_
pointer..
note that ALLOC_ARRAY and REALLOC_ARRAY have been replaced
by FT_NEW_ARRAY and FT_RENEW_ARRAY which take _typed_ pointer
arguments.
This results in _lots_ of sources being changed, but makes the
code more generic and less error-prone..
* include/freetype/internal/ftstream.h, * include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c, src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c, src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,

View File

@ -176,107 +176,116 @@ FT_BEGIN_HEADER
/* available on all platforms we know of. */ /* available on all platforms we know of. */
#include <string.h> #include <string.h>
#define MEM_Set( dest, byte, count ) memset( dest, byte, count ) #define FT_MEM_SET( dest, byte, count ) memset( dest, byte, count )
#define MEM_Copy( dest, source, count ) memcpy( dest, source, count ) #define FT_MEM_COPY( dest, source, count ) memcpy( dest, source, count )
#define MEM_Move( dest, source, count ) memmove( dest, source, count ) #define FT_MEM_MOVE( dest, source, count ) memmove( dest, source, count )
/*************************************************************************/ /**************************************************************************
/* */ *
/* We now support closures to produce completely reentrant code. This */ * we first define FT_MEM_ALLOC, FT_MEM_REALLOC and FT_MEM_FREE
/* means the allocation functions now takes an additional argument */ * all macros use an _implicit_ 'memory' parameter to access the
/* (`memory'). It is a handle to a given memory object, responsible for */ * current memory allocator
/* all low-level operations, including memory management and */ *
/* synchronisation. */ */
/* */
/* In order to keep our code readable and use the same macros in the */
/* font drivers and the rest of the library, MEM_Alloc(), ALLOC(), and */
/* ALLOC_ARRAY() now use an implicit variable, `memory'. It must be */
/* defined at all locations where a memory operation is queried. */
/* */
#ifdef FT_DEBUG_MEMORY #ifdef FT_DEBUG_MEMORY
#define MEM_Alloc( _pointer_, _size_ ) \ # define FT_MEM_ALLOC( _pointer_, _size_ ) \
FT_Alloc_Debug( memory, _size_, \ FT_Alloc_Debug( memory, _size_, \
(void**)&(_pointer_), __FILE__, __LINE__ ) (void**)&(_pointer_), __FILE__, __LINE__ )
#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \ # define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
FT_Alloc_Debug( memory, (_count_)*sizeof ( _type_ ), \ FT_Realloc_Debug( memory, _current_, _size_, \
(void**)&(_pointer_), __FILE__, __LINE__ )
#define MEM_Realloc( _pointer_, _current_, _size_ ) \
FT_Realloc_Debug( memory, _current_, _size_, \
(void**)&(_pointer_), __FILE__, __LINE__ ) (void**)&(_pointer_), __FILE__, __LINE__ )
#define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \ # define FT_MEM_FREE( _pointer_ ) \
FT_Realloc_Debug( memory, (_current_)*sizeof ( _type_ ), \
(_new_)*sizeof ( _type_ ), \
(void**)&(_pointer_), __FILE__, __LINE__ )
#define MEM_Free( _pointer_ ) \
FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ ) FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ )
#else /* !FT_DEBUG_MEMORY */ #else /* !FT_DEBUG_MEMORY */
#define MEM_Alloc( _pointer_, _size_ ) \ # define FT_MEM_ALLOC( _pointer_, _size_ ) \
FT_Alloc( memory, _size_, (void**)&(_pointer_) ) FT_Alloc( memory, _size_, (void**)&(_pointer_) )
#define MEM_New( _pointer_ ) MEM_Alloc( _pointer_, sizeof(*(_pointer_)) ) # define FT_MEM_FREE( _pointer_ ) \
#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \
FT_Alloc( memory, (_count_)*sizeof ( _type_ ), \
(void**)&(_pointer_) )
#define MEM_New_Array( _pointer_, _count_ ) \
MEM_Alloc_Array( _pointer_, _count_, sizeof(*(_pointer_)) )
#define MEM_Realloc( _pointer_, _current_, _size_ ) \
FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
#define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \
FT_Realloc( memory, (_current_)*sizeof ( _type_ ), \
(_new_)*sizeof ( _type_ ), (void**)&(_pointer_) )
#define MEM_Renew_Array( _pointer_, _current_, _new_ ) \
MEM_Realloc_Array( _pointer_, _current_, _new_, *(_pointer_) )
#define MEM_Free( _pointer_ ) \
FT_Free( memory, (void**)&(_pointer_) ) FT_Free( memory, (void**)&(_pointer_) )
# define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
#endif /* !FT_DEBUG_MEMORY */ #endif /* !FT_DEBUG_MEMORY */
#define ALLOC( _pointer_, _size_ ) \ /**************************************************************************
FT_SET_ERROR( MEM_Alloc( _pointer_, _size_ ) ) *
* the following functions macros that their pointer argument is _typed_
* in order to automatically compute array element sizes..
*/
#define FT_MEM_NEW( _pointer_ ) \
FT_MEM_ALLOC( _pointer_, sizeof(*(_pointer_)) )
#define NEW( _pointer_ ) \ #define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \
FT_SET_ERROR( MEM_New( _pointer_ ) ) FT_MEM_ALLOC( _pointer_, (_count_)*sizeof(*(_pointer_)) )
#define REALLOC( _pointer_, _current_, _size_ ) \ #define FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) \
FT_SET_ERROR( MEM_Realloc( _pointer_, _current_, _size_ ) ) FT_MEM_REALLOC( _pointer_, (_old_)*sizeof(*(_pointer_)), \
(_new_)*sizeof(*(_pointer_)) )
#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
FT_SET_ERROR( MEM_Alloc( _pointer_, \ /**************************************************************************
*
* the following macros are obsolete but kept for compatibility reasons
*/
#define FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
FT_MEM_ALLOC( _pointer_, (_count_)*sizeof(_type_) )
#define FT_MEM_REALLOC_ARRAY( _pointer_, _current_, _new_, _type_ ) \
FT_MEM_REALLOC( _pointer_, (_current_)*sizeof(_type), \
(_new_)*sizeof(_type_) )
/**************************************************************************
*
* the following macros are variants of their FT_MEM_XXXX equivalents
* they're used to set an _implicit_ 'error' variable and return TRUE
* if an error occured (i.e. if 'error != 0')
*/
#define FT_ALLOC( _pointer_, _size_ ) \
FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) )
#define FT_REALLOC( _pointer_, _current_, _size_ ) \
FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, _current_, _size_ ) )
#define FT_FREE( _pointer_ ) \
FT_MEM_FREE( _pointer_ )
#define FT_NEW( _pointer_ ) \
FT_SET_ERROR( FT_MEM_NEW( _pointer_ ) )
#define FT_RENEW_ARRAY( _pointer_, _current_, _new_ ) \
FT_SET_ERROR( FT_MEM_RENEW_ARRAY( _pointer_, _current_, _new_ ) )
#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, \
(_count_)*sizeof ( _type_ ) ) ) (_count_)*sizeof ( _type_ ) ) )
#define NEW_ARRAY( _pointer_, _count_ ) \ #define FT_NEW_ARRAY( _pointer_, _count_ ) \
FT_SET_ERROR( MEM_New_Array( _pointer_, _count_ ) ) FT_SET_ERROR( FT_MEM_NEW_ARRAY( _pointer_, _count_ ) )
#define REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \ #define FT_REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \
FT_SET_ERROR( MEM_Realloc( _pointer_, \ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, \
(_current_)*sizeof ( _type_ ), \ (_current_)*sizeof ( _type_ ), \
(_count_)*sizeof ( _type_ ) ) ) (_count_)*sizeof ( _type_ ) ) )
/* */
#define RENEW_ARRAY( _pointer_, _current_, _new_ ) \
FT_SET_ERROR( MEM_Renew_Array( _pointer_, _current_, _new_ ) )
#define FREE( _pointer_ ) \
MEM_Free( _pointer_ )
FT_END_HEADER FT_END_HEADER

View File

@ -307,7 +307,7 @@
AH_Outline* outline; AH_Outline* outline;
if ( !ALLOC( outline, sizeof ( *outline ) ) ) if ( !FT_NEW( outline ) )
{ {
outline->memory = memory; outline->memory = memory;
*aoutline = outline; *aoutline = outline;
@ -331,12 +331,12 @@
FT_Memory memory = outline->memory; FT_Memory memory = outline->memory;
FREE( outline->horz_edges ); FT_FREE( outline->horz_edges );
FREE( outline->horz_segments ); FT_FREE( outline->horz_segments );
FREE( outline->contours ); FT_FREE( outline->contours );
FREE( outline->points ); FT_FREE( outline->points );
FREE( outline ); FT_FREE( outline );
} }
@ -408,8 +408,9 @@
FT_Int new_contours = ( num_contours + 3 ) & -4; FT_Int new_contours = ( num_contours + 3 ) & -4;
if ( REALLOC_ARRAY( outline->contours, outline->max_contours, if ( FT_RENEW_ARRAY( outline->contours,
new_contours, AH_Point* ) ) outline->max_contours,
new_contours ) )
goto Exit; goto Exit;
outline->max_contours = new_contours; outline->max_contours = new_contours;
@ -425,12 +426,9 @@
FT_Int max = outline->max_points; FT_Int max = outline->max_points;
if ( REALLOC_ARRAY( outline->points, if ( FT_RENEW_ARRAY( outline->points, max, news ) ||
max, news, AH_Point ) || FT_RENEW_ARRAY( outline->horz_edges, max * 2, news * 2 ) ||
REALLOC_ARRAY( outline->horz_edges, FT_RENEW_ARRAY( outline->horz_segments, max * 2, news * 2 ) )
max * 2, news * 2, AH_Edge ) ||
REALLOC_ARRAY( outline->horz_segments,
max * 2, news * 2, AH_Segment ) )
goto Exit; goto Exit;
/* readjust some pointers */ /* readjust some pointers */
@ -816,7 +814,7 @@
segment_dir = point->out_dir; segment_dir = point->out_dir;
/* clear all segment fields */ /* clear all segment fields */
MEM_Set( segment, 0, sizeof ( *segment ) ); FT_MEM_SET( segment, 0, sizeof ( *segment ) );
segment->dir = segment_dir; segment->dir = segment_dir;
segment->flags = ah_edge_normal; segment->flags = ah_edge_normal;
@ -878,7 +876,7 @@
if ( min_point ) if ( min_point )
{ {
/* clear all segment fields */ /* clear all segment fields */
MEM_Set( segment, 0, sizeof ( *segment ) ); FT_MEM_SET( segment, 0, sizeof ( *segment ) );
segment->dir = segment_dir; segment->dir = segment_dir;
segment->flags = ah_edge_normal; segment->flags = ah_edge_normal;
@ -894,7 +892,7 @@
if ( max_point ) if ( max_point )
{ {
/* clear all segment fields */ /* clear all segment fields */
MEM_Set( segment, 0, sizeof ( *segment ) ); FT_MEM_SET( segment, 0, sizeof ( *segment ) );
segment->dir = segment_dir; segment->dir = segment_dir;
segment->flags = ah_edge_normal; segment->flags = ah_edge_normal;
@ -1117,7 +1115,7 @@
edge_limit++; edge_limit++;
/* clear all edge fields */ /* clear all edge fields */
MEM_Set( edge, 0, sizeof ( *edge ) ); FT_MEM_SET( edge, 0, sizeof ( *edge ) );
/* add the segment to the new edge's list */ /* add the segment to the new edge's list */
edge->first = seg; edge->first = seg;

View File

@ -913,7 +913,7 @@
hinter->globals = 0; hinter->globals = 0;
hinter->face = 0; hinter->face = 0;
FREE( hinter ); FT_FREE( hinter );
} }
} }
@ -931,7 +931,7 @@
*ahinter = 0; *ahinter = 0;
/* allocate object */ /* allocate object */
if ( ALLOC( hinter, sizeof ( *hinter ) ) ) if ( FT_NEW( hinter ) )
goto Exit; goto Exit;
hinter->memory = memory; hinter->memory = memory;
@ -965,7 +965,7 @@
AH_Face_Globals* face_globals; AH_Face_Globals* face_globals;
if ( ALLOC( face_globals, sizeof ( *face_globals ) ) ) if ( FT_NEW( face_globals ) )
goto Exit; goto Exit;
hinter->face = face; hinter->face = face;
@ -994,7 +994,7 @@
FT_Memory memory = face->memory; FT_Memory memory = face->memory;
FREE( globals ); FT_FREE( globals );
} }
@ -1067,13 +1067,13 @@
if ( error ) if ( error )
goto Exit; goto Exit;
MEM_Copy( gloader->current.extra_points, slot->outline.points, FT_MEM_COPY( gloader->current.extra_points, slot->outline.points,
slot->outline.n_points * sizeof ( FT_Vector ) ); slot->outline.n_points * sizeof ( FT_Vector ) );
MEM_Copy( gloader->current.outline.contours, slot->outline.contours, FT_MEM_COPY( gloader->current.outline.contours, slot->outline.contours,
slot->outline.n_contours * sizeof ( short ) ); slot->outline.n_contours * sizeof ( short ) );
MEM_Copy( gloader->current.outline.tags, slot->outline.tags, FT_MEM_COPY( gloader->current.outline.tags, slot->outline.tags,
slot->outline.n_points * sizeof ( char ) ); slot->outline.n_points * sizeof ( char ) );
gloader->current.outline.n_points = slot->outline.n_points; gloader->current.outline.n_points = slot->outline.n_points;
@ -1151,7 +1151,7 @@
if ( error ) if ( error )
goto Exit; goto Exit;
MEM_Copy( gloader->current.subglyphs, slot->subglyphs, FT_MEM_COPY( gloader->current.subglyphs, slot->subglyphs,
num_subglyphs * sizeof ( FT_SubGlyph ) ); num_subglyphs * sizeof ( FT_SubGlyph ) );
gloader->current.num_subglyphs = num_subglyphs; gloader->current.num_subglyphs = num_subglyphs;
@ -1393,7 +1393,7 @@
/* allocate new master globals */ /* allocate new master globals */
if ( ALLOC( globals, sizeof ( *globals ) ) ) if ( FT_NEW( globals ) )
goto Fail; goto Fail;
/* compute face globals if needed */ /* compute face globals if needed */
@ -1411,7 +1411,7 @@
return; return;
Fail: Fail:
FREE( globals ); FT_FREE( globals );
*global_hints = 0; *global_hints = 0;
*global_len = 0; *global_len = 0;
@ -1425,7 +1425,7 @@
FT_Memory memory = hinter->memory; FT_Memory memory = hinter->memory;
FREE( global_hints ); FT_FREE( global_hints );
} }

View File

@ -32,7 +32,7 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H /* for ALLOC_ARRAY() and FREE() */ #include FT_INTERNAL_OBJECTS_H /* for FT_ALLOC_ARRAY() and FT_FREE() */
#include "ahoptim.h" #include "ahoptim.h"
@ -220,7 +220,7 @@
AH_Stem* stem; AH_Stem* stem;
if ( ALLOC_ARRAY( stems, num_stems, AH_Stem ) ) if ( FT_NEW_ARRAY( stems, num_stems ) )
goto Exit; goto Exit;
stem = stems; stem = stems;
@ -409,7 +409,7 @@
/* allocate table of springs */ /* allocate table of springs */
if ( ALLOC_ARRAY( springs, num_springs, AH_Spring ) ) if ( FT_NEW_ARRAY( springs, num_springs ) )
goto Exit; goto Exit;
/* fill the springs table */ /* fill the springs table */
@ -796,11 +796,11 @@
FT_Memory memory = optimizer->memory; FT_Memory memory = optimizer->memory;
FREE( optimizer->horz_stems ); FT_FREE( optimizer->horz_stems );
FREE( optimizer->vert_stems ); FT_FREE( optimizer->vert_stems );
FREE( optimizer->horz_springs ); FT_FREE( optimizer->horz_springs );
FREE( optimizer->vert_springs ); FT_FREE( optimizer->vert_springs );
FREE( optimizer->positions ); FT_FREE( optimizer->positions );
} }
} }
@ -814,7 +814,7 @@
FT_Error error; FT_Error error;
MEM_Set( optimizer, 0, sizeof ( *optimizer ) ); FT_MEM_SET( optimizer, 0, sizeof ( *optimizer ) );
optimizer->outline = outline; optimizer->outline = outline;
optimizer->memory = memory; optimizer->memory = memory;
@ -834,8 +834,7 @@
if ( max_stems < optimizer->num_vstems ) if ( max_stems < optimizer->num_vstems )
max_stems = optimizer->num_vstems; max_stems = optimizer->num_vstems;
if ( ALLOC_ARRAY( optimizer->positions, if ( FT_NEW_ARRAY( optimizer->positions, max_stems * AH_MAX_CONFIGS ) )
max_stems * AH_MAX_CONFIGS, FT_Pos ) )
goto Fail; goto Fail;
optimizer->num_configs = 0; optimizer->num_configs = 0;

View File

@ -205,7 +205,7 @@
if ( new_buckets == NULL ) if ( new_buckets == NULL )
return; return;
MEM_Set( new_buckets, 0, sizeof ( FT_MemNode ) * new_size ); FT_MEM_SET( new_buckets, 0, sizeof ( FT_MemNode ) * new_size );
for ( i = 0; i < table->size; i++ ) for ( i = 0; i < table->size; i++ )
{ {
@ -246,7 +246,7 @@
if ( table == NULL ) if ( table == NULL )
goto Exit; goto Exit;
MEM_Set( table, 0, sizeof ( *table ) ); FT_MEM_SET( table, 0, sizeof ( *table ) );
table->size = FT_MEM_SIZE_MIN; table->size = FT_MEM_SIZE_MIN;
table->nodes = 0; table->nodes = 0;
@ -263,7 +263,7 @@
memory->alloc( memory, memory->alloc( memory,
table->size * sizeof ( FT_MemNode ) ); table->size * sizeof ( FT_MemNode ) );
if ( table->buckets ) if ( table->buckets )
MEM_Set( table->buckets, 0, sizeof ( FT_MemNode ) * table->size ); FT_MEM_SET( table->buckets, 0, sizeof ( FT_MemNode ) * table->size );
else else
{ {
memory->free( memory, table ); memory->free( memory, table );
@ -452,7 +452,7 @@
/* we simply invert the node's size to indicate that the node */ /* we simply invert the node's size to indicate that the node */
/* was freed. We also change its contents. */ /* was freed. We also change its contents. */
MEM_Set( address, 0xF3, node->size ); FT_MEM_SET( address, 0xF3, node->size );
table->alloc_current -= node->size; table->alloc_current -= node->size;
node->size = -node->size; node->size = -node->size;

View File

@ -53,7 +53,7 @@
FT_Error error; FT_Error error;
if ( !ALLOC( loader, sizeof ( *loader ) ) ) if ( !FT_NEW( loader ) )
{ {
loader->memory = memory; loader->memory = memory;
*aloader = loader; *aloader = loader;
@ -86,11 +86,11 @@
FT_Memory memory = loader->memory; FT_Memory memory = loader->memory;
FREE( loader->base.outline.points ); FT_FREE( loader->base.outline.points );
FREE( loader->base.outline.tags ); FT_FREE( loader->base.outline.tags );
FREE( loader->base.outline.contours ); FT_FREE( loader->base.outline.contours );
FREE( loader->base.extra_points ); FT_FREE( loader->base.extra_points );
FREE( loader->base.subglyphs ); FT_FREE( loader->base.subglyphs );
loader->max_points = 0; loader->max_points = 0;
loader->max_contours = 0; loader->max_contours = 0;
@ -110,7 +110,7 @@
FT_GlyphLoader_Reset( loader ); FT_GlyphLoader_Reset( loader );
FREE( loader ); FT_FREE( loader );
} }
} }
@ -141,8 +141,7 @@
FT_Memory memory = loader->memory; FT_Memory memory = loader->memory;
if ( !ALLOC_ARRAY( loader->base.extra_points, if ( !FT_NEW_ARRAY( loader->base.extra_points, loader->max_points ) )
loader->max_points, FT_Vector ) )
{ {
loader->use_extra = 1; loader->use_extra = 1;
FT_GlyphLoader_Adjust_Points( loader ); FT_GlyphLoader_Adjust_Points( loader );
@ -189,13 +188,12 @@
{ {
new_max = ( new_max + 7 ) & -8; new_max = ( new_max + 7 ) & -8;
if ( REALLOC_ARRAY( base->points, old_max, new_max, FT_Vector ) || if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
REALLOC_ARRAY( base->tags, old_max, new_max, FT_Byte ) ) FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
goto Exit; goto Exit;
if ( loader->use_extra && if ( loader->use_extra &&
REALLOC_ARRAY( loader->base.extra_points, old_max, FT_RENEW_ARRAY( loader->base.extra_points, old_max, new_max ) )
new_max, FT_Vector ) )
goto Exit; goto Exit;
adjust = 1; adjust = 1;
@ -209,7 +207,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 3 ) & -4; new_max = ( new_max + 3 ) & -4;
if ( REALLOC_ARRAY( base->contours, old_max, new_max, FT_Short ) ) if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
goto Exit; goto Exit;
adjust = 1; adjust = 1;
@ -245,7 +243,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 1 ) & -2; new_max = ( new_max + 1 ) & -2;
if ( REALLOC_ARRAY( base->subglyphs, old_max, new_max, FT_SubGlyphRec ) ) if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
goto Exit; goto Exit;
loader->max_subglyphs = new_max; loader->max_subglyphs = new_max;
@ -319,16 +317,16 @@
FT_Outline* in = &source->base.outline; FT_Outline* in = &source->base.outline;
MEM_Copy( out->points, in->points, FT_MEM_COPY( out->points, in->points,
num_points * sizeof ( FT_Vector ) ); num_points * sizeof ( FT_Vector ) );
MEM_Copy( out->tags, in->tags, FT_MEM_COPY( out->tags, in->tags,
num_points * sizeof ( char ) ); num_points * sizeof ( char ) );
MEM_Copy( out->contours, in->contours, FT_MEM_COPY( out->contours, in->contours,
num_contours * sizeof ( short ) ); num_contours * sizeof ( short ) );
/* do we need to copy the extra points? */ /* do we need to copy the extra points? */
if ( target->use_extra && source->use_extra ) if ( target->use_extra && source->use_extra )
MEM_Copy( target->base.extra_points, source->base.extra_points, FT_MEM_COPY( target->base.extra_points, source->base.extra_points,
num_points * sizeof ( FT_Vector ) ); num_points * sizeof ( FT_Vector ) );
out->n_points = (short)num_points; out->n_points = (short)num_points;

View File

@ -131,8 +131,8 @@
size = (FT_ULong)( pitch * source->rows ); size = (FT_ULong)( pitch * source->rows );
if ( !ALLOC( target->buffer, size ) ) if ( !FT_ALLOC( target->buffer, size ) )
MEM_Copy( target->buffer, source->buffer, size ); FT_MEM_COPY( target->buffer, source->buffer, size );
return error; return error;
} }
@ -191,7 +191,7 @@
FT_Memory memory = FT_GLYPH(glyph)->library->memory; FT_Memory memory = FT_GLYPH(glyph)->library->memory;
FREE( glyph->bitmap.buffer ); FT_FREE( glyph->bitmap.buffer );
} }
@ -253,13 +253,13 @@
goto Exit; goto Exit;
/* copy it */ /* copy it */
MEM_Copy( target->points, source->points, FT_MEM_COPY( target->points, source->points,
source->n_points * sizeof ( FT_Vector ) ); source->n_points * sizeof ( FT_Vector ) );
MEM_Copy( target->tags, source->tags, FT_MEM_COPY( target->tags, source->tags,
source->n_points * sizeof ( FT_Byte ) ); source->n_points * sizeof ( FT_Byte ) );
MEM_Copy( target->contours, source->contours, FT_MEM_COPY( target->contours, source->contours,
source->n_contours * sizeof ( FT_Short ) ); source->n_contours * sizeof ( FT_Short ) );
/* copy all flags, except the `ft_outline_owner' one */ /* copy all flags, except the `ft_outline_owner' one */
@ -361,7 +361,7 @@
*aglyph = 0; *aglyph = 0;
if ( !ALLOC( glyph, clazz->glyph_size ) ) if ( !FT_ALLOC( glyph, clazz->glyph_size ) )
{ {
glyph->library = library; glyph->library = library;
glyph->clazz = clazz; glyph->clazz = clazz;
@ -594,7 +594,7 @@
if ( !clazz || !clazz->glyph_prepare ) if ( !clazz || !clazz->glyph_prepare )
goto Bad; goto Bad;
MEM_Set( &dummy, 0, sizeof ( dummy ) ); FT_MEM_SET( &dummy, 0, sizeof ( dummy ) );
dummy.library = glyph->library; dummy.library = glyph->library;
dummy.format = clazz->glyph_format; dummy.format = clazz->glyph_format;
@ -671,7 +671,7 @@
if ( clazz->glyph_done ) if ( clazz->glyph_done )
clazz->glyph_done( glyph ); clazz->glyph_done( glyph );
FREE( glyph ); FT_FREE( glyph );
} }
} }

View File

@ -205,7 +205,7 @@
if ( destroy ) if ( destroy )
destroy( memory, data, user ); destroy( memory, data, user );
FREE( cur ); FT_FREE( cur );
cur = next; cur = next;
} }

View File

@ -364,7 +364,7 @@
last_code = code; last_code = code;
} }
if ( ALLOC( buffer, (FT_Long)total_size ) ) if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
goto Error; goto Error;
/* Second pass: append all POST data to the buffer, add PFB fields. /* Second pass: append all POST data to the buffer, add PFB fields.
@ -433,7 +433,7 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FREE( stream->base ); FT_FREE( stream->base );
stream->size = 0; stream->size = 0;
stream->base = 0; stream->base = 0;
@ -462,7 +462,7 @@
*astream = 0; *astream = 0;
memory = library->memory; memory = library->memory;
if ( ALLOC( stream, sizeof ( *stream ) ) ) if ( FT_NEW( stream ) )
goto Exit; goto Exit;
FT_Stream_OpenMemory( library, FT_Stream_OpenMemory( library,
@ -501,7 +501,7 @@
&stream ); &stream );
if ( error ) if ( error )
{ {
FREE( base ); FT_FREE( base );
return error; return error;
} }
@ -519,7 +519,7 @@
else else
{ {
FT_Stream_Close( stream ); FT_Stream_Close( stream );
FREE( stream ); FT_FREE( stream );
} }
return error; return error;
} }
@ -588,7 +588,7 @@
return FT_Err_Invalid_Handle; return FT_Err_Invalid_Handle;
sfnt_size = (FT_ULong)GetHandleSize( sfnt ); sfnt_size = (FT_ULong)GetHandleSize( sfnt );
if ( ALLOC( sfnt_data, (FT_Long)sfnt_size ) ) if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
{ {
ReleaseResource( sfnt ); ReleaseResource( sfnt );
return error; return error;

View File

@ -61,7 +61,7 @@
*astream = 0; *astream = 0;
memory = library->memory; memory = library->memory;
if ( ALLOC( stream, sizeof ( *stream ) ) ) if ( FT_NEW( stream ) )
goto Exit; goto Exit;
stream->memory = memory; stream->memory = memory;
@ -85,14 +85,14 @@
/* in this case, we do not need to allocate a new stream object */ /* in this case, we do not need to allocate a new stream object */
/* since the caller is responsible for closing it himself */ /* since the caller is responsible for closing it himself */
FREE( stream ); FT_FREE( stream );
stream = args->stream; stream = args->stream;
} }
else else
error = FT_Err_Invalid_Argument; error = FT_Err_Invalid_Argument;
if ( error ) if ( error )
FREE( stream ); FT_FREE( stream );
else else
stream->memory = memory; /* just to be certain */ stream->memory = memory; /* just to be certain */
@ -115,7 +115,7 @@
FT_Stream_Close( stream ); FT_Stream_Close( stream );
if ( !external ) if ( !external )
FREE( stream ); FT_FREE( stream );
} }
} }
@ -149,7 +149,7 @@
slot->library = driver->root.library; slot->library = driver->root.library;
if ( ALLOC( internal, sizeof ( *internal ) ) ) if ( FT_NEW( internal ) )
goto Exit; goto Exit;
slot->internal = internal; slot->internal = internal;
@ -174,14 +174,14 @@
FT_Memory memory = FT_FACE_MEMORY( slot->face ); FT_Memory memory = FT_FACE_MEMORY( slot->face );
FREE( slot->bitmap.buffer ); FT_FREE( slot->bitmap.buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->flags &= ~FT_GLYPH_OWN_BITMAP;
} }
/* clear all public fields in the glyph slot */ /* clear all public fields in the glyph slot */
MEM_Set( &slot->metrics, 0, sizeof ( slot->metrics ) ); FT_MEM_SET( &slot->metrics, 0, sizeof ( slot->metrics ) );
MEM_Set( &slot->outline, 0, sizeof ( slot->outline ) ); FT_MEM_SET( &slot->outline, 0, sizeof ( slot->outline ) );
MEM_Set( &slot->bitmap, 0, sizeof ( slot->bitmap ) ); FT_MEM_SET( &slot->bitmap, 0, sizeof ( slot->bitmap ) );
slot->bitmap_left = 0; slot->bitmap_left = 0;
slot->bitmap_top = 0; slot->bitmap_top = 0;
@ -210,7 +210,7 @@
/* free bitmap buffer if needed */ /* free bitmap buffer if needed */
if ( slot->flags & FT_GLYPH_OWN_BITMAP ) if ( slot->flags & FT_GLYPH_OWN_BITMAP )
FREE( slot->bitmap.buffer ); FT_FREE( slot->bitmap.buffer );
/* free glyph loader */ /* free glyph loader */
if ( FT_DRIVER_USES_OUTLINES( driver ) ) if ( FT_DRIVER_USES_OUTLINES( driver ) )
@ -219,7 +219,7 @@
slot->internal->loader = 0; slot->internal->loader = 0;
} }
FREE( slot->internal ); FT_FREE( slot->internal );
} }
@ -246,7 +246,7 @@
memory = driver->root.memory; memory = driver->root.memory;
FT_TRACE4(( "FT_New_GlyphSlot: Creating new slot object\n" )); FT_TRACE4(( "FT_New_GlyphSlot: Creating new slot object\n" ));
if ( !ALLOC( slot, clazz->slot_object_size ) ) if ( !FT_ALLOC( slot, clazz->slot_object_size ) )
{ {
slot->face = face; slot->face = face;
@ -254,7 +254,7 @@
if ( error ) if ( error )
{ {
ft_glyphslot_done( slot ); ft_glyphslot_done( slot );
FREE( slot ); FT_FREE( slot );
goto Exit; goto Exit;
} }
@ -290,7 +290,7 @@
{ {
*parent = cur->next; *parent = cur->next;
ft_glyphslot_done( slot ); ft_glyphslot_done( slot );
FREE( slot ); FT_FREE( slot );
break; break;
} }
cur = cur->next; cur = cur->next;
@ -547,8 +547,8 @@
if ( driver->clazz->done_size ) if ( driver->clazz->done_size )
driver->clazz->done_size( size ); driver->clazz->done_size( size );
FREE( size->internal ); FT_FREE( size->internal );
FREE( size ); FT_FREE( size );
} }
@ -594,10 +594,10 @@
/* get rid of it */ /* get rid of it */
if ( face->internal ) if ( face->internal )
{ {
FREE( face->internal->postscript_name ); FT_FREE( face->internal->postscript_name );
FREE( face->internal ); FT_FREE( face->internal );
} }
FREE( face ); FT_FREE( face );
} }
@ -642,10 +642,10 @@
memory = driver->root.memory; memory = driver->root.memory;
/* allocate the face object and perform basic initialization */ /* allocate the face object and perform basic initialization */
if ( ALLOC( face, clazz->face_object_size ) ) if ( FT_ALLOC( face, clazz->face_object_size ) )
goto Fail; goto Fail;
if ( ALLOC( internal, sizeof ( *internal ) ) ) if ( FT_NEW( internal ) )
goto Fail; goto Fail;
face->internal = internal; face->internal = internal;
@ -668,8 +668,8 @@
if ( error ) if ( error )
{ {
clazz->done_face( face ); clazz->done_face( face );
FREE( face->internal ); FT_FREE( face->internal );
FREE( face ); FT_FREE( face );
*aface = 0; *aface = 0;
} }
@ -845,7 +845,7 @@
face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM; face->face_flags |= FT_FACE_FLAG_EXTERNAL_STREAM;
/* add the face object to its driver's list */ /* add the face object to its driver's list */
if ( ALLOC( node, sizeof ( *node ) ) ) if ( FT_NEW( node ) )
goto Fail; goto Fail;
node->data = face; node->data = face;
@ -996,7 +996,7 @@
{ {
/* remove face object from the driver's list */ /* remove face object from the driver's list */
FT_List_Remove( &driver->faces_list, node ); FT_List_Remove( &driver->faces_list, node );
FREE( node ); FT_FREE( node );
/* now destroy the object proper */ /* now destroy the object proper */
destroy_face( memory, face, driver ); destroy_face( memory, face, driver );
@ -1038,8 +1038,7 @@
memory = face->memory; memory = face->memory;
/* Allocate new size object and perform basic initialisation */ /* Allocate new size object and perform basic initialisation */
if ( ALLOC( size, clazz->size_object_size ) || if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) )
ALLOC( node, sizeof ( FT_ListNodeRec ) ) )
goto Exit; goto Exit;
size->face = face; size->face = face;
@ -1061,8 +1060,8 @@
Exit: Exit:
if ( error ) if ( error )
{ {
FREE( node ); FT_FREE( node );
FREE( size ); FT_FREE( size );
} }
return error; return error;
@ -1099,7 +1098,7 @@
if ( node ) if ( node )
{ {
FT_List_Remove( &face->sizes_list, node ); FT_List_Remove( &face->sizes_list, node );
FREE( node ); FT_FREE( node );
if ( face->size == size ) if ( face->size == size )
{ {
@ -1386,7 +1385,7 @@
if ( clazz->done ) if ( clazz->done )
clazz->done( cmap ); clazz->done( cmap );
FREE( cmap ); FT_FREE( cmap );
} }
} }
@ -1408,7 +1407,7 @@
face = charmap->face; face = charmap->face;
memory = FT_FACE_MEMORY(face); memory = FT_FACE_MEMORY(face);
if ( !ALLOC( cmap, clazz->size ) ) if ( !FT_ALLOC( cmap, clazz->size ) )
{ {
cmap->charmap = *charmap; cmap->charmap = *charmap;
cmap->clazz = clazz; cmap->clazz = clazz;
@ -1421,10 +1420,9 @@
} }
/* add it to our list of charmaps */ /* add it to our list of charmaps */
if ( REALLOC_ARRAY( face->charmaps, if ( FT_RENEW_ARRAY( face->charmaps,
face->num_charmaps, face->num_charmaps,
face->num_charmaps+1, face->num_charmaps+1 ) )
FT_CharMap* ) )
goto Fail; goto Fail;
face->charmaps[ face->num_charmaps++ ] = (FT_CharMap) cmap; face->charmaps[ face->num_charmaps++ ] = (FT_CharMap) cmap;
@ -1771,7 +1769,7 @@
FT_ListNode node; FT_ListNode node;
if ( ALLOC( node, sizeof ( *node ) ) ) if ( FT_NEW( node ) )
goto Exit; goto Exit;
{ {
@ -1803,7 +1801,7 @@
Fail: Fail:
if ( error ) if ( error )
FREE( node ); FT_FREE( node );
Exit: Exit:
return error; return error;
@ -1830,7 +1828,7 @@
/* remove from list */ /* remove from list */
FT_List_Remove( &library->renderers, node ); FT_List_Remove( &library->renderers, node );
FREE( node ); FT_FREE( node );
ft_set_current_renderer( library ); ft_set_current_renderer( library );
} }
@ -2030,7 +2028,7 @@
clazz->module_done( module ); clazz->module_done( module );
/* discard it */ /* discard it */
FREE( module ); FT_FREE( module );
} }
@ -2086,7 +2084,7 @@
} }
/* allocate module object */ /* allocate module object */
if ( ALLOC( module,clazz->module_size ) ) if ( FT_ALLOC( module,clazz->module_size ) )
goto Exit; goto Exit;
/* base initialization */ /* base initialization */
@ -2156,7 +2154,7 @@
renderer->clazz->raster_class->raster_done( renderer->raster ); renderer->clazz->raster_class->raster_done( renderer->raster );
} }
FREE( module ); FT_FREE( module );
goto Exit; goto Exit;
} }
@ -2278,14 +2276,14 @@
ft_debug_init(); ft_debug_init();
/* first of all, allocate the library object */ /* first of all, allocate the library object */
if ( ALLOC( library, sizeof ( *library ) ) ) if ( FT_NEW( library ) )
return error; return error;
library->memory = memory; library->memory = memory;
/* allocate the render pool */ /* allocate the render pool */
library->raster_pool_size = FT_RENDER_POOL_SIZE; library->raster_pool_size = FT_RENDER_POOL_SIZE;
if ( ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) ) if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )
goto Fail; goto Fail;
/* That's ok now */ /* That's ok now */
@ -2294,7 +2292,7 @@
return FT_Err_Ok; return FT_Err_Ok;
Fail: Fail:
FREE( library ); FT_FREE( library );
return error; return error;
} }
@ -2371,10 +2369,10 @@
#endif #endif
/* Destroy raster objects */ /* Destroy raster objects */
FREE( library->raster_pool ); FT_FREE( library->raster_pool );
library->raster_pool_size = 0; library->raster_pool_size = 0;
FREE( library ); FT_FREE( library );
return FT_Err_Ok; return FT_Err_Ok;
} }

View File

@ -263,9 +263,9 @@
*anoutline = null_outline; *anoutline = null_outline;
if ( ALLOC_ARRAY( anoutline->points, numPoints * 2L, FT_Pos ) || if ( FT_NEW_ARRAY( anoutline->points, numPoints * 2L ) ||
ALLOC_ARRAY( anoutline->tags, numPoints, FT_Byte ) || FT_NEW_ARRAY( anoutline->tags, numPoints ) ||
ALLOC_ARRAY( anoutline->contours, numContours, FT_UShort ) ) FT_NEW_ARRAY( anoutline->contours, numContours ) )
goto Fail; goto Fail;
anoutline->n_points = (FT_UShort)numPoints; anoutline->n_points = (FT_UShort)numPoints;
@ -357,13 +357,13 @@
source->n_contours != target->n_contours ) source->n_contours != target->n_contours )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
MEM_Copy( target->points, source->points, FT_MEM_COPY( target->points, source->points,
source->n_points * sizeof ( FT_Vector ) ); source->n_points * sizeof ( FT_Vector ) );
MEM_Copy( target->tags, source->tags, FT_MEM_COPY( target->tags, source->tags,
source->n_points * sizeof ( FT_Byte ) ); source->n_points * sizeof ( FT_Byte ) );
MEM_Copy( target->contours, source->contours, FT_MEM_COPY( target->contours, source->contours,
source->n_contours * sizeof ( FT_Short ) ); source->n_contours * sizeof ( FT_Short ) );
/* copy all flags, except the `ft_outline_owner' one */ /* copy all flags, except the `ft_outline_owner' one */
@ -385,9 +385,9 @@
{ {
if ( outline->flags & ft_outline_owner ) if ( outline->flags & ft_outline_owner )
{ {
FREE( outline->points ); FT_FREE( outline->points );
FREE( outline->tags ); FT_FREE( outline->tags );
FREE( outline->contours ); FT_FREE( outline->contours );
} }
*outline = null_outline; *outline = null_outline;

View File

@ -138,7 +138,7 @@
if ( read_bytes > count ) if ( read_bytes > count )
read_bytes = count; read_bytes = count;
MEM_Copy( buffer, stream->base + pos, read_bytes ); FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
} }
stream->pos = pos + read_bytes; stream->pos = pos + read_bytes;
@ -186,7 +186,7 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FREE( *pbytes ); FT_FREE( *pbytes );
} }
*pbytes = 0; *pbytes = 0;
} }
@ -209,7 +209,7 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
if ( ALLOC( stream->base, count ) ) if ( FT_ALLOC( stream->base, count ) )
goto Exit; goto Exit;
/* read it */ /* read it */
@ -221,7 +221,7 @@
FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n", FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
count, read_bytes )); count, read_bytes ));
FREE( stream->base ); FT_FREE( stream->base );
error = FT_Err_Invalid_Stream_Operation; error = FT_Err_Invalid_Stream_Operation;
} }
stream->cursor = stream->base; stream->cursor = stream->base;
@ -272,7 +272,7 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FREE( stream->base ); FT_FREE( stream->base );
} }
stream->cursor = 0; stream->cursor = 0;
stream->limit = 0; stream->limit = 0;
@ -704,7 +704,7 @@
if ( fields->value == ft_frame_bytes ) if ( fields->value == ft_frame_bytes )
{ {
p = (FT_Byte*)structure + fields->offset; p = (FT_Byte*)structure + fields->offset;
MEM_Copy( p, cursor, len ); FT_MEM_COPY( p, cursor, len );
} }
cursor += len; cursor += len;
fields++; fields++;

View File

@ -46,7 +46,7 @@
return FT_Err_Out_Of_Memory; return FT_Err_Out_Of_Memory;
} }
MEM_Set( *P, 0, size ); FT_MEM_SET( *P, 0, size );
} }
else else
*P = NULL; *P = NULL;
@ -88,7 +88,7 @@
goto Fail; goto Fail;
if ( size > current ) if ( size > current )
MEM_Set( (char*)Q + current, 0, size - current ); FT_MEM_SET( (char*)Q + current, 0, size - current );
*P = Q; *P = Q;
return FT_Err_Ok; return FT_Err_Ok;
@ -300,7 +300,7 @@
if ( destroy ) if ( destroy )
destroy( memory, data, user ); destroy( memory, data, user );
FREE( cur ); FT_FREE( cur );
cur = next; cur = next;
} }

18
src/cache/ftccache.c vendored
View File

@ -210,7 +210,7 @@
if ( clazz->node_done ) if ( clazz->node_done )
clazz->node_done( node, cache ); clazz->node_done( node, cache );
FREE( node ); FT_FREE( node );
/* check, just in case of general corruption :-) */ /* check, just in case of general corruption :-) */
if ( manager->num_nodes == 0 ) if ( manager->num_nodes == 0 )
@ -355,7 +355,7 @@
/* no need to report an error; we'll simply keep using the same */ /* no need to report an error; we'll simply keep using the same */
/* buckets number / size */ /* buckets number / size */
if ( ALLOC_ARRAY( new_buckets, new_size, FTC_Node ) ) if ( FT_NEW_ARRAY( new_buckets, new_size ) )
return; return;
for ( i = 0; i < cache->size; i++ ) for ( i = 0; i < cache->size; i++ )
@ -379,7 +379,7 @@
} }
if ( cache->buckets ) if ( cache->buckets )
FREE( cache->buckets ); FT_FREE( cache->buckets );
cache->buckets = new_buckets; cache->buckets = new_buckets;
cache->size = new_size; cache->size = new_size;
@ -400,7 +400,7 @@
cache->nodes = 0; cache->nodes = 0;
cache->size = FTC_PRIMES_MIN; cache->size = FTC_PRIMES_MIN;
if ( ALLOC_ARRAY( cache->buckets, cache->size, FTC_Node ) ) if ( FT_NEW_ARRAY( cache->buckets, cache->size ) )
goto Exit; goto Exit;
/* now, initialize the lru list of families for this cache */ /* now, initialize the lru list of families for this cache */
@ -425,7 +425,7 @@
memory, memory,
&cache->families ); &cache->families );
if ( error ) if ( error )
FREE( cache->buckets ); FT_FREE( cache->buckets );
} }
Exit: Exit:
@ -463,7 +463,7 @@
if ( clazz->node_done ) if ( clazz->node_done )
clazz->node_done( node, cache ); clazz->node_done( node, cache );
FREE( node ); FT_FREE( node );
node = next; node = next;
} }
cache->buckets[i] = NULL; cache->buckets[i] = NULL;
@ -488,7 +488,7 @@
ftc_cache_clear( cache ); ftc_cache_clear( cache );
FREE( cache->buckets ); FT_FREE( cache->buckets );
cache->size = 0; cache->size = 0;
if ( cache->families ) if ( cache->families )
@ -583,7 +583,7 @@
FTC_Node node; FTC_Node node;
if ( ALLOC( node, clazz->node_size ) ) if ( FT_ALLOC( node, clazz->node_size ) )
goto Exit; goto Exit;
node->fam_index = (FT_UShort) family->fam_index; node->fam_index = (FT_UShort) family->fam_index;
@ -593,7 +593,7 @@
error = clazz->node_init( node, query, cache ); error = clazz->node_init( node, query, cache );
if ( error ) if ( error )
{ {
FREE( node ); FT_FREE( node );
goto Exit; goto Exit;
} }

17
src/cache/ftcmanag.c vendored
View File

@ -336,7 +336,7 @@
ftc_family_table_done( FTC_FamilyTable table, ftc_family_table_done( FTC_FamilyTable table,
FT_Memory memory ) FT_Memory memory )
{ {
FREE( table->entries ); FT_FREE( table->entries );
table->free = 0; table->free = 0;
table->count = 0; table->count = 0;
table->size = 0; table->size = 0;
@ -370,8 +370,7 @@
new_size = 65534; new_size = 65534;
} }
if ( REALLOC_ARRAY( table->entries, old_size, new_size, if ( FT_RENEW_ARRAY( table->entries, old_size, new_size ) )
FTC_FamilyEntryRec ) )
return error; return error;
table->size = new_size; table->size = new_size;
@ -464,7 +463,7 @@
memory = library->memory; memory = library->memory;
if ( ALLOC( manager, sizeof ( *manager ) ) ) if ( FT_NEW( manager ) )
goto Exit; goto Exit;
if ( max_faces == 0 ) if ( max_faces == 0 )
@ -508,7 +507,7 @@
{ {
FT_LruList_Destroy( manager->faces_list ); FT_LruList_Destroy( manager->faces_list );
FT_LruList_Destroy( manager->sizes_list ); FT_LruList_Destroy( manager->sizes_list );
FREE( manager ); FT_FREE( manager );
} }
return error; return error;
@ -538,7 +537,7 @@
if ( cache ) if ( cache )
{ {
cache->clazz->cache_done( cache ); cache->clazz->cache_done( cache );
FREE( cache ); FT_FREE( cache );
manager->caches[idx] = 0; manager->caches[idx] = 0;
} }
} }
@ -553,7 +552,7 @@
FT_LruList_Destroy( manager->sizes_list ); FT_LruList_Destroy( manager->sizes_list );
manager->sizes_list = 0; manager->sizes_list = 0;
FREE( manager ); FT_FREE( manager );
} }
@ -716,7 +715,7 @@
goto Exit; goto Exit;
} }
if ( !ALLOC( cache, clazz->cache_size ) ) if ( !FT_ALLOC( cache, clazz->cache_size ) )
{ {
cache->manager = manager; cache->manager = manager;
cache->memory = memory; cache->memory = memory;
@ -734,7 +733,7 @@
if ( clazz->cache_done ) if ( clazz->cache_done )
clazz->cache_done( cache ); clazz->cache_done( cache );
FREE( cache ); FT_FREE( cache );
goto Exit; goto Exit;
} }
} }

View File

@ -95,8 +95,8 @@
size = (FT_ULong)( pitch * bitmap->rows ); size = (FT_ULong)( pitch * bitmap->rows );
if ( !ALLOC( sbit->buffer, size ) ) if ( !FT_ALLOC( sbit->buffer, size ) )
MEM_Copy( sbit->buffer, bitmap->buffer, size ); FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
return error; return error;
} }
@ -112,7 +112,7 @@
for ( ; count > 0; sbit++, count-- ) for ( ; count > 0; sbit++, count-- )
FREE( sbit->buffer ); FT_FREE( sbit->buffer );
ftc_glyph_node_done( FTC_GLYPH_NODE( snode ), cache ); ftc_glyph_node_done( FTC_GLYPH_NODE( snode ), cache );
} }

18
src/cache/ftlru.c vendored
View File

@ -40,7 +40,7 @@
return FTC_Err_Invalid_Argument; return FTC_Err_Invalid_Argument;
*alist = NULL; *alist = NULL;
if ( !ALLOC( list, clazz->list_size ) ) if ( !FT_ALLOC( list, clazz->list_size ) )
{ {
/* initialize common fields */ /* initialize common fields */
list->clazz = clazz; list->clazz = clazz;
@ -56,7 +56,7 @@
if ( clazz->list_done ) if ( clazz->list_done )
clazz->list_done( list ); clazz->list_done( list );
FREE( list ); FT_FREE( list );
} }
} }
@ -85,7 +85,7 @@
if ( clazz->list_done ) if ( clazz->list_done )
clazz->list_done( list ); clazz->list_done( list );
FREE( list ); FT_FREE( list );
} }
@ -112,7 +112,7 @@
if ( clazz->node_done ) if ( clazz->node_done )
clazz->node_done( node, list->data ); clazz->node_done( node, list->data );
FREE( node ); FT_FREE( node );
node = next; node = next;
} }
@ -233,20 +233,20 @@
*plast = NULL; *plast = NULL;
list->num_nodes--; list->num_nodes--;
FREE( last ); FT_FREE( last );
goto Exit; goto Exit;
} }
} }
/* otherwise, simply allocate a new node */ /* otherwise, simply allocate a new node */
if ( ALLOC( node, clazz->node_size ) ) if ( FT_ALLOC( node, clazz->node_size ) )
goto Exit; goto Exit;
node->key = key; node->key = key;
error = clazz->node_init( node, key, list->data ); error = clazz->node_init( node, key, list->data );
if ( error ) if ( error )
{ {
FREE( node ); FT_FREE( node );
goto Exit; goto Exit;
} }
@ -286,7 +286,7 @@
if ( clazz->node_done ) if ( clazz->node_done )
clazz->node_done( node, list->data ); clazz->node_done( node, list->data );
FREE( node ); FT_FREE( node );
list->num_nodes--; list->num_nodes--;
break; break;
} }
@ -327,7 +327,7 @@
if ( clazz->node_done ) if ( clazz->node_done )
clazz->node_done( node, list ); clazz->node_done( node, list );
FREE( node ); FT_FREE( node );
} }
else else
pnode = &(*pnode)->next; pnode = &(*pnode)->next;

View File

@ -262,11 +262,11 @@
if ( len >= buffer_max ) if ( len >= buffer_max )
len = buffer_max - 1; len = buffer_max - 1;
MEM_Copy( buffer, gname, len ); FT_MEM_COPY( buffer, gname, len );
((FT_Byte*)buffer)[len] = 0; ((FT_Byte*)buffer)[len] = 0;
} }
FREE ( gname ); FT_FREE ( gname );
error = CFF_Err_Ok; error = CFF_Err_Ok;
Exit: Exit:
@ -411,7 +411,7 @@
result = strcmp( glyph_name, name ); result = strcmp( glyph_name, name );
if ( sid > 390 ) if ( sid > 390 )
FREE( name ); FT_FREE( name );
if ( !result ) if ( !result )
return i; return i;

View File

@ -356,7 +356,7 @@
/* clear everything */ /* clear everything */
MEM_Set( decoder, 0, sizeof ( *decoder ) ); FT_MEM_SET( decoder, 0, sizeof ( *decoder ) );
/* initialize builder */ /* initialize builder */
CFF_Builder_Init( &decoder->builder, face, size, slot, hinting ); CFF_Builder_Init( &decoder->builder, face, size, slot, hinting );

View File

@ -1091,7 +1091,7 @@
FT_UShort count; FT_UShort count;
MEM_Set( idx, 0, sizeof ( *idx ) ); FT_MEM_SET( idx, 0, sizeof ( *idx ) );
idx->stream = stream; idx->stream = stream;
if ( !FT_READ_USHORT( count ) && if ( !FT_READ_USHORT( count ) &&
@ -1113,8 +1113,8 @@
idx->off_size = offsize; idx->off_size = offsize;
data_size = (FT_ULong)( count + 1 ) * offsize; data_size = (FT_ULong)( count + 1 ) * offsize;
if ( ALLOC_ARRAY( idx->offsets, count + 1, FT_ULong ) || if ( FT_NEW_ARRAY( idx->offsets, count + 1 ) ||
FT_FRAME_ENTER( data_size ) ) FT_FRAME_ENTER( data_size ) )
goto Exit; goto Exit;
poff = idx->offsets; poff = idx->offsets;
@ -1148,7 +1148,7 @@
Exit: Exit:
if ( error ) if ( error )
FREE( idx->offsets ); FT_FREE( idx->offsets );
return error; return error;
} }
@ -1166,8 +1166,8 @@
if ( idx->bytes ) if ( idx->bytes )
FT_FRAME_RELEASE( idx->bytes ); FT_FRAME_RELEASE( idx->bytes );
FREE( idx->offsets ); FT_FREE( idx->offsets );
MEM_Set( idx, 0, sizeof ( *idx ) ); FT_MEM_SET( idx, 0, sizeof ( *idx ) );
} }
} }
@ -1184,7 +1184,7 @@
*table = 0; *table = 0;
if ( idx->count > 0 && !ALLOC_ARRAY( t, idx->count + 1, FT_Byte* ) ) if ( idx->count > 0 && !FT_NEW_ARRAY( t, idx->count + 1 ) )
{ {
old_offset = 1; old_offset = 1;
for ( n = 0; n <= idx->count; n++ ) for ( n = 0; n <= idx->count; n++ )
@ -1298,9 +1298,9 @@
if ( error ) if ( error )
goto Exit; goto Exit;
if ( !ALLOC( name, byte_len + 1 ) ) if ( !FT_ALLOC( name, byte_len + 1 ) )
{ {
MEM_Copy( name, bytes, byte_len ); FT_MEM_COPY( name, bytes, byte_len );
name[byte_len] = 0; name[byte_len] = 0;
} }
CFF_Forget_Element( idx, &bytes ); CFF_Forget_Element( idx, &bytes );
@ -1333,9 +1333,9 @@
len = (FT_UInt)strlen( adobe_name ); len = (FT_UInt)strlen( adobe_name );
if ( !ALLOC( name, len + 1 ) ) if ( !FT_ALLOC( name, len + 1 ) )
{ {
MEM_Copy( name, adobe_name, len ); FT_MEM_COPY( name, adobe_name, len );
name[len] = 0; name[len] = 0;
} }
@ -1490,8 +1490,8 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FREE( encoding->codes ); FT_FREE( encoding->codes );
FREE( encoding->sids ); FT_FREE( encoding->sids );
encoding->format = 0; encoding->format = 0;
encoding->offset = 0; encoding->offset = 0;
encoding->codes = 0; encoding->codes = 0;
@ -1506,7 +1506,7 @@
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FREE( charset->sids ); FT_FREE( charset->sids );
charset->format = 0; charset->format = 0;
charset->offset = 0; charset->offset = 0;
charset->sids = 0; charset->sids = 0;
@ -1540,7 +1540,7 @@
/* Allocate memory for sids. */ /* Allocate memory for sids. */
if ( ALLOC( charset->sids, num_glyphs * sizeof ( FT_UShort ) ) ) if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit; goto Exit;
/* assign the .notdef glyph */ /* assign the .notdef glyph */
@ -1622,11 +1622,11 @@
} }
/* Allocate memory for sids. */ /* Allocate memory for sids. */
if ( ALLOC( charset->sids, num_glyphs * sizeof ( FT_UShort ) ) ) if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit; goto Exit;
/* Copy the predefined charset into the allocated memory. */ /* Copy the predefined charset into the allocated memory. */
MEM_Copy( charset->sids, cff_isoadobe_charset, FT_MEM_COPY( charset->sids, cff_isoadobe_charset,
num_glyphs * sizeof ( FT_UShort ) ); num_glyphs * sizeof ( FT_UShort ) );
break; break;
@ -1641,11 +1641,11 @@
} }
/* Allocate memory for sids. */ /* Allocate memory for sids. */
if ( ALLOC( charset->sids, num_glyphs * sizeof ( FT_UShort ) ) ) if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit; goto Exit;
/* Copy the predefined charset into the allocated memory. */ /* Copy the predefined charset into the allocated memory. */
MEM_Copy( charset->sids, cff_expert_charset, FT_MEM_COPY( charset->sids, cff_expert_charset,
num_glyphs * sizeof ( FT_UShort ) ); num_glyphs * sizeof ( FT_UShort ) );
break; break;
@ -1660,11 +1660,11 @@
} }
/* Allocate memory for sids. */ /* Allocate memory for sids. */
if ( ALLOC( charset->sids, num_glyphs * sizeof ( FT_UShort ) ) ) if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit; goto Exit;
/* Copy the predefined charset into the allocated memory. */ /* Copy the predefined charset into the allocated memory. */
MEM_Copy( charset->sids, cff_expertsubset_charset, FT_MEM_COPY( charset->sids, cff_expertsubset_charset,
num_glyphs * sizeof ( FT_UShort ) ); num_glyphs * sizeof ( FT_UShort ) );
break; break;
@ -1682,7 +1682,7 @@
if ( charset->sids ) if ( charset->sids )
{ {
if ( charset->sids ) if ( charset->sids )
FREE( charset->sids ); FT_FREE( charset->sids );
charset->format = 0; charset->format = 0;
charset->offset = 0; charset->offset = 0;
charset->sids = 0; charset->sids = 0;
@ -1717,8 +1717,8 @@
/* Allocate memory for sids/codes -- there are at most 256 sids/codes */ /* Allocate memory for sids/codes -- there are at most 256 sids/codes */
/* for an encoding. */ /* for an encoding. */
if ( ALLOC( encoding->sids, 256 * sizeof ( FT_UShort ) ) || if ( FT_NEW_ARRAY( encoding->sids, 256 ) ||
ALLOC( encoding->codes, 256 * sizeof ( FT_UShort ) ) ) FT_NEW_ARRAY( encoding->codes, 256 ) )
goto Exit; goto Exit;
/* Zero out the code to gid/sid mappings. */ /* Zero out the code to gid/sid mappings. */
@ -1866,7 +1866,7 @@
{ {
case 0: case 0:
/* First, copy the code to SID mapping. */ /* First, copy the code to SID mapping. */
MEM_Copy( encoding->sids, cff_standard_encoding, FT_MEM_COPY( encoding->sids, cff_standard_encoding,
256 * sizeof ( FT_UShort ) ); 256 * sizeof ( FT_UShort ) );
/* Construct code to GID mapping from code */ /* Construct code to GID mapping from code */
@ -1897,7 +1897,7 @@
case 1: case 1:
/* First, copy the code to SID mapping. */ /* First, copy the code to SID mapping. */
MEM_Copy( encoding->sids, cff_expert_encoding, FT_MEM_COPY( encoding->sids, cff_expert_encoding,
256 * sizeof ( FT_UShort ) ); 256 * sizeof ( FT_UShort ) );
/* Construct code to GID mapping from code to SID mapping */ /* Construct code to GID mapping from code to SID mapping */
@ -1941,10 +1941,10 @@
if ( encoding->sids || encoding->codes ) if ( encoding->sids || encoding->codes )
{ {
if ( encoding->sids ) if ( encoding->sids )
FREE( encoding->sids ); FT_FREE( encoding->sids );
if ( encoding->codes ) if ( encoding->codes )
FREE( encoding->codes ); FT_FREE( encoding->codes );
charset->format = 0; charset->format = 0;
charset->offset = 0; charset->offset = 0;
@ -1974,7 +1974,7 @@
CFF_Parser_Init( &parser, CFF_CODE_TOPDICT, &font->font_dict ); CFF_Parser_Init( &parser, CFF_CODE_TOPDICT, &font->font_dict );
/* set defaults */ /* set defaults */
MEM_Set( top, 0, sizeof ( *top ) ); FT_MEM_SET( top, 0, sizeof ( *top ) );
top->underline_position = -100; top->underline_position = -100;
top->underline_thickness = 50; top->underline_thickness = 50;
@ -1999,7 +1999,7 @@
if ( top->private_offset && top->private_size ) if ( top->private_offset && top->private_size )
{ {
/* set defaults */ /* set defaults */
MEM_Set( priv, 0, sizeof ( *priv ) ); FT_MEM_SET( priv, 0, sizeof ( *priv ) );
priv->blue_shift = 7; priv->blue_shift = 7;
priv->blue_fuzz = 1; priv->blue_fuzz = 1;
@ -2051,7 +2051,7 @@
if ( subfont ) if ( subfont )
{ {
cff_done_index( &subfont->local_subrs_index ); cff_done_index( &subfont->local_subrs_index );
FREE( subfont->local_subrs ); FT_FREE( subfont->local_subrs );
} }
} }
@ -2080,7 +2080,7 @@
CFF_FontRecDict dict; CFF_FontRecDict dict;
MEM_Set( font, 0, sizeof ( *font ) ); FT_MEM_SET( font, 0, sizeof ( *font ) );
font->stream = stream; font->stream = stream;
font->memory = memory; font->memory = memory;
@ -2159,7 +2159,7 @@
/* allocate & read each font dict independently */ /* allocate & read each font dict independently */
font->num_subfonts = fd_index.count; font->num_subfonts = fd_index.count;
if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFontRec ) ) if ( FT_NEW_ARRAY( sub, fd_index.count ) )
goto Fail_CID; goto Fail_CID;
/* setup pointer table */ /* setup pointer table */
@ -2259,7 +2259,7 @@
for ( idx = 0; idx < font->num_subfonts; idx++ ) for ( idx = 0; idx < font->num_subfonts; idx++ )
CFF_Done_SubFont( memory, font->subfonts[idx] ); CFF_Done_SubFont( memory, font->subfonts[idx] );
FREE( font->subfonts ); FT_FREE( font->subfonts );
} }
CFF_Done_Encoding( &font->encoding, font->stream ); CFF_Done_Encoding( &font->encoding, font->stream );
@ -2269,8 +2269,8 @@
CFF_Done_FD_Select( &font->fd_select, font->stream ); CFF_Done_FD_Select( &font->fd_select, font->stream );
FREE( font->global_subrs ); FT_FREE( font->global_subrs );
FREE( font->font_name ); FT_FREE( font->font_name );
} }

View File

@ -116,7 +116,7 @@
FT_UInt n, count; FT_UInt n, count;
MEM_Set( &priv, 0, sizeof ( priv ) ); FT_MEM_SET( &priv, 0, sizeof ( priv ) );
count = priv.num_blue_values = cpriv->num_blue_values; count = priv.num_blue_values = cpriv->num_blue_values;
for ( n = 0; n < count; n++ ) for ( n = 0; n < count; n++ )
@ -236,9 +236,9 @@
FT_Int len = (FT_Int)strlen( source ); FT_Int len = (FT_Int)strlen( source );
if ( !ALLOC( result, len + 1 ) ) if ( !FT_ALLOC( result, len + 1 ) )
{ {
MEM_Copy( result, source, len ); FT_MEM_COPY( result, source, len );
result[len] = 0; result[len] = 0;
} }
@ -391,7 +391,7 @@
FT_UInt flags; FT_UInt flags;
if ( ALLOC( cff, sizeof ( *cff ) ) ) if ( FT_NEW( cff ) )
goto Exit; goto Exit;
face->extra.data = cff; face->extra.data = cff;
@ -517,7 +517,7 @@
root->num_charmaps = face->num_charmaps; root->num_charmaps = face->num_charmaps;
/* allocate table of pointers */ /* allocate table of pointers */
if ( ALLOC_ARRAY( root->charmaps, root->num_charmaps, FT_CharMap ) ) if ( FT_NEW_ARRAY( root->charmaps, root->num_charmaps ) )
goto Exit; goto Exit;
for ( n = 0; n < root->num_charmaps; n++, charmap++ ) for ( n = 0; n < root->num_charmaps; n++, charmap++ )
@ -569,7 +569,7 @@
if ( cff ) if ( cff )
{ {
CFF_Done_Font( cff ); CFF_Done_Font( cff );
FREE( face->extra.data ); FT_FREE( face->extra.data );
} }
} }
} }

View File

@ -68,7 +68,7 @@
FT_UInt code, FT_UInt code,
void* object ) void* object )
{ {
MEM_Set( parser, 0, sizeof ( *parser ) ); FT_MEM_SET( parser, 0, sizeof ( *parser ) );
parser->top = parser->stack; parser->top = parser->stack;
parser->object_code = code; parser->object_code = code;

View File

@ -89,7 +89,7 @@
/* the charstrings are encoded (stupid!) */ /* the charstrings are encoded (stupid!) */
/* load the charstrings, then execute it */ /* load the charstrings, then execute it */
if ( ALLOC( charstring, glyph_len ) ) if ( FT_ALLOC( charstring, glyph_len ) )
goto Exit; goto Exit;
if ( !FT_STREAM_READ_AT( cid->data_offset + off1, charstring, glyph_len ) ) if ( !FT_STREAM_READ_AT( cid->data_offset + off1, charstring, glyph_len ) )
@ -109,7 +109,7 @@
glyph_len - cs_offset ); glyph_len - cs_offset );
} }
FREE( charstring ); FT_FREE( charstring );
} }
Exit: Exit:

View File

@ -248,7 +248,7 @@
FT_Int n; FT_Int n;
if ( ALLOC_ARRAY( cid->font_dicts, num_dicts, CID_FontDict ) ) if ( FT_NEW_ARRAY( cid->font_dicts, num_dicts ) )
goto Exit; goto Exit;
cid->num_dicts = (FT_UInt)num_dicts; cid->num_dicts = (FT_UInt)num_dicts;
@ -400,7 +400,7 @@
FT_ULong* offsets = 0; FT_ULong* offsets = 0;
if ( ALLOC_ARRAY( face->subrs, cid->num_dicts, CID_SubrsRec ) ) if ( FT_NEW_ARRAY( face->subrs, cid->num_dicts ) )
goto Exit; goto Exit;
subr = face->subrs; subr = face->subrs;
@ -419,7 +419,7 @@
FT_UInt new_max = ( num_subrs + 1 + 3 ) & -4; FT_UInt new_max = ( num_subrs + 1 + 3 ) & -4;
if ( REALLOC_ARRAY( offsets, max_offsets, new_max, FT_ULong ) ) if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
goto Fail; goto Fail;
max_offsets = new_max; max_offsets = new_max;
@ -440,8 +440,8 @@
/* allocate, and read them */ /* allocate, and read them */
data_len = offsets[num_subrs] - offsets[0]; data_len = offsets[num_subrs] - offsets[0];
if ( ALLOC_ARRAY( subr->code, num_subrs + 1, FT_Byte* ) || if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
ALLOC( subr->code[0], data_len ) ) FT_ALLOC( subr->code[0], data_len ) )
goto Fail; goto Fail;
if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) || if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
@ -475,7 +475,7 @@
} }
Exit: Exit:
FREE( offsets ); FT_FREE( offsets );
return error; return error;
Fail: Fail:
@ -484,11 +484,11 @@
for ( n = 0; n < cid->num_dicts; n++ ) for ( n = 0; n < cid->num_dicts; n++ )
{ {
if ( face->subrs[n].code ) if ( face->subrs[n].code )
FREE( face->subrs[n].code[0] ); FT_FREE( face->subrs[n].code[0] );
FREE( face->subrs[n].code ); FT_FREE( face->subrs[n].code );
} }
FREE( face->subrs ); FT_FREE( face->subrs );
} }
goto Exit; goto Exit;
} }
@ -500,7 +500,7 @@
{ {
FT_UNUSED( face ); FT_UNUSED( face );
MEM_Set( loader, 0, sizeof ( *loader ) ); FT_MEM_SET( loader, 0, sizeof ( *loader ) );
} }

View File

@ -209,29 +209,29 @@
if ( subr->code ) if ( subr->code )
{ {
FREE( subr->code[0] ); FT_FREE( subr->code[0] );
FREE( subr->code ); FT_FREE( subr->code );
} }
} }
FREE( face->subrs ); FT_FREE( face->subrs );
} }
/* release FontInfo strings */ /* release FontInfo strings */
FREE( info->version ); FT_FREE( info->version );
FREE( info->notice ); FT_FREE( info->notice );
FREE( info->full_name ); FT_FREE( info->full_name );
FREE( info->family_name ); FT_FREE( info->family_name );
FREE( info->weight ); FT_FREE( info->weight );
/* release font dictionaries */ /* release font dictionaries */
FREE( cid->font_dicts ); FT_FREE( cid->font_dicts );
cid->num_dicts = 0; cid->num_dicts = 0;
/* release other strings */ /* release other strings */
FREE( cid->cid_font_name ); FT_FREE( cid->cid_font_name );
FREE( cid->registry ); FT_FREE( cid->registry );
FREE( cid->ordering ); FT_FREE( cid->ordering );
face->root.family_name = 0; face->root.family_name = 0;
face->root.style_name = 0; face->root.style_name = 0;

View File

@ -62,7 +62,7 @@
FT_Int buff_len; FT_Int buff_len;
MEM_Set( parser, 0, sizeof ( *parser ) ); FT_MEM_SET( parser, 0, sizeof ( *parser ) );
psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory ); psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
parser->stream = stream; parser->stream = stream;
@ -95,7 +95,7 @@
/* fill input buffer */ /* fill input buffer */
buff_len -= 256; buff_len -= 256;
if ( buff_len > 0 ) if ( buff_len > 0 )
MEM_Move( buffer, limit, buff_len ); FT_MEM_MOVE( buffer, limit, buff_len );
p = buffer + buff_len; p = buffer + buff_len;

View File

@ -246,8 +246,8 @@ THE SOFTWARE.
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory = FT_FACE_MEMORY( face );
FREE( face->encodings ); FT_FREE( face->encodings );
FREE( face->metrics ); FT_FREE( face->metrics );
/* free properties */ /* free properties */
{ {
@ -258,19 +258,19 @@ THE SOFTWARE.
{ {
prop = &face->properties[i]; prop = &face->properties[i];
FREE( prop->name ); FT_FREE( prop->name );
if ( prop->isString ) if ( prop->isString )
FREE( prop->value ); FT_FREE( prop->value );
} }
FREE( face->properties ); FT_FREE( face->properties );
} }
FREE( face->toc.tables ); FT_FREE( face->toc.tables );
FREE( face->root.family_name ); FT_FREE( face->root.family_name );
FREE( face->root.available_sizes ); FT_FREE( face->root.available_sizes );
FREE( face->charset_encoding ); FT_FREE( face->charset_encoding );
FREE( face->charset_registry ); FT_FREE( face->charset_registry );
FT_TRACE4(( "DONE_FACE!!!\n" )); FT_TRACE4(( "DONE_FACE!!!\n" ));
@ -462,7 +462,7 @@ THE SOFTWARE.
/* XXX: to do: are there cases that need repadding the bitmap? */ /* XXX: to do: are there cases that need repadding the bitmap? */
bytes = bitmap->pitch * bitmap->rows; bytes = bitmap->pitch * bitmap->rows;
if ( ALLOC( bitmap->buffer, bytes ) ) if ( FT_ALLOC( bitmap->buffer, bytes ) )
goto Exit; goto Exit;
if ( FT_STREAM_SEEK( metric->bits ) || if ( FT_STREAM_SEEK( metric->bits ) ||

View File

@ -105,7 +105,7 @@ THE SOFTWARE.
if ( toc->version != PCF_FILE_VERSION ) if ( toc->version != PCF_FILE_VERSION )
return PCF_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
if ( ALLOC( face->toc.tables, toc->count * sizeof ( PCF_TableRec ) ) ) if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )
return PCF_Err_Out_Of_Memory; return PCF_Err_Out_Of_Memory;
tables = face->toc.tables; tables = face->toc.tables;
@ -145,7 +145,7 @@ THE SOFTWARE.
return PCF_Err_Ok; return PCF_Err_Ok;
Exit: Exit:
FREE( face->toc.tables ); FT_FREE( face->toc.tables );
return error; return error;
} }
@ -383,7 +383,7 @@ THE SOFTWARE.
FT_TRACE4(( "get_prop: nprop = %d\n", nprops )); FT_TRACE4(( "get_prop: nprop = %d\n", nprops ));
if ( ALLOC( props, nprops * sizeof ( PCF_ParsePropertyRec ) ) ) if ( FT_NEW_ARRAY( props, nprops ) )
goto Bail; goto Bail;
for ( i = 0; i < nprops; i++ ) for ( i = 0; i < nprops; i++ )
@ -420,22 +420,21 @@ THE SOFTWARE.
FT_TRACE4(( "get_prop: string_size = %ld\n", string_size )); FT_TRACE4(( "get_prop: string_size = %ld\n", string_size ));
if ( ALLOC( strings, string_size * sizeof ( char ) ) ) if ( FT_NEW_ARRAY( strings, string_size ) )
goto Bail; goto Bail;
error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );
if ( error ) if ( error )
goto Bail; goto Bail;
if ( ALLOC( properties, nprops * sizeof ( PCF_PropertyRec ) ) ) if ( FT_NEW_ARRAY( properties, nprops ) )
goto Bail; goto Bail;
for ( i = 0; i < nprops; i++ ) for ( i = 0; i < nprops; i++ )
{ {
/* XXX: make atom */ /* XXX: make atom */
if ( ALLOC( properties[i].name, if ( FT_NEW_ARRAY( properties[i].name,
( strlen( strings + props[i].name ) + 1 ) * strlen( strings + props[i].name ) + 1 ) )
sizeof ( char ) ) )
goto Bail; goto Bail;
strcpy( properties[i].name,strings + props[i].name ); strcpy( properties[i].name,strings + props[i].name );
@ -443,9 +442,8 @@ THE SOFTWARE.
if ( props[i].isString ) if ( props[i].isString )
{ {
if ( ALLOC( properties[i].value.atom, if ( FT_NEW_ARRAY( properties[i].value.atom,
( strlen( strings + props[i].value ) + 1 ) * strlen( strings + props[i].value ) + 1 ) )
sizeof ( char ) ) )
goto Bail; goto Bail;
strcpy( properties[i].value.atom, strings + props[i].value ); strcpy( properties[i].value.atom, strings + props[i].value );
} }
@ -456,14 +454,14 @@ THE SOFTWARE.
face->properties = properties; face->properties = properties;
face->nprops = nprops; face->nprops = nprops;
FREE( props ); FT_FREE( props );
FREE( strings ); FT_FREE( strings );
return PCF_Err_Ok; return PCF_Err_Ok;
Bail: Bail:
FREE( props ); FT_FREE( props );
FREE( strings ); FT_FREE( strings );
return error; return error;
} }
@ -516,7 +514,7 @@ THE SOFTWARE.
face->nmetrics = nmetrics; face->nmetrics = nmetrics;
if ( ALLOC( face->metrics, nmetrics * sizeof ( PCF_MetricRec ) ) ) if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )
return PCF_Err_Out_Of_Memory; return PCF_Err_Out_Of_Memory;
metrics = face->metrics; metrics = face->metrics;
@ -541,7 +539,7 @@ THE SOFTWARE.
} }
if ( error ) if ( error )
FREE( face->metrics ); FT_FREE( face->metrics );
return error; return error;
} }
@ -586,7 +584,7 @@ THE SOFTWARE.
if ( nbitmaps != face->nmetrics ) if ( nbitmaps != face->nmetrics )
return PCF_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
if ( ALLOC( offsets, nbitmaps * sizeof ( FT_ULong ) ) ) if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
return error; return error;
for ( i = 0; i < nbitmaps; i++ ) for ( i = 0; i < nbitmaps; i++ )
@ -627,12 +625,12 @@ THE SOFTWARE.
face->bitmapsFormat = format; face->bitmapsFormat = format;
FREE ( offsets ); FT_FREE ( offsets );
return error; return error;
Bail: Bail:
FREE ( offsets ); FT_FREE ( offsets );
FREE ( bitmaps ); FT_FREE ( bitmaps );
return error; return error;
} }
@ -693,7 +691,7 @@ THE SOFTWARE.
nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );
if ( ALLOC( tmpEncoding, nencoding * sizeof ( PCF_EncodingRec ) ) ) if ( FT_NEW_ARRAY( tmpEncoding, nencoding ) )
return PCF_Err_Out_Of_Memory; return PCF_Err_Out_Of_Memory;
error = FT_Stream_EnterFrame( stream, 2 * nencoding ); error = FT_Stream_EnterFrame( stream, 2 * nencoding );
@ -723,7 +721,8 @@ THE SOFTWARE.
} }
FT_Stream_ExitFrame( stream ); FT_Stream_ExitFrame( stream );
if ( ALLOC( encoding, (--j) * sizeof ( PCF_EncodingRec ) ) ) j--;
if ( FT_NEW_ARRAY( encoding, j ) )
goto Bail; goto Bail;
for ( i = 0; i < j; i++ ) for ( i = 0; i < j; i++ )
@ -734,13 +733,13 @@ THE SOFTWARE.
face->nencodings = j; face->nencodings = j;
face->encodings = encoding; face->encodings = encoding;
FREE( tmpEncoding ); FT_FREE( tmpEncoding );
return error; return error;
Bail: Bail:
FREE( encoding ); FT_FREE( encoding );
FREE( tmpEncoding ); FT_FREE( tmpEncoding );
return error; return error;
} }
@ -957,7 +956,7 @@ THE SOFTWARE.
int l = strlen( prop->value.atom ) + 1; int l = strlen( prop->value.atom ) + 1;
if ( ALLOC( root->family_name, l * sizeof ( char ) ) ) if ( FT_NEW_ARRAY( root->family_name, l ) )
goto Exit; goto Exit;
strcpy( root->family_name, prop->value.atom ); strcpy( root->family_name, prop->value.atom );
} }
@ -968,7 +967,7 @@ THE SOFTWARE.
root->num_glyphs = face->nmetrics; root->num_glyphs = face->nmetrics;
root->num_fixed_sizes = 1; root->num_fixed_sizes = 1;
if ( ALLOC_ARRAY( root->available_sizes, 1, FT_Bitmap_Size ) ) if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Exit; goto Exit;
prop = pcf_find_property( face, "PIXEL_SIZE" ); prop = pcf_find_property( face, "PIXEL_SIZE" );
@ -1027,14 +1026,12 @@ THE SOFTWARE.
if ( ( charset_registry->isString ) && if ( ( charset_registry->isString ) &&
( charset_encoding->isString ) ) ( charset_encoding->isString ) )
{ {
if ( ALLOC( face->charset_encoding, if ( FT_NEW_ARRAY( face->charset_encoding,
( strlen( charset_encoding->value.atom ) + 1 ) * strlen( charset_encoding->value.atom ) + 1 ) )
sizeof ( char ) ) )
goto Exit; goto Exit;
if ( ALLOC( face->charset_registry, if ( FT_NEW_ARRAY( face->charset_registry,
( strlen( charset_registry->value.atom ) + 1 ) * strlen( charset_registry->value.atom ) + 1 ) )
sizeof ( char ) ) )
goto Exit; goto Exit;
strcpy( face->charset_registry, charset_registry->value.atom ); strcpy( face->charset_registry, charset_registry->value.atom );

View File

@ -62,8 +62,8 @@
table->memory = memory; table->memory = memory;
if ( ALLOC_ARRAY( table->elements, count, FT_Byte* ) || if ( FT_NEW_ARRAY( table->elements, count ) ||
ALLOC_ARRAY( table->lengths, count, FT_Byte* ) ) FT_NEW_ARRAY( table->lengths, count ) )
goto Exit; goto Exit;
table->max_elems = count; table->max_elems = count;
@ -77,7 +77,7 @@
Exit: Exit:
if ( error ) if ( error )
FREE( table->elements ); FT_FREE( table->elements );
return error; return error;
} }
@ -110,15 +110,15 @@
/* allocate new base block */ /* allocate new base block */
if ( ALLOC( table->block, new_size ) ) if ( FT_ALLOC( table->block, new_size ) )
return error; return error;
/* copy elements and shift offsets */ /* copy elements and shift offsets */
if (old_base ) if (old_base )
{ {
MEM_Copy( table->block, old_base, table->capacity ); FT_MEM_COPY( table->block, old_base, table->capacity );
shift_elements( table, old_base ); shift_elements( table, old_base );
FREE( old_base ); FT_FREE( old_base );
} }
table->capacity = new_size; table->capacity = new_size;
@ -187,7 +187,7 @@
/* add the object to the base block and adjust offset */ /* add the object to the base block and adjust offset */
table->elements[idx] = table->block + table->cursor; table->elements[idx] = table->block + table->cursor;
table->lengths [idx] = length; table->lengths [idx] = length;
MEM_Copy( table->block + table->cursor, object, length ); FT_MEM_COPY( table->block + table->cursor, object, length );
table->cursor += length; table->cursor += length;
return PSaux_Err_Ok; return PSaux_Err_Ok;
@ -221,13 +221,13 @@
if ( !old_base ) if ( !old_base )
return; return;
if ( ALLOC( table->block, table->cursor ) ) if ( FT_ALLOC( table->block, table->cursor ) )
return; return;
MEM_Copy( table->block, old_base, table->cursor ); FT_MEM_COPY( table->block, old_base, table->cursor );
shift_elements( table, old_base ); shift_elements( table, old_base );
table->capacity = table->cursor; table->capacity = table->cursor;
FREE( old_base ); FT_FREE( old_base );
FT_UNUSED( error ); FT_UNUSED( error );
} }
@ -241,9 +241,9 @@
if ( (FT_ULong)table->init == 0xDEADBEEFUL ) if ( (FT_ULong)table->init == 0xDEADBEEFUL )
{ {
FREE( table->block ); FT_FREE( table->block );
FREE( table->elements ); FT_FREE( table->elements );
FREE( table->lengths ); FT_FREE( table->lengths );
table->init = 0; table->init = 0;
} }
} }
@ -735,11 +735,11 @@
} }
len = cur - *cursor; len = cur - *cursor;
if ( cur >= limit || ALLOC( result, len + 1 ) ) if ( cur >= limit || FT_ALLOC( result, len + 1 ) )
return 0; return 0;
/* now copy the string */ /* now copy the string */
MEM_Copy( result, *cursor, len ); FT_MEM_COPY( result, *cursor, len );
result[len] = '\0'; result[len] = '\0';
*cursor = cur; *cursor = cur;
return result; return result;
@ -867,10 +867,10 @@
/* with synthetic fonts, it's possible to find a field twice */ /* with synthetic fonts, it's possible to find a field twice */
break; break;
if ( ALLOC( string, len + 1 ) ) if ( FT_ALLOC( string, len + 1 ) )
goto Exit; goto Exit;
MEM_Copy( string, cur, len ); FT_MEM_COPY( string, cur, len );
string[len] = 0; string[len] = 0;
*(FT_String**)q = string; *(FT_String**)q = string;

View File

@ -268,7 +268,7 @@
count = face->type1.num_glyphs; count = face->type1.num_glyphs;
if ( !ALLOC_ARRAY( cmap->pairs, count, T1_CMapUniPairRec ) ) if ( !FT_NEW_ARRAY( cmap->pairs, count ) )
{ {
FT_UInt n, new_count; FT_UInt n, new_count;
T1_CMapUniPair pair; T1_CMapUniPair pair;
@ -298,7 +298,7 @@
if ( new_count == 0 ) if ( new_count == 0 )
{ {
/* there are no unicode characters in here !! */ /* there are no unicode characters in here !! */
FREE( cmap->pairs ); FT_FREE( cmap->pairs );
error = FT_Err_Invalid_Argument; error = FT_Err_Invalid_Argument;
} }
else else
@ -307,7 +307,7 @@
/* one.. */ /* one.. */
if ( new_count != count && new_count < count/2 ) if ( new_count != count && new_count < count/2 )
{ {
(void)REALLOC_ARRAY( cmap->pairs, count, new_count, T1_CMapUniPairRec ); (void)FT_RENEW_ARRAY( cmap->pairs, count, new_count );
error = 0; error = 0;
} }
@ -331,7 +331,7 @@
FT_Face face = FT_CMAP_FACE(cmap); FT_Face face = FT_CMAP_FACE(cmap);
FT_Memory memory = FT_FACE_MEMORY(face); FT_Memory memory = FT_FACE_MEMORY(face);
FREE( cmap->pairs ); FT_FREE( cmap->pairs );
cmap->num_pairs = 0; cmap->num_pairs = 0;
} }

View File

@ -1117,7 +1117,7 @@
FT_Bool hinting, FT_Bool hinting,
T1_Decoder_Callback parse_callback ) T1_Decoder_Callback parse_callback )
{ {
MEM_Set( decoder, 0, sizeof ( *decoder ) ); FT_MEM_SET( decoder, 0, sizeof ( *decoder ) );
/* retrieve PSNames interface from list of current modules */ /* retrieve PSNames interface from list of current modules */
{ {

View File

@ -53,12 +53,12 @@
psh1_hint_table_done( PSH1_Hint_Table table, psh1_hint_table_done( PSH1_Hint_Table table,
FT_Memory memory ) FT_Memory memory )
{ {
FREE( table->zones ); FT_FREE( table->zones );
table->num_zones = 0; table->num_zones = 0;
table->zone = 0; table->zone = 0;
FREE( table->sort ); FT_FREE( table->sort );
FREE( table->hints ); FT_FREE( table->hints );
table->num_hints = 0; table->num_hints = 0;
table->max_hints = 0; table->max_hints = 0;
table->sort_global = 0; table->sort_global = 0;
@ -176,9 +176,9 @@
/* allocate our tables */ /* allocate our tables */
if ( ALLOC_ARRAY( table->sort, 2 * count, PSH1_Hint ) || if ( FT_NEW_ARRAY( table->sort, 2 * count ) ||
ALLOC_ARRAY( table->hints, count, PSH1_HintRec ) || FT_NEW_ARRAY( table->hints, count ) ||
ALLOC_ARRAY( table->zones, 2 * count + 1, PSH1_ZoneRec ) ) FT_NEW_ARRAY( table->zones, 2 * count + 1 ) )
goto Exit; goto Exit;
table->max_hints = count; table->max_hints = count;

View File

@ -54,12 +54,12 @@
psh2_hint_table_done( PSH2_Hint_Table table, psh2_hint_table_done( PSH2_Hint_Table table,
FT_Memory memory ) FT_Memory memory )
{ {
FREE( table->zones ); FT_FREE( table->zones );
table->num_zones = 0; table->num_zones = 0;
table->zone = 0; table->zone = 0;
FREE( table->sort ); FT_FREE( table->sort );
FREE( table->hints ); FT_FREE( table->hints );
table->num_hints = 0; table->num_hints = 0;
table->max_hints = 0; table->max_hints = 0;
table->sort_global = 0; table->sort_global = 0;
@ -173,9 +173,9 @@
/* allocate our tables */ /* allocate our tables */
if ( ALLOC_ARRAY( table->sort, 2 * count, PSH2_Hint ) || if ( FT_NEW_ARRAY( table->sort, 2 * count ) ||
ALLOC_ARRAY( table->hints, count, PSH2_HintRec ) || FT_NEW_ARRAY( table->hints, count ) ||
ALLOC_ARRAY( table->zones, 2 * count + 1, PSH2_ZoneRec ) ) FT_NEW_ARRAY( table->zones, 2 * count + 1 ) )
goto Exit; goto Exit;
table->max_hints = count; table->max_hints = count;
@ -814,8 +814,8 @@
psh2_hint_table_done( &glyph->hint_tables[1], memory ); psh2_hint_table_done( &glyph->hint_tables[1], memory );
psh2_hint_table_done( &glyph->hint_tables[0], memory ); psh2_hint_table_done( &glyph->hint_tables[0], memory );
FREE( glyph->points ); FT_FREE( glyph->points );
FREE( glyph->contours ); FT_FREE( glyph->contours );
glyph->num_points = 0; glyph->num_points = 0;
glyph->num_contours = 0; glyph->num_contours = 0;
@ -866,10 +866,8 @@
memory = globals->memory; memory = globals->memory;
/* allocate and setup points + contours arrays */ /* allocate and setup points + contours arrays */
if ( ALLOC_ARRAY( glyph->points, outline->n_points, if ( FT_NEW_ARRAY( glyph->points, outline->n_points ) ||
PSH2_PointRec ) || FT_NEW_ARRAY( glyph->contours, outline->n_contours ) )
ALLOC_ARRAY( glyph->contours, outline->n_contours,
PSH2_ContourRec ) )
goto Exit; goto Exit;
glyph->num_points = outline->n_points; glyph->num_points = outline->n_points;
@ -1512,10 +1510,10 @@
if ( ps2_debug_glyph ) if ( ps2_debug_glyph )
{ {
psh2_glyph_done( ps2_debug_glyph ); psh2_glyph_done( ps2_debug_glyph );
FREE( ps2_debug_glyph ); FT_FREE( ps2_debug_glyph );
} }
if ( ALLOC( glyph, sizeof ( *glyph ) ) ) if ( FT_NEW( glyph ) )
return error; return error;
ps2_debug_glyph = glyph; ps2_debug_glyph = glyph;

View File

@ -568,7 +568,7 @@
globals->blues.family_top.count = 0; globals->blues.family_top.count = 0;
globals->blues.family_bottom.count = 0; globals->blues.family_bottom.count = 0;
FREE( globals ); FT_FREE( globals );
#ifdef DEBUG_HINTER #ifdef DEBUG_HINTER
ps_debug_globals = 0; ps_debug_globals = 0;
@ -586,7 +586,7 @@
FT_Error error; FT_Error error;
if ( !ALLOC( globals, sizeof ( *globals ) ) ) if ( !FT_NEW( globals ) )
{ {
FT_UInt count; FT_UInt count;
FT_Short* read; FT_Short* read;

View File

@ -46,7 +46,7 @@
ps_hint_table_done( PS_Hint_Table table, ps_hint_table_done( PS_Hint_Table table,
FT_Memory memory ) FT_Memory memory )
{ {
FREE( table->hints ); FT_FREE( table->hints );
table->num_hints = 0; table->num_hints = 0;
table->max_hints = 0; table->max_hints = 0;
} }
@ -67,7 +67,7 @@
{ {
/* try to grow the table */ /* try to grow the table */
new_max = ( new_max + 7 ) & -8; new_max = ( new_max + 7 ) & -8;
if ( !REALLOC_ARRAY( table->hints, old_max, new_max, PS_HintRec ) ) if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )
table->max_hints = new_max; table->max_hints = new_max;
} }
return error; return error;
@ -120,7 +120,7 @@
ps_mask_done( PS_Mask mask, ps_mask_done( PS_Mask mask,
FT_Memory memory ) FT_Memory memory )
{ {
FREE( mask->bytes ); FT_FREE( mask->bytes );
mask->num_bits = 0; mask->num_bits = 0;
mask->max_bits = 0; mask->max_bits = 0;
mask->end_point = 0; mask->end_point = 0;
@ -141,7 +141,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 7 ) & -8; new_max = ( new_max + 7 ) & -8;
if ( !REALLOC_ARRAY( mask->bytes, old_max, new_max, FT_Byte ) ) if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )
mask->max_bits = new_max * 8; mask->max_bits = new_max * 8;
} }
return error; return error;
@ -218,7 +218,7 @@
for ( ; count > 0; count--, mask++ ) for ( ; count > 0; count--, mask++ )
ps_mask_done( mask, memory ); ps_mask_done( mask, memory );
FREE( table->masks ); FT_FREE( table->masks );
table->num_masks = 0; table->num_masks = 0;
table->max_masks = 0; table->max_masks = 0;
} }
@ -238,7 +238,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 7 ) & -8; new_max = ( new_max + 7 ) & -8;
if ( !REALLOC_ARRAY( table->masks, old_max, new_max, PS_MaskRec ) ) if ( !FT_RENEW_ARRAY( table->masks, old_max, new_max ) )
table->max_masks = new_max; table->max_masks = new_max;
} }
return error; return error;

View File

@ -154,7 +154,7 @@
table->num_maps = 0; table->num_maps = 0;
table->maps = 0; table->maps = 0;
if ( !ALLOC_ARRAY( table->maps, num_glyphs, PS_UniMap ) ) if ( !FT_NEW_ARRAY( table->maps, num_glyphs ) )
{ {
FT_UInt n; FT_UInt n;
FT_UInt count; FT_UInt count;
@ -185,14 +185,14 @@
/* now, compress the table a bit */ /* now, compress the table a bit */
count = (FT_UInt)( map - table->maps ); count = (FT_UInt)( map - table->maps );
if ( count > 0 && REALLOC( table->maps, if ( count > 0 && FT_REALLOC( table->maps,
num_glyphs * sizeof ( PS_UniMap ), num_glyphs * sizeof ( PS_UniMap ),
count * sizeof ( PS_UniMap ) ) ) count * sizeof ( PS_UniMap ) ) )
count = 0; count = 0;
if ( count == 0 ) if ( count == 0 )
{ {
FREE( table->maps ); FT_FREE( table->maps );
if ( !error ) if ( !error )
error = PSnames_Err_Invalid_Argument; /* no unicode chars here! */ error = PSnames_Err_Invalid_Argument; /* no unicode chars here! */
} }

View File

@ -186,8 +186,8 @@
#endif /* _STANDALONE_ */ #endif /* _STANDALONE_ */
#ifndef MEM_Set #ifndef FT_MEM_SET
#define MEM_Set( d, s, c ) memset( d, s, c ) #define FT_MEM_SET( d, s, c ) memset( d, s, c )
#endif #endif
@ -3146,7 +3146,7 @@
*araster = &the_raster; *araster = &the_raster;
MEM_Set( &the_raster, sizeof ( the_raster ), 0 ); FT_MEM_SET( &the_raster, sizeof ( the_raster ), 0 );
ft_black_init( &the_raster ); ft_black_init( &the_raster );
return 0; return 0;
@ -3173,7 +3173,7 @@
*araster = 0; *araster = 0;
if ( !ALLOC( raster, sizeof ( *raster ) ) ) if ( !FT_NEW( raster ) )
{ {
raster->memory = memory; raster->memory = memory;
ft_black_init( raster ); ft_black_init( raster );
@ -3189,7 +3189,7 @@
ft_black_done( TRaster_Instance* raster ) ft_black_done( TRaster_Instance* raster )
{ {
FT_Memory memory = (FT_Memory)raster->memory; FT_Memory memory = (FT_Memory)raster->memory;
FREE( raster ); FT_FREE( raster );
} }

View File

@ -86,7 +86,7 @@
FT_GlyphSlot slot, FT_GlyphSlot slot,
FT_BBox* cbox ) FT_BBox* cbox )
{ {
MEM_Set( cbox, 0, sizeof ( *cbox ) ); FT_MEM_SET( cbox, 0, sizeof ( *cbox ) );
if ( slot->format == render->glyph_format ) if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox ); FT_Outline_Get_CBox( &slot->outline, cbox );
@ -153,7 +153,7 @@
/* release old bitmap buffer */ /* release old bitmap buffer */
if ( slot->flags & FT_GLYPH_OWN_BITMAP ) if ( slot->flags & FT_GLYPH_OWN_BITMAP )
{ {
FREE( bitmap->buffer ); FT_FREE( bitmap->buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->flags &= ~FT_GLYPH_OWN_BITMAP;
} }
@ -175,7 +175,7 @@
bitmap->rows = height; bitmap->rows = height;
bitmap->pitch = pitch; bitmap->pitch = pitch;
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit; goto Exit;
slot->flags |= FT_GLYPH_OWN_BITMAP; slot->flags |= FT_GLYPH_OWN_BITMAP;

View File

@ -103,7 +103,7 @@
if ( len >= buffer_max ) if ( len >= buffer_max )
len = buffer_max - 1; len = buffer_max - 1;
MEM_Copy( buffer, gname, len ); FT_MEM_COPY( buffer, gname, len );
((FT_Byte*)buffer)[len] = 0; ((FT_Byte*)buffer)[len] = 0;
} }
@ -153,7 +153,7 @@
FT_UInt len = name->stringLength/2; FT_UInt len = name->stringLength/2;
FT_Error error; FT_Error error;
if ( !ALLOC( result, len+1 ) ) if ( !FT_ALLOC( result, len+1 ) )
{ {
FT_String* r = (FT_String*)result; FT_String* r = (FT_String*)result;
FT_Byte* p = (FT_Byte*) name->string; FT_Byte* p = (FT_Byte*) name->string;
@ -176,9 +176,9 @@
FT_Error error; FT_Error error;
FT_String* result; FT_String* result;
if ( !ALLOC( result, len+1 ) ) if ( !FT_ALLOC( result, len+1 ) )
{ {
MEM_Copy( result, name->string, len ); FT_MEM_COPY( result, name->string, len );
result[len] = '\0'; result[len] = '\0';
} }
goto Exit; goto Exit;

View File

@ -131,7 +131,7 @@
len = (FT_UInt)rec->stringLength / 2; len = (FT_UInt)rec->stringLength / 2;
if ( MEM_Alloc( string, len + 1 ) ) if ( FT_MEM_ALLOC( string, len + 1 ) )
return NULL; return NULL;
for ( m = 0; m < len; m ++ ) for ( m = 0; m < len; m ++ )
@ -140,10 +140,10 @@
else else
{ {
len = rec->stringLength; len = rec->stringLength;
if ( MEM_Alloc( string, len + 1 ) ) if ( FT_MEM_ALLOC( string, len + 1 ) )
return NULL; return NULL;
MEM_Copy( string, rec->string, len ); FT_MEM_COPY( string, rec->string, len );
} }
string[len] = '\0'; string[len] = '\0';
@ -458,7 +458,7 @@
root->num_charmaps = face->num_charmaps; root->num_charmaps = face->num_charmaps;
/* allocate table of pointers */ /* allocate table of pointers */
if ( ALLOC_ARRAY( root->charmaps, root->num_charmaps, FT_CharMap ) ) if ( FT_NEW_ARRAY( root->charmaps, root->num_charmaps ) )
goto Exit; goto Exit;
for ( n = 0; n < root->num_charmaps; n++, charmap++ ) for ( n = 0; n < root->num_charmaps; n++, charmap++ )
@ -497,9 +497,7 @@
#endif #endif
root->num_fixed_sizes = face->num_sbit_strikes; root->num_fixed_sizes = face->num_sbit_strikes;
if ( ALLOC_ARRAY( root->available_sizes, if ( FT_NEW_ARRAY( root->available_sizes, face->num_sbit_strikes ) )
face->num_sbit_strikes,
FT_Bitmap_Size ) )
goto Exit; goto Exit;
for ( n = 0 ; n < face->num_sbit_strikes ; n++ ) for ( n = 0 ; n < face->num_sbit_strikes ; n++ )
@ -637,15 +635,15 @@
} }
/* freeing the kerning table */ /* freeing the kerning table */
FREE( face->kern_pairs ); FT_FREE( face->kern_pairs );
face->num_kern_pairs = 0; face->num_kern_pairs = 0;
/* freeing the collection table */ /* freeing the collection table */
FREE( face->ttc_header.offsets ); FT_FREE( face->ttc_header.offsets );
face->ttc_header.count = 0; face->ttc_header.count = 0;
/* freeing table directory */ /* freeing table directory */
FREE( face->dir_tables ); FT_FREE( face->dir_tables );
face->num_tables = 0; face->num_tables = 0;
/* freeing the character mapping tables */ /* freeing the character mapping tables */
@ -658,27 +656,27 @@
sfnt->free_charmap( face, &face->charmaps[n].cmap ); sfnt->free_charmap( face, &face->charmaps[n].cmap );
} }
FREE( face->charmaps ); FT_FREE( face->charmaps );
face->num_charmaps = 0; face->num_charmaps = 0;
FREE( face->root.charmaps ); FT_FREE( face->root.charmaps );
face->root.num_charmaps = 0; face->root.num_charmaps = 0;
face->root.charmap = 0; face->root.charmap = 0;
/* freeing the horizontal metrics */ /* freeing the horizontal metrics */
FREE( face->horizontal.long_metrics ); FT_FREE( face->horizontal.long_metrics );
FREE( face->horizontal.short_metrics ); FT_FREE( face->horizontal.short_metrics );
/* freeing the vertical ones, if any */ /* freeing the vertical ones, if any */
if ( face->vertical_info ) if ( face->vertical_info )
{ {
FREE( face->vertical.long_metrics ); FT_FREE( face->vertical.long_metrics );
FREE( face->vertical.short_metrics ); FT_FREE( face->vertical.short_metrics );
face->vertical_info = 0; face->vertical_info = 0;
} }
/* freeing the gasp table */ /* freeing the gasp table */
FREE( face->gasp.gaspRanges ); FT_FREE( face->gasp.gaspRanges );
face->gasp.numRanges = 0; face->gasp.numRanges = 0;
/* freeing the name table */ /* freeing the name table */
@ -688,13 +686,13 @@
sfnt->free_hdmx( face ); sfnt->free_hdmx( face );
/* freeing family and style name */ /* freeing family and style name */
FREE( face->root.family_name ); FT_FREE( face->root.family_name );
FREE( face->root.style_name ); FT_FREE( face->root.style_name );
/* freeing sbit size table */ /* freeing sbit size table */
face->root.num_fixed_sizes = 0; face->root.num_fixed_sizes = 0;
if ( face->root.available_sizes ) if ( face->root.available_sizes )
FREE( face->root.available_sizes ); FT_FREE( face->root.available_sizes );
face->sfnt = 0; face->sfnt = 0;
} }

View File

@ -144,7 +144,7 @@
cmap0 = &cmap->c.cmap0; cmap0 = &cmap->c.cmap0;
if ( FT_READ_USHORT( cmap0->language ) || if ( FT_READ_USHORT( cmap0->language ) ||
ALLOC( cmap0->glyphIdArray, 256L ) || FT_ALLOC( cmap0->glyphIdArray, 256L ) ||
FT_STREAM_READ( cmap0->glyphIdArray, 256L ) ) FT_STREAM_READ( cmap0->glyphIdArray, 256L ) )
goto Fail; goto Fail;
@ -158,7 +158,7 @@
/* allocate subheader keys */ /* allocate subheader keys */
if ( ALLOC_ARRAY( cmap2->subHeaderKeys, 256, FT_UShort ) || if ( FT_NEW_ARRAY( cmap2->subHeaderKeys, 256 ) ||
FT_FRAME_ENTER( 2L + 512L ) ) FT_FRAME_ENTER( 2L + 512L ) )
goto Fail; goto Fail;
@ -180,12 +180,10 @@
cmap2->numGlyphId = l = (FT_UShort)( cmap2->numGlyphId = l = (FT_UShort)(
( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFF ) / 2 ); ( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xFFFF ) / 2 );
if ( ALLOC_ARRAY( cmap2->subHeaders, if ( FT_NEW_ARRAY( cmap2->subHeaders, num_SH + 1 ) ||
num_SH + 1, FT_FRAME_ENTER( ( num_SH + 1 ) * 8L ) )
TT_CMap2SubHeaderRec ) ||
FT_FRAME_ENTER( ( num_SH + 1 ) * 8L ) )
{ {
FREE( cmap2->subHeaderKeys ); FT_FREE( cmap2->subHeaderKeys );
goto Fail; goto Fail;
} }
@ -207,11 +205,11 @@
/* load glyph IDs */ /* load glyph IDs */
if ( ALLOC_ARRAY( cmap2->glyphIdArray, l, FT_UShort ) || if ( FT_NEW_ARRAY( cmap2->glyphIdArray, l ) ||
FT_FRAME_ENTER( l * 2L ) ) FT_FRAME_ENTER( l * 2L ) )
{ {
FREE( cmap2->subHeaders ); FT_FREE( cmap2->subHeaders );
FREE( cmap2->subHeaderKeys ); FT_FREE( cmap2->subHeaderKeys );
goto Fail; goto Fail;
} }
@ -244,9 +242,7 @@
/* load segments */ /* load segments */
if ( ALLOC_ARRAY( cmap4->segments, if ( FT_NEW_ARRAY( cmap4->segments, num_Seg ) ||
num_Seg,
TT_CMap4SegmentRec ) ||
FT_FRAME_ENTER( ( num_Seg * 4 + 1 ) * 2L ) ) FT_FRAME_ENTER( ( num_Seg * 4 + 1 ) * 2L ) )
goto Fail; goto Fail;
@ -273,10 +269,10 @@
/* load IDs */ /* load IDs */
if ( ALLOC_ARRAY( cmap4->glyphIdArray, l, FT_UShort ) || if ( FT_NEW_ARRAY( cmap4->glyphIdArray, l ) ||
FT_FRAME_ENTER( l * 2L ) ) FT_FRAME_ENTER( l * 2L ) )
{ {
FREE( cmap4->segments ); FT_FREE( cmap4->segments );
goto Fail; goto Fail;
} }
@ -305,8 +301,8 @@
l = cmap6->entryCount; l = cmap6->entryCount;
if ( ALLOC_ARRAY( cmap6->glyphIdArray, l, FT_Short ) || if ( FT_NEW_ARRAY( cmap6->glyphIdArray, l ) ||
FT_FRAME_ENTER( l * 2L ) ) FT_FRAME_ENTER( l * 2L ) )
goto Fail; goto Fail;
for ( i = 0; i < l; i++ ) for ( i = 0; i < l; i++ )
@ -338,8 +334,8 @@
n = cmap8_12->nGroups; n = cmap8_12->nGroups;
if ( ALLOC_ARRAY( cmap8_12->groups, n, TT_CMapGroupRec ) || if ( FT_NEW_ARRAY( cmap8_12->groups, n ) ||
FT_FRAME_ENTER( n * 3 * 4L ) ) FT_FRAME_ENTER( n * 3 * 4L ) )
goto Fail; goto Fail;
groups = cmap8_12->groups; groups = cmap8_12->groups;
@ -374,8 +370,8 @@
n = cmap10->numChars; n = cmap10->numChars;
if ( ALLOC_ARRAY( cmap10->glyphs, n, FT_Short ) || if ( FT_NEW_ARRAY( cmap10->glyphs, n ) ||
FT_FRAME_ENTER( n * 2L ) ) FT_FRAME_ENTER( n * 2L ) )
goto Fail; goto Fail;
for ( j = 0; j < n; j++ ) for ( j = 0; j < n; j++ )
@ -429,34 +425,34 @@
switch ( cmap->format ) switch ( cmap->format )
{ {
case 0: case 0:
FREE( cmap->c.cmap0.glyphIdArray ); FT_FREE( cmap->c.cmap0.glyphIdArray );
break; break;
case 2: case 2:
FREE( cmap->c.cmap2.subHeaderKeys ); FT_FREE( cmap->c.cmap2.subHeaderKeys );
FREE( cmap->c.cmap2.subHeaders ); FT_FREE( cmap->c.cmap2.subHeaders );
FREE( cmap->c.cmap2.glyphIdArray ); FT_FREE( cmap->c.cmap2.glyphIdArray );
break; break;
case 4: case 4:
FREE( cmap->c.cmap4.segments ); FT_FREE( cmap->c.cmap4.segments );
FREE( cmap->c.cmap4.glyphIdArray ); FT_FREE( cmap->c.cmap4.glyphIdArray );
cmap->c.cmap4.segCountX2 = 0; cmap->c.cmap4.segCountX2 = 0;
break; break;
case 6: case 6:
FREE( cmap->c.cmap6.glyphIdArray ); FT_FREE( cmap->c.cmap6.glyphIdArray );
cmap->c.cmap6.entryCount = 0; cmap->c.cmap6.entryCount = 0;
break; break;
case 8: case 8:
case 12: case 12:
FREE( cmap->c.cmap8_12.groups ); FT_FREE( cmap->c.cmap8_12.groups );
cmap->c.cmap8_12.nGroups = 0; cmap->c.cmap8_12.nGroups = 0;
break; break;
case 10: case 10:
FREE( cmap->c.cmap10.glyphs ); FT_FREE( cmap->c.cmap10.glyphs );
cmap->c.cmap10.numChars = 0; cmap->c.cmap10.numChars = 0;
break; break;

View File

@ -221,10 +221,8 @@
goto Exit; goto Exit;
/* now read the offsets of each font in the file */ /* now read the offsets of each font in the file */
if ( ALLOC_ARRAY( face->ttc_header.offsets, if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) ||
face->ttc_header.count, FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
FT_ULong ) ||
FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
goto Exit; goto Exit;
for ( n = 0; n < face->ttc_header.count; n++ ) for ( n = 0; n < face->ttc_header.count; n++ )
@ -312,9 +310,7 @@
face->num_tables = sfnt->num_tables; face->num_tables = sfnt->num_tables;
if ( ALLOC_ARRAY( face->dir_tables, if ( FT_NEW_ARRAY( face->dir_tables, face->num_tables ) )
face->num_tables,
TT_TableRec ) )
goto Exit; goto Exit;
if ( FT_FRAME_ENTER( face->num_tables * 16L ) ) if ( FT_FRAME_ENTER( face->num_tables * 16L ) )
@ -749,8 +745,8 @@
goto Exit; goto Exit;
} }
if ( ALLOC_ARRAY( *longs, num_longs, TT_LongMetricsRec ) || if ( FT_NEW_ARRAY( *longs, num_longs ) ||
ALLOC_ARRAY( *shorts, num_shorts, TT_ShortMetrics ) ) FT_NEW_ARRAY( *shorts, num_shorts ) )
goto Exit; goto Exit;
if ( FT_FRAME_ENTER( table_len ) ) if ( FT_FRAME_ENTER( table_len ) )
@ -987,7 +983,7 @@
storageSize = (FT_ULong)(table_len - storageOffset); storageSize = (FT_ULong)(table_len - storageOffset);
/* Allocate the array of name records. */ /* Allocate the array of name records. */
if ( ALLOC( names->names, if ( FT_ALLOC( names->names,
names->numNameRecords*sizeof(TT_NameEntryRec) + storageSize ) || names->numNameRecords*sizeof(TT_NameEntryRec) + storageSize ) ||
FT_FRAME_ENTER( names->numNameRecords * 12L ) ) FT_FRAME_ENTER( names->numNameRecords * 12L ) )
goto Exit; goto Exit;
@ -1097,10 +1093,10 @@
/* free strings table */ /* free strings table */
FREE( names->names ); FT_FREE( names->names );
/* free strings storage */ /* free strings storage */
FREE( names->storage ); FT_FREE( names->storage );
names->numNameRecords = 0; names->numNameRecords = 0;
names->format = 0; names->format = 0;
@ -1171,9 +1167,7 @@
goto Exit; goto Exit;
/* reserve space in face table for cmap tables */ /* reserve space in face table for cmap tables */
if ( ALLOC_ARRAY( face->charmaps, if ( FT_NEW_ARRAY( face->charmaps, cmap_dir.numCMaps ) )
cmap_dir.numCMaps,
TT_CharMapRec ) )
goto Exit; goto Exit;
face->num_charmaps = cmap_dir.numCMaps; face->num_charmaps = cmap_dir.numCMaps;
@ -1534,8 +1528,8 @@
num_ranges = face->gasp.numRanges; num_ranges = face->gasp.numRanges;
FT_TRACE3(( "number of ranges = %d\n", num_ranges )); FT_TRACE3(( "number of ranges = %d\n", num_ranges ));
if ( ALLOC_ARRAY( gaspranges, num_ranges, TT_GaspRangeRec ) || if ( FT_NEW_ARRAY( gaspranges, num_ranges ) ||
FT_FRAME_ENTER( num_ranges * 4L ) ) FT_FRAME_ENTER( num_ranges * 4L ) )
goto Exit; goto Exit;
face->gasp.gaspRanges = gaspranges; face->gasp.gaspRanges = gaspranges;
@ -1638,8 +1632,8 @@
FT_FRAME_EXIT(); FT_FRAME_EXIT();
/* allocate array of kerning pairs */ /* allocate array of kerning pairs */
if ( ALLOC_ARRAY( face->kern_pairs, num_pairs, TT_Kern0_PairRec ) || if ( FT_NEW_ARRAY( face->kern_pairs, num_pairs ) ||
FT_FRAME_ENTER( 6L * num_pairs ) ) FT_FRAME_ENTER( 6L * num_pairs ) )
goto Exit; goto Exit;
pair = face->kern_pairs; pair = face->kern_pairs;
@ -1763,7 +1757,7 @@
if ( hdmx->version != 0 ) if ( hdmx->version != 0 )
goto Exit; goto Exit;
if ( ALLOC_ARRAY( hdmx->records, hdmx->num_records, TT_HdmxEntryRec ) ) if ( FT_NEW_ARRAY( hdmx->records, hdmx->num_records ) )
goto Exit; goto Exit;
num_glyphs = face->root.num_glyphs; num_glyphs = face->root.num_glyphs;
@ -1781,7 +1775,7 @@
FT_READ_BYTE( cur->max_width ) ) FT_READ_BYTE( cur->max_width ) )
goto Exit; goto Exit;
if ( ALLOC( cur->widths, num_glyphs ) || if ( FT_ALLOC( cur->widths, num_glyphs ) ||
FT_STREAM_READ( cur->widths, num_glyphs ) ) FT_STREAM_READ( cur->widths, num_glyphs ) )
goto Exit; goto Exit;
@ -1817,9 +1811,9 @@
for ( n = 0; n < face->hdmx.num_records; n++ ) for ( n = 0; n < face->hdmx.num_records; n++ )
FREE( face->hdmx.records[n].widths ); FT_FREE( face->hdmx.records[n].widths );
FREE( face->hdmx.records ); FT_FREE( face->hdmx.records );
face->hdmx.num_records = 0; face->hdmx.num_records = 0;
} }
} }

View File

@ -185,8 +185,8 @@
FT_Int n; FT_Int n;
if ( ALLOC_ARRAY ( glyph_indices, num_glyphs, FT_UShort ) || if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) ||
FT_FRAME_ENTER( num_glyphs * 2L ) ) FT_FRAME_ENTER( num_glyphs * 2L ) )
goto Fail; goto Fail;
for ( n = 0; n < num_glyphs; n++ ) for ( n = 0; n < num_glyphs; n++ )
@ -222,7 +222,7 @@
FT_UShort n; FT_UShort n;
if ( ALLOC_ARRAY( name_strings, num_names, FT_Char* ) ) if ( FT_NEW_ARRAY( name_strings, num_names ) )
goto Fail; goto Fail;
for ( n = 0; n < num_names; n++ ) for ( n = 0; n < num_names; n++ )
@ -230,9 +230,9 @@
FT_UInt len; FT_UInt len;
if ( FT_READ_BYTE ( len ) || if ( FT_READ_BYTE ( len ) ||
ALLOC_ARRAY( name_strings[n], len + 1, FT_Char ) || FT_NEW_ARRAY( name_strings[n], len + 1 ) ||
FT_STREAM_READ ( name_strings[n], len ) ) FT_STREAM_READ ( name_strings[n], len ) )
goto Fail1; goto Fail1;
name_strings[n][len] = '\0'; name_strings[n][len] = '\0';
@ -258,12 +258,12 @@
for ( n = 0; n < num_names; n++ ) for ( n = 0; n < num_names; n++ )
FREE( name_strings[n] ); FT_FREE( name_strings[n] );
} }
Fail: Fail:
FREE( name_strings ); FT_FREE( name_strings );
FREE( glyph_indices ); FT_FREE( glyph_indices );
Exit: Exit:
return error; return error;
@ -292,7 +292,7 @@
goto Exit; goto Exit;
} }
if ( ALLOC ( offset_table, num_glyphs ) || if ( FT_ALLOC ( offset_table, num_glyphs ) ||
FT_STREAM_READ( offset_table, num_glyphs ) ) FT_STREAM_READ( offset_table, num_glyphs ) )
goto Fail; goto Fail;
@ -326,7 +326,7 @@
return SFNT_Err_Ok; return SFNT_Err_Ok;
Fail: Fail:
FREE( offset_table ); FT_FREE( offset_table );
Exit: Exit:
return error; return error;
@ -394,13 +394,13 @@
FT_UShort n; FT_UShort n;
FREE( table->glyph_indices ); FT_FREE( table->glyph_indices );
table->num_glyphs = 0; table->num_glyphs = 0;
for ( n = 0; n < table->num_names; n++ ) for ( n = 0; n < table->num_names; n++ )
FREE( table->glyph_names[n] ); FT_FREE( table->glyph_names[n] );
FREE( table->glyph_names ); FT_FREE( table->glyph_names );
table->num_names = 0; table->num_names = 0;
} }
break; break;
@ -410,7 +410,7 @@
TT_Post_25 table = &names->names.format_25; TT_Post_25 table = &names->names.format_25;
FREE( table->offsets ); FT_FREE( table->offsets );
table->num_glyphs = 0; table->num_glyphs = 0;
} }
break; break;

View File

@ -271,7 +271,7 @@
/* Allocate glyph offsets table if needed */ /* Allocate glyph offsets table if needed */
if ( load_offsets ) if ( load_offsets )
{ {
if ( ALLOC_ARRAY( range->glyph_offsets, count, FT_ULong ) ) if ( FT_NEW_ARRAY( range->glyph_offsets, count ) )
goto Exit; goto Exit;
size = count * 4L; size = count * 4L;
@ -280,8 +280,8 @@
size = count * 2L; size = count * 2L;
/* Allocate glyph codes table and access frame */ /* Allocate glyph codes table and access frame */
if ( ALLOC_ARRAY ( range->glyph_codes, count, FT_UShort ) || if ( FT_NEW_ARRAY ( range->glyph_codes, count ) ||
FT_FRAME_ENTER( size ) ) FT_FRAME_ENTER( size ) )
goto Exit; goto Exit;
for ( n = 0; n < count; n++ ) for ( n = 0; n < count; n++ )
@ -340,9 +340,8 @@
size_elem = large ? 4 : 2; size_elem = large ? 4 : 2;
if ( ALLOC_ARRAY( range->glyph_offsets, if ( FT_NEW_ARRAY( range->glyph_offsets, num_glyphs ) ||
num_glyphs, FT_ULong ) || FT_FRAME_ENTER( num_glyphs * size_elem ) )
FT_FRAME_ENTER( num_glyphs * size_elem ) )
goto Exit; goto Exit;
for ( n = 0; n < num_glyphs; n++ ) for ( n = 0; n < num_glyphs; n++ )
@ -479,7 +478,7 @@
} }
/* allocate the strikes table */ /* allocate the strikes table */
if ( ALLOC_ARRAY( face->sbit_strikes, num_strikes, TT_SBit_StrikeRec ) ) if ( FT_NEW_ARRAY( face->sbit_strikes, num_strikes ) )
goto Exit; goto Exit;
face->num_sbit_strikes = num_strikes; face->num_sbit_strikes = num_strikes;
@ -520,9 +519,7 @@
FT_ULong count2 = strike->num_ranges; FT_ULong count2 = strike->num_ranges;
if ( ALLOC_ARRAY( strike->sbit_ranges, if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) )
strike->num_ranges,
TT_SBit_RangeRec ) )
goto Exit; goto Exit;
/* read each range */ /* read each range */
@ -610,14 +607,14 @@
{ {
/* release the glyph offsets and codes tables */ /* release the glyph offsets and codes tables */
/* where appropriate */ /* where appropriate */
FREE( range->glyph_offsets ); FT_FREE( range->glyph_offsets );
FREE( range->glyph_codes ); FT_FREE( range->glyph_codes );
} }
} }
FREE( strike->sbit_ranges ); FT_FREE( strike->sbit_ranges );
strike->num_ranges = 0; strike->num_ranges = 0;
} }
FREE( face->sbit_strikes ); FT_FREE( face->sbit_strikes );
} }
face->num_sbit_strikes = 0; face->num_sbit_strikes = 0;
} }
@ -993,7 +990,7 @@
{ {
line = (FT_Byte*)map->buffer; line = (FT_Byte*)map->buffer;
MEM_Move( line, line + count * line_len, FT_MEM_MOVE( line, line + count * line_len,
( rows - count ) * line_len ); ( rows - count ) * line_len );
metrics->height = (FT_Byte)( metrics->height - count ); metrics->height = (FT_Byte)( metrics->height - count );
@ -1270,7 +1267,7 @@
if ( size == 0 ) if ( size == 0 )
goto Exit; /* exit successfully! */ goto Exit; /* exit successfully! */
if ( ALLOC( map->buffer, size ) ) if ( FT_ALLOC( map->buffer, size ) )
goto Exit; goto Exit;
} }
@ -1303,8 +1300,8 @@
FT_UShort num_components, count; FT_UShort num_components, count;
if ( FT_READ_USHORT( num_components ) || if ( FT_READ_USHORT( num_components ) ||
ALLOC_ARRAY( components, num_components, TT_SBit_ComponentRec ) ) FT_NEW_ARRAY( components, num_components ) )
goto Exit; goto Exit;
count = num_components; count = num_components;
@ -1354,7 +1351,7 @@
} }
Fail_Memory: Fail_Memory:
FREE( components ); FT_FREE( components );
} }
Exit: Exit:
@ -1430,7 +1427,7 @@
/* clear the bitmap & load the bitmap */ /* clear the bitmap & load the bitmap */
if ( face->root.glyph->flags & FT_GLYPH_OWN_BITMAP ) if ( face->root.glyph->flags & FT_GLYPH_OWN_BITMAP )
FREE( map->buffer ); FT_FREE( map->buffer );
map->rows = map->pitch = map->width = 0; map->rows = map->pitch = map->width = 0;

View File

@ -145,8 +145,8 @@
#endif /* _STANDALONE_ */ #endif /* _STANDALONE_ */
#ifndef MEM_Set #ifndef FT_MEM_SET
#define MEM_Set( d, s, c ) memset( d, s, c ) #define FT_MEM_SET( d, s, c ) memset( d, s, c )
#endif #endif
/* define this to dump debugging information */ /* define this to dump debugging information */
@ -1288,7 +1288,7 @@
if ( coverage ) if ( coverage )
#if 1 #if 1
MEM_Set( p + spans->x, (unsigned char)coverage, spans->len ); FT_MEM_SET( p + spans->x, (unsigned char)coverage, spans->len );
#else /* 1 */ #else /* 1 */
{ {
q = p + spans->x; q = p + spans->x;
@ -2057,7 +2057,7 @@
*araster = (FT_Raster)&the_raster; *araster = (FT_Raster)&the_raster;
MEM_Set( &the_raster, 0, sizeof ( the_raster ) ); FT_MEM_SET( &the_raster, 0, sizeof ( the_raster ) );
#ifdef GRAYS_USE_GAMMA #ifdef GRAYS_USE_GAMMA
grays_init_gamma( (PRaster)*araster ); grays_init_gamma( (PRaster)*araster );
@ -2085,7 +2085,7 @@
*araster = 0; *araster = 0;
if ( !ALLOC( raster, sizeof ( TRaster ) ) ) if ( !FT_ALLOC( raster, sizeof ( TRaster ) ) )
{ {
raster->memory = memory; raster->memory = memory;
*araster = (FT_Raster)raster; *araster = (FT_Raster)raster;
@ -2105,7 +2105,7 @@
FT_Memory memory = (FT_Memory)((PRaster)raster)->memory; FT_Memory memory = (FT_Memory)((PRaster)raster)->memory;
FREE( raster ); FT_FREE( raster );
} }
#endif /* _STANDALONE_ */ #endif /* _STANDALONE_ */

View File

@ -85,7 +85,7 @@
FT_GlyphSlot slot, FT_GlyphSlot slot,
FT_BBox* cbox ) FT_BBox* cbox )
{ {
MEM_Set( cbox, 0, sizeof ( *cbox ) ); FT_MEM_SET( cbox, 0, sizeof ( *cbox ) );
if ( slot->format == render->glyph_format ) if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox ); FT_Outline_Get_CBox( &slot->outline, cbox );
@ -142,7 +142,7 @@
/* release old bitmap buffer */ /* release old bitmap buffer */
if ( slot->flags & FT_GLYPH_OWN_BITMAP ) if ( slot->flags & FT_GLYPH_OWN_BITMAP )
{ {
FREE( bitmap->buffer ); FT_FREE( bitmap->buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP; slot->flags &= ~FT_GLYPH_OWN_BITMAP;
} }
@ -154,7 +154,7 @@
bitmap->rows = height; bitmap->rows = height;
bitmap->pitch = pitch; bitmap->pitch = pitch;
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit; goto Exit;
slot->flags |= FT_GLYPH_OWN_BITMAP; slot->flags |= FT_GLYPH_OWN_BITMAP;

View File

@ -145,10 +145,10 @@
#define cur_to_org( n, zone ) \ #define cur_to_org( n, zone ) \
MEM_Copy( (zone)->org, (zone)->cur, (n) * sizeof ( FT_Vector ) ) FT_MEM_COPY( (zone)->org, (zone)->cur, (n) * sizeof ( FT_Vector ) )
#define org_to_cur( n, zone ) \ #define org_to_cur( n, zone ) \
MEM_Copy( (zone)->cur, (zone)->org, (n) * sizeof ( FT_Vector ) ) FT_MEM_COPY( (zone)->cur, (zone)->org, (n) * sizeof ( FT_Vector ) )
/*************************************************************************/ /*************************************************************************/
@ -339,7 +339,7 @@
slot->control_len = n_ins; slot->control_len = n_ins;
slot->control_data = load->instructions; slot->control_data = load->instructions;
MEM_Copy( load->instructions, stream->cursor, n_ins ); FT_MEM_COPY( load->instructions, stream->cursor, n_ins );
} }
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
@ -1515,7 +1515,7 @@
goto Exit; goto Exit;
} }
MEM_Set( &loader, 0, sizeof ( loader ) ); FT_MEM_SET( &loader, 0, sizeof ( loader ) );
/* update the glyph zone bounds */ /* update the glyph zone bounds */
{ {

View File

@ -385,7 +385,7 @@
FT_Memory memory ) FT_Memory memory )
{ {
/* free composite load stack */ /* free composite load stack */
FREE( exec->loadStack ); FT_FREE( exec->loadStack );
exec->loadSize = 0; exec->loadSize = 0;
/* points zone */ /* points zone */
@ -393,22 +393,22 @@
exec->maxContours = 0; exec->maxContours = 0;
/* free stack */ /* free stack */
FREE( exec->stack ); FT_FREE( exec->stack );
exec->stackSize = 0; exec->stackSize = 0;
/* free call stack */ /* free call stack */
FREE( exec->callStack ); FT_FREE( exec->callStack );
exec->callSize = 0; exec->callSize = 0;
exec->callTop = 0; exec->callTop = 0;
/* free glyph code range */ /* free glyph code range */
FREE( exec->glyphIns ); FT_FREE( exec->glyphIns );
exec->glyphSize = 0; exec->glyphSize = 0;
exec->size = NULL; exec->size = NULL;
exec->face = NULL; exec->face = NULL;
FREE( exec ); FT_FREE( exec );
return TT_Err_Ok; return TT_Err_Ok;
} }
@ -446,7 +446,7 @@
exec->memory = memory; exec->memory = memory;
exec->callSize = 32; exec->callSize = 32;
if ( ALLOC_ARRAY( exec->callStack, exec->callSize, TT_CallRec ) ) if ( FT_NEW_ARRAY( exec->callStack, exec->callSize ) )
goto Fail_Memory; goto Fail_Memory;
/* all values in the context are set to 0 already, but this is */ /* all values in the context are set to 0 already, but this is */
@ -512,8 +512,8 @@
if ( *size < new_max ) if ( *size < new_max )
{ {
FREE( *buff ); FT_FREE( *buff );
if ( ALLOC( *buff, new_max * multiplier ) ) if ( FT_ALLOC( *buff, new_max * multiplier ) )
return error; return error;
*size = new_max; *size = new_max;
} }
@ -776,7 +776,7 @@
/* allocate object */ /* allocate object */
if ( ALLOC( exec, sizeof ( *exec ) ) ) if ( FT_NEW( exec ) )
goto Exit; goto Exit;
/* initialize it */ /* initialize it */
@ -792,7 +792,7 @@
return driver->context; return driver->context;
Fail: Fail:
FREE( exec ); FT_FREE( exec );
return 0; return 0;
} }
@ -3846,7 +3846,7 @@
K = CUR.stack[CUR.args - L]; K = CUR.stack[CUR.args - L];
MEM_Move( &CUR.stack[CUR.args - L ], FT_MEM_MOVE( &CUR.stack[CUR.args - L ],
&CUR.stack[CUR.args - L + 1], &CUR.stack[CUR.args - L + 1],
( L - 1 ) * sizeof ( FT_Long ) ); ( L - 1 ) * sizeof ( FT_Long ) );

View File

@ -71,10 +71,10 @@
FT_Memory memory = zone->memory; FT_Memory memory = zone->memory;
FREE( zone->contours ); FT_FREE( zone->contours );
FREE( zone->tags ); FT_FREE( zone->tags );
FREE( zone->cur ); FT_FREE( zone->cur );
FREE( zone->org ); FT_FREE( zone->org );
zone->max_points = zone->n_points = 0; zone->max_points = zone->n_points = 0;
zone->max_contours = zone->n_contours = 0; zone->max_contours = zone->n_contours = 0;
@ -114,13 +114,13 @@
if ( maxPoints > 0 ) if ( maxPoints > 0 )
maxPoints += 2; maxPoints += 2;
MEM_Set( zone, 0, sizeof ( *zone ) ); FT_MEM_SET( zone, 0, sizeof ( *zone ) );
zone->memory = memory; zone->memory = memory;
if ( ALLOC_ARRAY( zone->org, maxPoints * 2, FT_F26Dot6 ) || if ( FT_NEW_ARRAY( zone->org, maxPoints * 2 ) ||
ALLOC_ARRAY( zone->cur, maxPoints * 2, FT_F26Dot6 ) || FT_NEW_ARRAY( zone->cur, maxPoints * 2 ) ||
ALLOC_ARRAY( zone->tags, maxPoints, FT_Byte ) || FT_NEW_ARRAY( zone->tags, maxPoints ) ||
ALLOC_ARRAY( zone->contours, maxContours, FT_UShort ) ) FT_NEW_ARRAY( zone->contours, maxContours ) )
{ {
TT_Done_GlyphZone( zone ); TT_Done_GlyphZone( zone );
} }
@ -241,11 +241,11 @@
sfnt->done_face( face ); sfnt->done_face( face );
/* freeing the locations table */ /* freeing the locations table */
FREE( face->glyph_locations ); FT_FREE( face->glyph_locations );
face->num_locations = 0; face->num_locations = 0;
/* freeing the CVT */ /* freeing the CVT */
FREE( face->cvt ); FT_FREE( face->cvt );
face->cvt_size = 0; face->cvt_size = 0;
/* freeing the programs */ /* freeing the programs */
@ -326,19 +326,10 @@
} }
/* allocate function defs, instruction defs, cvt, and storage area */ /* allocate function defs, instruction defs, cvt, and storage area */
if ( ALLOC_ARRAY( size->function_defs, if ( FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) ||
size->max_function_defs, FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
TT_DefRecord ) || FT_NEW_ARRAY( size->cvt, size->cvt_size ) ||
FT_NEW_ARRAY( size->storage, size->storage_size ) )
ALLOC_ARRAY( size->instruction_defs,
size->max_instruction_defs,
TT_DefRecord ) ||
ALLOC_ARRAY( size->cvt,
size->cvt_size, FT_Long ) ||
ALLOC_ARRAY( size->storage,
size->storage_size, FT_Long ) )
goto Fail_Memory; goto Fail_Memory;
@ -480,18 +471,18 @@
size->debug = FALSE; size->debug = FALSE;
} }
FREE( size->cvt ); FT_FREE( size->cvt );
size->cvt_size = 0; size->cvt_size = 0;
/* free storage area */ /* free storage area */
FREE( size->storage ); FT_FREE( size->storage );
size->storage_size = 0; size->storage_size = 0;
/* twilight zone */ /* twilight zone */
TT_Done_GlyphZone( &size->twilight ); TT_Done_GlyphZone( &size->twilight );
FREE( size->function_defs ); FT_FREE( size->function_defs );
FREE( size->instruction_defs ); FT_FREE( size->instruction_defs );
size->num_function_defs = 0; size->num_function_defs = 0;
size->max_function_defs = 0; size->max_function_defs = 0;

View File

@ -80,9 +80,7 @@
FT_TRACE2(( "(32bit offsets): %12d ", face->num_locations )); FT_TRACE2(( "(32bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations, if ( FT_NEW_ARRAY( face->glyph_locations, face->num_locations ) )
face->num_locations,
FT_Long ) )
goto Exit; goto Exit;
if ( FT_FRAME_ENTER( face->num_locations * 4L ) ) if ( FT_FRAME_ENTER( face->num_locations * 4L ) )
@ -105,9 +103,7 @@
FT_TRACE2(( "(16bit offsets): %12d ", face->num_locations )); FT_TRACE2(( "(16bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations, if ( FT_NEW_ARRAY( face->glyph_locations, face->num_locations ) )
face->num_locations,
FT_Long ) )
goto Exit; goto Exit;
if ( FT_FRAME_ENTER( face->num_locations * 2L ) ) if ( FT_FRAME_ENTER( face->num_locations * 2L ) )
@ -172,9 +168,7 @@
face->cvt_size = table_len / 2; face->cvt_size = table_len / 2;
if ( ALLOC_ARRAY( face->cvt, if ( FT_NEW_ARRAY( face->cvt, face->cvt_size ) )
face->cvt_size,
FT_Short ) )
goto Exit; goto Exit;
if ( FT_FRAME_ENTER( face->cvt_size * 2L ) ) if ( FT_FRAME_ENTER( face->cvt_size * 2L ) )

View File

@ -39,9 +39,9 @@
T1_Done_AFM( FT_Memory memory, T1_Done_AFM( FT_Memory memory,
T1_AFM* afm ) T1_AFM* afm )
{ {
FREE( afm->kern_pairs ); FT_FREE( afm->kern_pairs );
afm->num_pairs = 0; afm->num_pairs = 0;
FREE( afm ); FT_FREE( afm );
} }
@ -83,7 +83,7 @@
/* copy glyph name to intermediate array */ /* copy glyph name to intermediate array */
MEM_Copy( temp, *start, len ); FT_MEM_COPY( temp, *start, len );
temp[len] = 0; temp[len] = 0;
/* lookup glyph name in face array */ /* lookup glyph name in face array */
@ -192,8 +192,7 @@
goto Exit; goto Exit;
/* allocate the pairs */ /* allocate the pairs */
if ( ALLOC( afm, sizeof ( *afm ) ) || if ( FT_NEW( afm ) || FT_NEW_ARRAY( afm->kern_pairs, count ) )
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
goto Exit; goto Exit;
/* now, read each kern pair */ /* now, read each kern pair */
@ -235,7 +234,7 @@
Exit: Exit:
if ( error ) if ( error )
FREE( afm ); FT_FREE( afm );
FT_FRAME_EXIT(); FT_FRAME_EXIT();

View File

@ -63,7 +63,7 @@
if (len >= buffer_max) if (len >= buffer_max)
len = buffer_max - 1; len = buffer_max - 1;
MEM_Copy( buffer, gname, len ); FT_MEM_COPY( buffer, gname, len );
((FT_Byte*)buffer)[len] = 0; ((FT_Byte*)buffer)[len] = 0;
} }

View File

@ -109,7 +109,7 @@
blend = face->blend; blend = face->blend;
if ( !blend ) if ( !blend )
{ {
if ( ALLOC( blend, sizeof ( *blend ) ) ) if ( FT_NEW( blend ) )
goto Exit; goto Exit;
face->blend = blend; face->blend = blend;
@ -124,9 +124,9 @@
/* allocate the blend `private' and `font_info' dictionaries */ /* allocate the blend `private' and `font_info' dictionaries */
if ( ALLOC_ARRAY( blend->font_infos[1], num_designs, PS_FontInfoRec ) || if ( FT_NEW_ARRAY( blend->font_infos[1], num_designs ) ||
ALLOC_ARRAY( blend->privates[1], num_designs, PS_PrivateRec ) || FT_NEW_ARRAY( blend->privates[1], num_designs ) ||
ALLOC_ARRAY( blend->weight_vector, num_designs * 2, FT_Fixed ) ) FT_NEW_ARRAY( blend->weight_vector, num_designs * 2 ) )
goto Exit; goto Exit;
blend->default_weight_vector = blend->weight_vector + num_designs; blend->default_weight_vector = blend->weight_vector + num_designs;
@ -163,8 +163,7 @@
FT_UInt n; FT_UInt n;
if ( ALLOC_ARRAY( blend->design_pos[0], if ( FT_NEW_ARRAY( blend->design_pos[0], num_designs * num_axis ) )
num_designs * num_axis, FT_Fixed ) )
goto Exit; goto Exit;
for ( n = 1; n < num_designs; n++ ) for ( n = 1; n < num_designs; n++ )
@ -343,13 +342,13 @@
/* release design pos table */ /* release design pos table */
FREE( blend->design_pos[0] ); FT_FREE( blend->design_pos[0] );
for ( n = 1; n < num_designs; n++ ) for ( n = 1; n < num_designs; n++ )
blend->design_pos[n] = 0; blend->design_pos[n] = 0;
/* release blend `private' and `font info' dictionaries */ /* release blend `private' and `font info' dictionaries */
FREE( blend->privates[1] ); FT_FREE( blend->privates[1] );
FREE( blend->font_infos[1] ); FT_FREE( blend->font_infos[1] );
for ( n = 0; n < num_designs; n++ ) for ( n = 0; n < num_designs; n++ )
{ {
@ -358,12 +357,12 @@
} }
/* release weight vectors */ /* release weight vectors */
FREE( blend->weight_vector ); FT_FREE( blend->weight_vector );
blend->default_weight_vector = 0; blend->default_weight_vector = 0;
/* release axis names */ /* release axis names */
for ( n = 0; n < num_axis; n++ ) for ( n = 0; n < num_axis; n++ )
FREE( blend->axis_names[n] ); FT_FREE( blend->axis_names[n] );
/* release design map */ /* release design map */
for ( n = 0; n < num_axis; n++ ) for ( n = 0; n < num_axis; n++ )
@ -371,11 +370,11 @@
PS_DesignMap dmap = blend->design_map + n; PS_DesignMap dmap = blend->design_map + n;
FREE( dmap->design_points ); FT_FREE( dmap->design_points );
dmap->num_points = 0; dmap->num_points = 0;
} }
FREE( face->blend ); FT_FREE( face->blend );
} }
} }
@ -428,11 +427,11 @@
goto Exit; goto Exit;
} }
if ( ALLOC( blend->axis_names[n], len + 1 ) ) if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
goto Exit; goto Exit;
name = (FT_Byte*)blend->axis_names[n]; name = (FT_Byte*)blend->axis_names[n];
MEM_Copy( name, token->start, len ); FT_MEM_COPY( name, token->start, len );
name[len] = 0; name[len] = 0;
} }
@ -584,7 +583,7 @@
} }
/* allocate design map data */ /* allocate design map data */
if ( ALLOC_ARRAY( map->design_points, num_points * 2, FT_Fixed ) ) if ( FT_NEW_ARRAY( map->design_points, num_points * 2 ) )
goto Exit; goto Exit;
map->blend_points = map->design_points + num_points; map->blend_points = map->design_points + num_points;
map->num_points = (FT_Byte)num_points; map->num_points = (FT_Byte)num_points;
@ -848,13 +847,13 @@
len = (FT_Int)( cur2 - cur ); len = (FT_Int)( cur2 - cur );
if ( len > 0 ) if ( len > 0 )
{ {
if ( ALLOC( face->type1.font_name, len + 1 ) ) if ( FT_ALLOC( face->type1.font_name, len + 1 ) )
{ {
parser->root.error = error; parser->root.error = error;
return; return;
} }
MEM_Copy( face->type1.font_name, cur, len ); FT_MEM_COPY( face->type1.font_name, cur, len );
face->type1.font_name[len] = '\0'; face->type1.font_name[len] = '\0';
} }
parser->root.cursor = cur2; parser->root.cursor = cur2;
@ -972,10 +971,10 @@
/* we use a T1_Table to store our charnames */ /* we use a T1_Table to store our charnames */
loader->num_chars = encode->num_chars = count; loader->num_chars = encode->num_chars = count;
if ( ALLOC_ARRAY( encode->char_index, count, FT_Short ) || if ( FT_NEW_ARRAY( encode->char_index, count ) ||
ALLOC_ARRAY( encode->char_name, count, FT_String* ) || FT_NEW_ARRAY( encode->char_name, count ) ||
( error = psaux->ps_table_funcs->init( FT_SET_ERROR( psaux->ps_table_funcs->init(
char_table, count, memory ) ) != 0 ) char_table, count, memory ) ) )
{ {
parser->root.error = error; parser->root.error = error;
return; return;
@ -1172,14 +1171,14 @@
/* t1_decrypt() shouldn't write to base -- make temporary copy */ /* t1_decrypt() shouldn't write to base -- make temporary copy */
if ( ALLOC( temp, size ) ) if ( FT_ALLOC( temp, size ) )
goto Fail; goto Fail;
MEM_Copy( temp, base, size ); FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 ); psaux->t1_decrypt( temp, size, 4330 );
size -= face->type1.private_dict.lenIV; size -= face->type1.private_dict.lenIV;
error = T1_Add_Table( table, idx, error = T1_Add_Table( table, idx,
temp + face->type1.private_dict.lenIV, size ); temp + face->type1.private_dict.lenIV, size );
FREE( temp ); FT_FREE( temp );
} }
else else
error = T1_Add_Table( table, idx, base, size ); error = T1_Add_Table( table, idx, base, size );
@ -1313,14 +1312,14 @@
/* t1_decrypt() shouldn't write to base -- make temporary copy */ /* t1_decrypt() shouldn't write to base -- make temporary copy */
if ( ALLOC( temp, size ) ) if ( FT_ALLOC( temp, size ) )
goto Fail; goto Fail;
MEM_Copy( temp, base, size ); FT_MEM_COPY( temp, base, size );
psaux->t1_decrypt( temp, size, 4330 ); psaux->t1_decrypt( temp, size, 4330 );
size -= face->type1.private_dict.lenIV; size -= face->type1.private_dict.lenIV;
error = T1_Add_Table( code_table, n, error = T1_Add_Table( code_table, n,
temp + face->type1.private_dict.lenIV, size ); temp + face->type1.private_dict.lenIV, size );
FREE( temp ); FT_FREE( temp );
} }
else else
error = T1_Add_Table( code_table, n, base, size ); error = T1_Add_Table( code_table, n, base, size );
@ -1605,7 +1604,7 @@
{ {
FT_UNUSED( face ); FT_UNUSED( face );
MEM_Set( loader, 0, sizeof ( *loader ) ); FT_MEM_SET( loader, 0, sizeof ( *loader ) );
loader->num_glyphs = 0; loader->num_glyphs = 0;
loader->num_chars = 0; loader->num_chars = 0;

View File

@ -208,28 +208,28 @@
PS_FontInfo info = &type1->font_info; PS_FontInfo info = &type1->font_info;
FREE( info->version ); FT_FREE( info->version );
FREE( info->notice ); FT_FREE( info->notice );
FREE( info->full_name ); FT_FREE( info->full_name );
FREE( info->family_name ); FT_FREE( info->family_name );
FREE( info->weight ); FT_FREE( info->weight );
} }
/* release top dictionary */ /* release top dictionary */
FREE( type1->charstrings_len ); FT_FREE( type1->charstrings_len );
FREE( type1->charstrings ); FT_FREE( type1->charstrings );
FREE( type1->glyph_names ); FT_FREE( type1->glyph_names );
FREE( type1->subrs ); FT_FREE( type1->subrs );
FREE( type1->subrs_len ); FT_FREE( type1->subrs_len );
FREE( type1->subrs_block ); FT_FREE( type1->subrs_block );
FREE( type1->charstrings_block ); FT_FREE( type1->charstrings_block );
FREE( type1->glyph_names_block ); FT_FREE( type1->glyph_names_block );
FREE( type1->encoding.char_index ); FT_FREE( type1->encoding.char_index );
FREE( type1->encoding.char_name ); FT_FREE( type1->encoding.char_name );
FREE( type1->font_name ); FT_FREE( type1->font_name );
#ifndef T1_CONFIG_OPTION_NO_AFM #ifndef T1_CONFIG_OPTION_NO_AFM
/* release afm data if present */ /* release afm data if present */
@ -238,7 +238,7 @@
#endif #endif
/* release unicode map, if any */ /* release unicode map, if any */
FREE( face->unicode_map.maps ); FT_FREE( face->unicode_map.maps );
face->unicode_map.num_maps = 0; face->unicode_map.num_maps = 0;
face->root.family_name = 0; face->root.family_name = 0;

View File

@ -193,7 +193,7 @@
else else
{ {
/* read segment in memory */ /* read segment in memory */
if ( ALLOC( parser->base_dict, size ) || if ( FT_ALLOC( parser->base_dict, size ) ||
FT_STREAM_READ( parser->base_dict, size ) ) FT_STREAM_READ( parser->base_dict, size ) )
goto Exit; goto Exit;
parser->base_len = size; parser->base_len = size;
@ -221,7 +221,7 @@
Exit: Exit:
if ( error && !parser->in_memory ) if ( error && !parser->in_memory )
FREE( parser->base_dict ); FT_FREE( parser->base_dict );
return error; return error;
} }
@ -234,11 +234,11 @@
/* always free the private dictionary */ /* always free the private dictionary */
FREE( parser->private_dict ); FT_FREE( parser->private_dict );
/* free the base dictionary only when we have a disk stream */ /* free the base dictionary only when we have a disk stream */
if ( !parser->in_memory ) if ( !parser->in_memory )
FREE( parser->base_dict ); FT_FREE( parser->base_dict );
parser->root.funcs.done( &parser->root ); parser->root.funcs.done( &parser->root );
} }
@ -314,7 +314,7 @@
} }
if ( FT_STREAM_SEEK( start_pos ) || if ( FT_STREAM_SEEK( start_pos ) ||
ALLOC( parser->private_dict, parser->private_len ) ) FT_ALLOC( parser->private_dict, parser->private_len ) )
goto Fail; goto Fail;
parser->private_len = 0; parser->private_len = 0;
@ -384,7 +384,7 @@
if ( parser->in_memory ) if ( parser->in_memory )
{ {
/* note that we allocate one more byte to put a terminating `0' */ /* note that we allocate one more byte to put a terminating `0' */
if ( ALLOC( parser->private_dict, size + 1 ) ) if ( FT_ALLOC( parser->private_dict, size + 1 ) )
goto Fail; goto Fail;
parser->private_len = size; parser->private_len = size;
} }
@ -408,7 +408,7 @@
hexa_value( cur[2] ) | hexa_value( cur[3] ) ) < 0 ) hexa_value( cur[2] ) | hexa_value( cur[3] ) ) < 0 )
/* binary encoding -- `simply' copy the private dict */ /* binary encoding -- `simply' copy the private dict */
MEM_Copy( parser->private_dict, cur, size ); FT_MEM_COPY( parser->private_dict, cur, size );
else else
{ {

View File

@ -178,7 +178,7 @@
for ( ; cur < limit; cur++ ) for ( ; cur < limit; cur++ )
fnt_font_done( cur, stream ); fnt_font_done( cur, stream );
FREE( face->fonts ); FT_FREE( face->fonts );
face->num_fonts = 0; face->num_fonts = 0;
} }
@ -260,8 +260,8 @@
goto Exit; goto Exit;
} }
if ( FT_STREAM_SEEK( font_offset ) || if ( FT_STREAM_SEEK( font_offset ) ||
ALLOC_ARRAY( face->fonts, font_count, FNT_FontRec ) ) FT_NEW_ARRAY( face->fonts, font_count ) )
goto Exit; goto Exit;
face->num_fonts = font_count; face->num_fonts = font_count;
@ -447,7 +447,7 @@
fnt_face_done_fonts( face ); fnt_face_done_fonts( face );
FREE( face->root.available_sizes ); FT_FREE( face->root.available_sizes );
face->root.num_fixed_sizes = 0; face->root.num_fixed_sizes = 0;
} }
@ -474,7 +474,7 @@
/* this didn't work, now try to load a single FNT font */ /* this didn't work, now try to load a single FNT font */
FNT_Font font; FNT_Font font;
if ( ALLOC( face->fonts, sizeof ( *face->fonts ) ) ) if ( FT_NEW( face->fonts ) )
goto Exit; goto Exit;
face->num_fonts = 1; face->num_fonts = 1;
@ -511,8 +511,7 @@
root->style_flags |= FT_STYLE_FLAG_BOLD; root->style_flags |= FT_STYLE_FLAG_BOLD;
/* Setup the `fixed_sizes' array */ /* Setup the `fixed_sizes' array */
if ( ALLOC_ARRAY( root->available_sizes, face->num_fonts, if ( FT_NEW_ARRAY( root->available_sizes, face->num_fonts ) )
FT_Bitmap_Size ) )
goto Fail; goto Fail;
root->num_fixed_sizes = face->num_fonts; root->num_fixed_sizes = face->num_fonts;
@ -677,7 +676,7 @@
bitmap->rows = font->header.pixel_height; bitmap->rows = font->header.pixel_height;
bitmap->pixel_mode = ft_pixel_mode_mono; bitmap->pixel_mode = ft_pixel_mode_mono;
if ( ALLOC( bitmap->buffer, pitch * bitmap->rows ) ) if ( FT_ALLOC( bitmap->buffer, pitch * bitmap->rows ) )
goto Exit; goto Exit;
column = (FT_Byte*)bitmap->buffer; column = (FT_Byte*)bitmap->buffer;