Bug 485621 – Get rid of freetype memory allocator in harfbuzz
2007-10-11 Behdad Esfahbod <behdad@gnome.org> Bug 485621 – Get rid of freetype memory allocator in harfbuzz * pango/opentype/*: Remove all occurences of FT_Memory. Use malloc/realloc/free directly. * pango/pango-ot*: Update to above.
This commit is contained in:
parent
a8abb8b994
commit
fc3d6f5758
52
src/ftglue.c
52
src/ftglue.c
|
@ -30,16 +30,15 @@ _hb_ftglue_log( const char* format, ... )
|
|||
|
||||
/* only used internally */
|
||||
static FT_Pointer
|
||||
_hb_ftglue_qalloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
HB_Error *perror )
|
||||
_hb_ftglue_qalloc( FT_ULong size,
|
||||
HB_Error *perror )
|
||||
{
|
||||
HB_Error error = 0;
|
||||
FT_Pointer block = NULL;
|
||||
|
||||
if ( size > 0 )
|
||||
{
|
||||
block = memory->alloc( memory, size );
|
||||
block = malloc( size );
|
||||
if ( !block )
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
}
|
||||
|
@ -49,20 +48,19 @@ _hb_ftglue_qalloc( FT_Memory memory,
|
|||
}
|
||||
|
||||
#undef QALLOC /* just in case */
|
||||
#define QALLOC(ptr,size) ( (ptr) = _hb_ftglue_qalloc( memory, (size), &error ), error != 0 )
|
||||
#define QALLOC(ptr,size) ( (ptr) = _hb_ftglue_qalloc( (size), &error ), error != 0 )
|
||||
|
||||
|
||||
FTGLUE_APIDEF( FT_Pointer )
|
||||
_hb_ftglue_alloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
HB_Error *perror )
|
||||
_hb_ftglue_alloc( FT_ULong size,
|
||||
HB_Error *perror )
|
||||
{
|
||||
HB_Error error = 0;
|
||||
FT_Pointer block = NULL;
|
||||
|
||||
if ( size > 0 )
|
||||
{
|
||||
block = memory->alloc( memory, size );
|
||||
block = malloc( size );
|
||||
if ( !block )
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
else
|
||||
|
@ -75,31 +73,16 @@ _hb_ftglue_alloc( FT_Memory memory,
|
|||
|
||||
|
||||
FTGLUE_APIDEF( FT_Pointer )
|
||||
_hb_ftglue_realloc( FT_Memory memory,
|
||||
FT_Pointer block,
|
||||
FT_ULong old_size,
|
||||
FT_ULong new_size,
|
||||
HB_Error *perror )
|
||||
_hb_ftglue_realloc( FT_Pointer block,
|
||||
FT_ULong new_size,
|
||||
HB_Error *perror )
|
||||
{
|
||||
FT_Pointer block2 = NULL;
|
||||
HB_Error error = 0;
|
||||
|
||||
if ( old_size == 0 || block == NULL )
|
||||
{
|
||||
block2 = _hb_ftglue_alloc( memory, new_size, &error );
|
||||
}
|
||||
else if ( new_size == 0 )
|
||||
{
|
||||
_hb_ftglue_free( memory, block );
|
||||
}
|
||||
else
|
||||
{
|
||||
block2 = memory->realloc( memory, old_size, new_size, block );
|
||||
if ( block2 == NULL )
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
else if ( new_size > old_size )
|
||||
memset( (char*)block2 + old_size, 0, (size_t)(new_size - old_size) );
|
||||
}
|
||||
block2 = realloc( block, new_size );
|
||||
if ( block2 == NULL && new_size != 0 )
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
|
||||
if ( !error )
|
||||
block = block2;
|
||||
|
@ -110,11 +93,10 @@ _hb_ftglue_realloc( FT_Memory memory,
|
|||
|
||||
|
||||
FTGLUE_APIDEF( void )
|
||||
_hb_ftglue_free( FT_Memory memory,
|
||||
FT_Pointer block )
|
||||
_hb_ftglue_free( FT_Pointer block )
|
||||
{
|
||||
if ( block )
|
||||
memory->free( memory, block );
|
||||
free( block );
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,8 +138,6 @@ _hb_ftglue_stream_frame_enter( FT_Stream stream,
|
|||
if ( stream->read )
|
||||
{
|
||||
/* allocate the frame in memory */
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
|
||||
if ( QALLOC( stream->base, count ) )
|
||||
goto Exit;
|
||||
|
@ -201,8 +181,6 @@ _hb_ftglue_stream_frame_exit( FT_Stream stream )
|
|||
{
|
||||
if ( stream->read )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FREE( stream->base );
|
||||
}
|
||||
stream->cursor = NULL;
|
||||
|
|
28
src/ftglue.h
28
src/ftglue.h
|
@ -112,16 +112,16 @@ _hb_ftglue_face_goto_table( FT_Face face,
|
|||
|
||||
/* memory macros used by the OpenType parser */
|
||||
#define ALLOC(_ptr,_size) \
|
||||
( (_ptr) = _hb_ftglue_alloc( memory, _size, &error ), error != 0 )
|
||||
( (_ptr) = _hb_ftglue_alloc( _size, &error ), error != 0 )
|
||||
|
||||
#define REALLOC(_ptr,_oldsz,_newsz) \
|
||||
( (_ptr) = _hb_ftglue_realloc( memory, (_ptr), (_oldsz), (_newsz), &error ), error != 0 )
|
||||
#define REALLOC(_ptr,_newsz) \
|
||||
( (_ptr) = _hb_ftglue_realloc( (_ptr), (_newsz), &error ), error != 0 )
|
||||
|
||||
#define FREE(_ptr) \
|
||||
do { \
|
||||
if ( (_ptr) ) \
|
||||
{ \
|
||||
_hb_ftglue_free( memory, _ptr ); \
|
||||
_hb_ftglue_free( _ptr ); \
|
||||
_ptr = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -129,27 +129,23 @@ _hb_ftglue_face_goto_table( FT_Face face,
|
|||
#define ALLOC_ARRAY(_ptr,_count,_type) \
|
||||
ALLOC(_ptr,(_count)*sizeof(_type))
|
||||
|
||||
#define REALLOC_ARRAY(_ptr,_oldcnt,_newcnt,_type) \
|
||||
REALLOC(_ptr,(_oldcnt)*sizeof(_type),(_newcnt)*sizeof(_type))
|
||||
#define REALLOC_ARRAY(_ptr,_newcnt,_type) \
|
||||
REALLOC(_ptr,(_newcnt)*sizeof(_type))
|
||||
|
||||
#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
|
||||
|
||||
|
||||
FTGLUE_API( FT_Pointer )
|
||||
_hb_ftglue_alloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
HB_Error *perror_ );
|
||||
_hb_ftglue_alloc( FT_ULong size,
|
||||
HB_Error *perror_ );
|
||||
|
||||
FTGLUE_API( FT_Pointer )
|
||||
_hb_ftglue_realloc( FT_Memory memory,
|
||||
FT_Pointer block,
|
||||
FT_ULong old_size,
|
||||
FT_ULong new_size,
|
||||
HB_Error *perror_ );
|
||||
_hb_ftglue_realloc( FT_Pointer block,
|
||||
FT_ULong new_size,
|
||||
HB_Error *perror_ );
|
||||
|
||||
FTGLUE_API( void )
|
||||
_hb_ftglue_free( FT_Memory memory,
|
||||
FT_Pointer block );
|
||||
_hb_ftglue_free( FT_Pointer block );
|
||||
|
||||
/* abuse these private header/source files */
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ static HB_Error
|
|||
hb_buffer_ensure( HB_Buffer buffer,
|
||||
FT_ULong size )
|
||||
{
|
||||
FT_Memory memory = buffer->memory;
|
||||
FT_ULong new_allocated = buffer->allocated;
|
||||
|
||||
if (size > new_allocated)
|
||||
|
@ -52,9 +51,9 @@ hb_buffer_ensure( HB_Buffer buffer,
|
|||
while (size > new_allocated)
|
||||
new_allocated += (new_allocated >> 1) + 8;
|
||||
|
||||
if ( REALLOC_ARRAY( buffer->positions, buffer->allocated, new_allocated, HB_PositionRec ) )
|
||||
if ( REALLOC_ARRAY( buffer->positions, new_allocated, HB_PositionRec ) )
|
||||
return error;
|
||||
if ( REALLOC_ARRAY( buffer->in_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
if ( REALLOC_ARRAY( buffer->in_string, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
if ( buffer->inplace )
|
||||
{
|
||||
|
@ -62,13 +61,13 @@ hb_buffer_ensure( HB_Buffer buffer,
|
|||
|
||||
if ( buffer->alt_string )
|
||||
{
|
||||
if ( REALLOC_ARRAY( buffer->alt_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( REALLOC_ARRAY( buffer->alt_string, buffer->allocated, new_allocated, HB_GlyphItemRec ) )
|
||||
if ( REALLOC_ARRAY( buffer->alt_string, new_allocated, HB_GlyphItemRec ) )
|
||||
return error;
|
||||
|
||||
buffer->out_string = buffer->alt_string;
|
||||
|
@ -85,7 +84,6 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
|
|||
{
|
||||
if ( !buffer->alt_string )
|
||||
{
|
||||
FT_Memory memory = buffer->memory;
|
||||
HB_Error error;
|
||||
|
||||
if ( ALLOC_ARRAY( buffer->alt_string, buffer->allocated, HB_GlyphItemRec ) )
|
||||
|
@ -100,15 +98,13 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
|
|||
}
|
||||
|
||||
HB_Error
|
||||
hb_buffer_new( FT_Memory memory,
|
||||
HB_Buffer *buffer )
|
||||
hb_buffer_new( HB_Buffer *buffer )
|
||||
{
|
||||
HB_Error error;
|
||||
|
||||
if ( ALLOC( *buffer, sizeof( HB_BufferRec ) ) )
|
||||
return error;
|
||||
|
||||
(*buffer)->memory = memory;
|
||||
(*buffer)->in_length = 0;
|
||||
(*buffer)->out_length = 0;
|
||||
(*buffer)->allocated = 0;
|
||||
|
@ -161,8 +157,6 @@ hb_buffer_swap( HB_Buffer buffer )
|
|||
void
|
||||
hb_buffer_free( HB_Buffer buffer )
|
||||
{
|
||||
FT_Memory memory = buffer->memory;
|
||||
|
||||
FREE( buffer->in_string );
|
||||
FREE( buffer->alt_string );
|
||||
buffer->out_string = NULL;
|
||||
|
|
|
@ -48,7 +48,6 @@ typedef struct HB_PositionRec_ {
|
|||
|
||||
|
||||
typedef struct HB_BufferRec_{
|
||||
FT_Memory memory;
|
||||
FT_ULong allocated;
|
||||
|
||||
FT_ULong in_length;
|
||||
|
@ -65,8 +64,7 @@ typedef struct HB_BufferRec_{
|
|||
} HB_BufferRec, *HB_Buffer;
|
||||
|
||||
HB_Error
|
||||
hb_buffer_new( FT_Memory memory,
|
||||
HB_Buffer *buffer );
|
||||
hb_buffer_new( HB_Buffer *buffer );
|
||||
|
||||
void
|
||||
hb_buffer_swap( HB_Buffer buffer );
|
||||
|
|
|
@ -19,13 +19,9 @@ static HB_Error Load_AttachList( HB_AttachList* al,
|
|||
static HB_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
||||
FT_Stream stream );
|
||||
|
||||
static void Free_AttachList( HB_AttachList* al,
|
||||
FT_Memory memory );
|
||||
static void Free_LigCaretList( HB_LigCaretList* lcl,
|
||||
FT_Memory memory );
|
||||
|
||||
static void Free_NewGlyphClasses( HB_GDEFHeader* gdef,
|
||||
FT_Memory memory );
|
||||
static void Free_AttachList( HB_AttachList* al );
|
||||
static void Free_LigCaretList( HB_LigCaretList* lcl );
|
||||
static void Free_NewGlyphClasses( HB_GDEFHeader* gdef );
|
||||
|
||||
|
||||
|
||||
|
@ -89,12 +85,12 @@ static HB_Error GDEF_Destroy( void* ext,
|
|||
|
||||
if ( gdef->loaded )
|
||||
{
|
||||
Free_LigCaretList( &gdef->LigCaretList, memory );
|
||||
Free_AttachList( &gdef->AttachList, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->MarkAttachClassDef, memory );
|
||||
Free_LigCaretList( &gdef->LigCaretList );
|
||||
Free_AttachList( &gdef->AttachList );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->MarkAttachClassDef );
|
||||
|
||||
Free_NewGlyphClasses( gdef, memory );
|
||||
Free_NewGlyphClasses( gdef );
|
||||
}
|
||||
|
||||
return HB_Err_Ok;
|
||||
|
@ -130,11 +126,9 @@ HB_Error HB_Init_GDEF_Extension( HB_Engine engine )
|
|||
|
||||
|
||||
|
||||
HB_Error HB_New_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** retptr )
|
||||
HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = face->memory;
|
||||
|
||||
HB_GDEFHeader* gdef;
|
||||
|
||||
|
@ -144,8 +138,6 @@ HB_Error HB_New_GDEF_Table( FT_Face face,
|
|||
if ( ALLOC( gdef, sizeof( *gdef ) ) )
|
||||
return error;
|
||||
|
||||
gdef->memory = face->memory;
|
||||
|
||||
gdef->GlyphClassDef.loaded = FALSE;
|
||||
gdef->AttachList.loaded = FALSE;
|
||||
gdef->LigCaretList.loaded = FALSE;
|
||||
|
@ -165,7 +157,6 @@ HB_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
HB_GDEFHeader** retptr )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = face->memory;
|
||||
FT_Stream stream = face->stream;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
||||
|
@ -178,7 +169,7 @@ HB_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
if (( error = _hb_ftglue_face_goto_table( face, TTAG_GDEF, stream ) ))
|
||||
return error;
|
||||
|
||||
if (( error = HB_New_GDEF_Table ( face, &gdef ) ))
|
||||
if (( error = HB_New_GDEF_Table ( &gdef ) ))
|
||||
return error;
|
||||
|
||||
base_offset = FILE_Pos();
|
||||
|
@ -268,13 +259,13 @@ HB_Error HB_Load_GDEF_Table( FT_Face face,
|
|||
return HB_Err_Ok;
|
||||
|
||||
Fail3:
|
||||
Free_LigCaretList( &gdef->LigCaretList, memory );
|
||||
Free_LigCaretList( &gdef->LigCaretList );
|
||||
|
||||
Fail2:
|
||||
Free_AttachList( &gdef->AttachList, memory );
|
||||
Free_AttachList( &gdef->AttachList );
|
||||
|
||||
Fail1:
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef );
|
||||
|
||||
Fail0:
|
||||
FREE( gdef );
|
||||
|
@ -285,14 +276,12 @@ Fail0:
|
|||
|
||||
HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef )
|
||||
{
|
||||
FT_Memory memory = gdef->memory;
|
||||
Free_LigCaretList( &gdef->LigCaretList );
|
||||
Free_AttachList( &gdef->AttachList );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->MarkAttachClassDef );
|
||||
|
||||
Free_LigCaretList( &gdef->LigCaretList, memory );
|
||||
Free_AttachList( &gdef->AttachList, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &gdef->MarkAttachClassDef, memory );
|
||||
|
||||
Free_NewGlyphClasses( gdef, memory );
|
||||
Free_NewGlyphClasses( gdef );
|
||||
|
||||
FREE( gdef );
|
||||
|
||||
|
@ -312,7 +301,6 @@ HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef )
|
|||
static HB_Error Load_AttachPoint( HB_AttachPoint* ap,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -351,8 +339,7 @@ static HB_Error Load_AttachPoint( HB_AttachPoint* ap,
|
|||
}
|
||||
|
||||
|
||||
static void Free_AttachPoint( HB_AttachPoint* ap,
|
||||
FT_Memory memory )
|
||||
static void Free_AttachPoint( HB_AttachPoint* ap )
|
||||
{
|
||||
FREE( ap->PointIndex );
|
||||
}
|
||||
|
@ -363,7 +350,6 @@ static void Free_AttachPoint( HB_AttachPoint* ap,
|
|||
static HB_Error Load_AttachList( HB_AttachList* al,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
|
@ -423,18 +409,17 @@ static HB_Error Load_AttachList( HB_AttachList* al,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_AttachPoint( &ap[m], memory );
|
||||
Free_AttachPoint( &ap[m] );
|
||||
|
||||
FREE( ap );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &al->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &al->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_AttachList( HB_AttachList* al,
|
||||
FT_Memory memory )
|
||||
static void Free_AttachList( HB_AttachList* al )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -450,12 +435,12 @@ static void Free_AttachList( HB_AttachList* al,
|
|||
ap = al->AttachPoint;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_AttachPoint( &ap[n], memory );
|
||||
Free_AttachPoint( &ap[n] );
|
||||
|
||||
FREE( ap );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &al->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &al->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -545,11 +530,10 @@ static HB_Error Load_CaretValue( HB_CaretValue* cv,
|
|||
}
|
||||
|
||||
|
||||
static void Free_CaretValue( HB_CaretValue* cv,
|
||||
FT_Memory memory )
|
||||
static void Free_CaretValue( HB_CaretValue* cv )
|
||||
{
|
||||
if ( cv->CaretValueFormat == 3 )
|
||||
_HB_OPEN_Free_Device( &cv->cvf.cvf3.Device, memory );
|
||||
_HB_OPEN_Free_Device( &cv->cvf.cvf3.Device );
|
||||
}
|
||||
|
||||
|
||||
|
@ -558,7 +542,6 @@ static void Free_CaretValue( HB_CaretValue* cv,
|
|||
static HB_Error Load_LigGlyph( HB_LigGlyph* lg,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
|
@ -603,15 +586,14 @@ static HB_Error Load_LigGlyph( HB_LigGlyph* lg,
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_CaretValue( &cv[m], memory );
|
||||
Free_CaretValue( &cv[m] );
|
||||
|
||||
FREE( cv );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_LigGlyph( HB_LigGlyph* lg,
|
||||
FT_Memory memory )
|
||||
static void Free_LigGlyph( HB_LigGlyph* lg )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -624,7 +606,7 @@ static void Free_LigGlyph( HB_LigGlyph* lg,
|
|||
cv = lg->CaretValue;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_CaretValue( &cv[n], memory );
|
||||
Free_CaretValue( &cv[n] );
|
||||
|
||||
FREE( cv );
|
||||
}
|
||||
|
@ -636,7 +618,6 @@ static void Free_LigGlyph( HB_LigGlyph* lg,
|
|||
static HB_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_Error error;
|
||||
|
||||
FT_UShort m, n, count;
|
||||
|
@ -696,18 +677,17 @@ static HB_Error Load_LigCaretList( HB_LigCaretList* lcl,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_LigGlyph( &lg[m], memory );
|
||||
Free_LigGlyph( &lg[m] );
|
||||
|
||||
FREE( lg );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &lcl->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &lcl->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_LigCaretList( HB_LigCaretList* lcl,
|
||||
FT_Memory memory )
|
||||
static void Free_LigCaretList( HB_LigCaretList* lcl )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -723,12 +703,12 @@ static void Free_LigCaretList( HB_LigCaretList* lcl,
|
|||
lg = lcl->LigGlyph;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_LigGlyph( &lg[n], memory );
|
||||
Free_LigGlyph( &lg[n] );
|
||||
|
||||
FREE( lg );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &lcl->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &lcl->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -845,8 +825,7 @@ HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
|
|||
static HB_Error Make_ClassRange( HB_ClassDefinition* cd,
|
||||
FT_UShort start,
|
||||
FT_UShort end,
|
||||
FT_UShort class,
|
||||
FT_Memory memory )
|
||||
FT_UShort class )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_UShort index;
|
||||
|
@ -858,7 +837,6 @@ static HB_Error Make_ClassRange( HB_ClassDefinition* cd,
|
|||
cdf2 = &cd->cd.cd2;
|
||||
|
||||
if ( REALLOC_ARRAY( cdf2->ClassRangeRecord,
|
||||
cdf2->ClassRangeCount,
|
||||
cdf2->ClassRangeCount + 1 ,
|
||||
HB_ClassRangeRecord ) )
|
||||
return error;
|
||||
|
@ -888,7 +866,6 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
FT_UShort start, curr_glyph, curr_class;
|
||||
FT_UShort n, m, count;
|
||||
HB_Error error;
|
||||
FT_Memory memory;
|
||||
|
||||
HB_ClassDefinition* gcd;
|
||||
HB_ClassRangeRecord* gcrr;
|
||||
|
@ -898,7 +875,6 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
if ( !gdef || !glyph_array || !class_array )
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
memory = gdef->memory;
|
||||
gcd = &gdef->GlyphClassDef;
|
||||
|
||||
/* We build a format 2 table */
|
||||
|
@ -933,8 +909,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
{
|
||||
if ( ( error = Make_ClassRange( gcd, start,
|
||||
curr_glyph,
|
||||
curr_class,
|
||||
memory ) ) != HB_Err_Ok )
|
||||
curr_class ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
}
|
||||
else
|
||||
|
@ -952,8 +927,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
{
|
||||
if ( ( error = Make_ClassRange( gcd, start,
|
||||
curr_glyph - 1,
|
||||
curr_class,
|
||||
memory ) ) != HB_Err_Ok )
|
||||
curr_class ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
|
||||
if ( curr_glyph > glyph_array[n] )
|
||||
|
@ -976,8 +950,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
|
|||
{
|
||||
if ( ( error = Make_ClassRange( gcd, start,
|
||||
curr_glyph,
|
||||
curr_class,
|
||||
memory ) ) != HB_Err_Ok )
|
||||
curr_class ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
}
|
||||
else
|
||||
|
@ -1065,8 +1038,7 @@ Fail4:
|
|||
}
|
||||
|
||||
|
||||
static void Free_NewGlyphClasses( HB_GDEFHeader* gdef,
|
||||
FT_Memory memory )
|
||||
static void Free_NewGlyphClasses( HB_GDEFHeader* gdef )
|
||||
{
|
||||
FT_UShort** ngc;
|
||||
FT_UShort n, count;
|
||||
|
|
|
@ -81,7 +81,6 @@ typedef struct HB_LigCaretList_ HB_LigCaretList;
|
|||
|
||||
struct HB_GDEFHeader_
|
||||
{
|
||||
FT_Memory memory;
|
||||
FT_ULong offset;
|
||||
|
||||
FT_Fixed Version;
|
||||
|
@ -100,11 +99,10 @@ typedef struct HB_GDEFHeader_ HB_GDEFHeader;
|
|||
typedef struct HB_GDEFHeader_* HB_GDEF;
|
||||
|
||||
|
||||
HB_Error HB_New_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** retptr );
|
||||
HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr );
|
||||
|
||||
|
||||
HB_Error HB_Load_GDEF_Table( FT_Face face,
|
||||
HB_Error HB_Load_GDEF_Table( FT_Face face,
|
||||
HB_GDEFHeader** gdef );
|
||||
|
||||
|
||||
|
|
|
@ -675,7 +675,6 @@ HB_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st,
|
|||
FT_UShort lookup_type );
|
||||
|
||||
void _HB_GPOS_Free_SubTable( HB_GPOS_SubTable* st,
|
||||
FT_Memory memory,
|
||||
FT_UShort lookup_type );
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -72,8 +72,6 @@ typedef HB_Error (*HB_MMFunction)(FT_Face face,
|
|||
|
||||
struct HB_GPOSHeader_
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
FT_Fixed Version;
|
||||
|
||||
HB_ScriptList ScriptList;
|
||||
|
|
|
@ -440,7 +440,6 @@ HB_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
|
|||
FT_UShort lookup_type );
|
||||
|
||||
void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory,
|
||||
FT_UShort lookup_type );
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,8 +50,6 @@ typedef FT_UShort (*HB_AltFunction)(FT_ULong pos,
|
|||
|
||||
struct HB_GSUBHeader_
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
FT_ULong offset;
|
||||
|
||||
FT_Fixed Version;
|
||||
|
|
|
@ -43,25 +43,22 @@ HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
|||
HB_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_Stream input );
|
||||
HB_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_Stream input );
|
||||
HB_Error _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_ULong class_offset,
|
||||
FT_ULong base_offset,
|
||||
FT_Stream stream );
|
||||
HB_Error _HB_OPEN_Load_Device( HB_Device* d,
|
||||
FT_Stream input );
|
||||
|
||||
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl,
|
||||
FT_Memory memory );
|
||||
void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl,
|
||||
FT_Memory memory );
|
||||
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl );
|
||||
void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl );
|
||||
void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
|
||||
HB_Type type,
|
||||
FT_Memory memory );
|
||||
HB_Type type );
|
||||
|
||||
void _HB_OPEN_Free_Coverage( HB_Coverage* c,
|
||||
FT_Memory memory );
|
||||
void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_Memory memory );
|
||||
void _HB_OPEN_Free_Device( HB_Device* d,
|
||||
FT_Memory memory );
|
||||
void _HB_OPEN_Free_Coverage( HB_Coverage* c );
|
||||
void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd );
|
||||
void _HB_OPEN_Free_Device( HB_Device* d );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ static HB_Error Load_LangSys( HB_LangSys* ls,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_UShort n, count;
|
||||
FT_UShort* fi;
|
||||
|
||||
|
@ -61,8 +60,7 @@ static HB_Error Load_LangSys( HB_LangSys* ls,
|
|||
}
|
||||
|
||||
|
||||
static void Free_LangSys( HB_LangSys* ls,
|
||||
FT_Memory memory )
|
||||
static void Free_LangSys( HB_LangSys* ls )
|
||||
{
|
||||
FREE( ls->FeatureIndex );
|
||||
}
|
||||
|
@ -74,7 +72,6 @@ static HB_Error Load_Script( HB_Script* s,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
||||
|
@ -153,25 +150,24 @@ static HB_Error Load_Script( HB_Script* s,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_LangSys( &lsr[m].LangSys, memory );
|
||||
Free_LangSys( &lsr[m].LangSys );
|
||||
|
||||
FREE( s->LangSysRecord );
|
||||
|
||||
Fail2:
|
||||
Free_LangSys( &s->DefaultLangSys, memory );
|
||||
Free_LangSys( &s->DefaultLangSys );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_Script( HB_Script* s,
|
||||
FT_Memory memory )
|
||||
static void Free_Script( HB_Script* s )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
HB_LangSysRecord* lsr;
|
||||
|
||||
|
||||
Free_LangSys( &s->DefaultLangSys, memory );
|
||||
Free_LangSys( &s->DefaultLangSys );
|
||||
|
||||
if ( s->LangSysRecord )
|
||||
{
|
||||
|
@ -179,7 +175,7 @@ static void Free_Script( HB_Script* s,
|
|||
lsr = s->LangSysRecord;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_LangSys( &lsr[n].LangSys, memory );
|
||||
Free_LangSys( &lsr[n].LangSys );
|
||||
|
||||
FREE( lsr );
|
||||
}
|
||||
|
@ -192,7 +188,6 @@ HB_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, script_count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -256,15 +251,14 @@ HB_Error _HB_OPEN_Load_ScriptList( HB_ScriptList* sl,
|
|||
|
||||
Fail:
|
||||
for ( n = 0; n < sl->ScriptCount; n++ )
|
||||
Free_Script( &sr[n].Script, memory );
|
||||
Free_Script( &sr[n].Script );
|
||||
|
||||
FREE( sl->ScriptRecord );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl,
|
||||
FT_Memory memory )
|
||||
void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -277,7 +271,7 @@ void _HB_OPEN_Free_ScriptList( HB_ScriptList* sl,
|
|||
sr = sl->ScriptRecord;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_Script( &sr[n].Script, memory );
|
||||
Free_Script( &sr[n].Script );
|
||||
|
||||
FREE( sr );
|
||||
}
|
||||
|
@ -296,7 +290,6 @@ static HB_Error Load_Feature( HB_Feature* f,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -333,8 +326,7 @@ static HB_Error Load_Feature( HB_Feature* f,
|
|||
}
|
||||
|
||||
|
||||
static void Free_Feature( HB_Feature* f,
|
||||
FT_Memory memory )
|
||||
static void Free_Feature( HB_Feature* f )
|
||||
{
|
||||
FREE( f->LookupListIndex );
|
||||
}
|
||||
|
@ -346,7 +338,6 @@ HB_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -395,7 +386,7 @@ HB_Error _HB_OPEN_Load_FeatureList( HB_FeatureList* fl,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_Feature( &fr[m].Feature, memory );
|
||||
Free_Feature( &fr[m].Feature );
|
||||
|
||||
FREE( fl->ApplyOrder );
|
||||
|
||||
|
@ -406,8 +397,7 @@ Fail2:
|
|||
}
|
||||
|
||||
|
||||
void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl,
|
||||
FT_Memory memory)
|
||||
void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -420,7 +410,7 @@ void _HB_OPEN_Free_FeatureList( HB_FeatureList* fl,
|
|||
fr = fl->FeatureRecord;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_Feature( &fr[n].Feature, memory );
|
||||
Free_Feature( &fr[n].Feature );
|
||||
|
||||
FREE( fr );
|
||||
}
|
||||
|
@ -454,13 +444,12 @@ static HB_Error Load_SubTable( HB_SubTable* st,
|
|||
|
||||
static void Free_SubTable( HB_SubTable* st,
|
||||
HB_Type table_type,
|
||||
FT_UShort lookup_type,
|
||||
FT_Memory memory )
|
||||
FT_UShort lookup_type )
|
||||
{
|
||||
if ( table_type == HB_Type_GSUB )
|
||||
_HB_GSUB_Free_SubTable ( &st->st.gsub, memory, lookup_type );
|
||||
_HB_GSUB_Free_SubTable ( &st->st.gsub, lookup_type );
|
||||
else
|
||||
_HB_GPOS_Free_SubTable ( &st->st.gpos, memory, lookup_type );
|
||||
_HB_GPOS_Free_SubTable ( &st->st.gpos, lookup_type );
|
||||
}
|
||||
|
||||
|
||||
|
@ -471,7 +460,6 @@ static HB_Error Load_Lookup( HB_Lookup* l,
|
|||
HB_Type type )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -539,7 +527,7 @@ static HB_Error Load_Lookup( HB_Lookup* l,
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_SubTable( &st[m], type, l->LookupType, memory );
|
||||
Free_SubTable( &st[m], type, l->LookupType );
|
||||
|
||||
FREE( l->SubTable );
|
||||
return error;
|
||||
|
@ -547,8 +535,7 @@ Fail:
|
|||
|
||||
|
||||
static void Free_Lookup( HB_Lookup* l,
|
||||
HB_Type type,
|
||||
FT_Memory memory)
|
||||
HB_Type type )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -561,7 +548,7 @@ static void Free_Lookup( HB_Lookup* l,
|
|||
st = l->SubTable;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_SubTable( &st[n], type, l->LookupType, memory );
|
||||
Free_SubTable( &st[n], type, l->LookupType );
|
||||
|
||||
FREE( st );
|
||||
}
|
||||
|
@ -575,7 +562,6 @@ HB_Error _HB_OPEN_Load_LookupList( HB_LookupList* ll,
|
|||
HB_Type type )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -623,7 +609,7 @@ Fail1:
|
|||
FREE( ll->Properties );
|
||||
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_Lookup( &l[m], type, memory );
|
||||
Free_Lookup( &l[m], type );
|
||||
|
||||
Fail2:
|
||||
FREE( ll->Lookup );
|
||||
|
@ -632,8 +618,7 @@ Fail2:
|
|||
|
||||
|
||||
void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
|
||||
HB_Type type,
|
||||
FT_Memory memory )
|
||||
HB_Type type )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -648,7 +633,7 @@ void _HB_OPEN_Free_LookupList( HB_LookupList* ll,
|
|||
l = ll->Lookup;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_Lookup( &l[n], type, memory );
|
||||
Free_Lookup( &l[n], type );
|
||||
|
||||
FREE( l );
|
||||
}
|
||||
|
@ -667,7 +652,6 @@ static HB_Error Load_Coverage1( HB_CoverageFormat1* cf1,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -703,8 +687,7 @@ static HB_Error Load_Coverage1( HB_CoverageFormat1* cf1,
|
|||
}
|
||||
|
||||
|
||||
static void Free_Coverage1( HB_CoverageFormat1* cf1,
|
||||
FT_Memory memory)
|
||||
static void Free_Coverage1( HB_CoverageFormat1* cf1 )
|
||||
{
|
||||
FREE( cf1->GlyphArray );
|
||||
}
|
||||
|
@ -716,7 +699,6 @@ static HB_Error Load_Coverage2( HB_CoverageFormat2* cf2,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -766,8 +748,7 @@ Fail:
|
|||
}
|
||||
|
||||
|
||||
static void Free_Coverage2( HB_CoverageFormat2* cf2,
|
||||
FT_Memory memory )
|
||||
static void Free_Coverage2( HB_CoverageFormat2* cf2 )
|
||||
{
|
||||
FREE( cf2->RangeRecord );
|
||||
}
|
||||
|
@ -796,13 +777,12 @@ HB_Error _HB_OPEN_Load_Coverage( HB_Coverage* c,
|
|||
}
|
||||
|
||||
|
||||
void _HB_OPEN_Free_Coverage( HB_Coverage* c,
|
||||
FT_Memory memory )
|
||||
void _HB_OPEN_Free_Coverage( HB_Coverage* c )
|
||||
{
|
||||
switch ( c->CoverageFormat )
|
||||
{
|
||||
case 1: Free_Coverage1( &c->cf.cf1, memory ); break;
|
||||
case 2: Free_Coverage2( &c->cf.cf2, memory ); break;
|
||||
case 1: Free_Coverage1( &c->cf.cf1 ); break;
|
||||
case 2: Free_Coverage2( &c->cf.cf2 ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -936,7 +916,6 @@ static HB_Error Load_ClassDef1( HB_ClassDefinition* cd,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -994,8 +973,7 @@ Fail:
|
|||
}
|
||||
|
||||
|
||||
static void Free_ClassDef1( HB_ClassDefFormat1* cdf1,
|
||||
FT_Memory memory )
|
||||
static void Free_ClassDef1( HB_ClassDefFormat1* cdf1 )
|
||||
{
|
||||
FREE( cdf1->ClassValueArray );
|
||||
}
|
||||
|
@ -1008,7 +986,6 @@ static HB_Error Load_ClassDef2( HB_ClassDefinition* cd,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1074,8 +1051,7 @@ Fail:
|
|||
}
|
||||
|
||||
|
||||
static void Free_ClassDef2( HB_ClassDefFormat2* cdf2,
|
||||
FT_Memory memory )
|
||||
static void Free_ClassDef2( HB_ClassDefFormat2* cdf2 )
|
||||
{
|
||||
FREE( cdf2->ClassRangeRecord );
|
||||
}
|
||||
|
@ -1088,8 +1064,6 @@ HB_Error _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
|
||||
if ( ALLOC_ARRAY( cd->Defined, limit, FT_Bool ) )
|
||||
return error;
|
||||
|
@ -1121,12 +1095,9 @@ Fail:
|
|||
}
|
||||
|
||||
|
||||
HB_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_Stream stream )
|
||||
static HB_Error _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
|
||||
if ( ALLOC_ARRAY( cd->Defined, 1, FT_Bool ) )
|
||||
return error;
|
||||
|
@ -1144,8 +1115,32 @@ Fail:
|
|||
return error;
|
||||
}
|
||||
|
||||
void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_Memory memory )
|
||||
HB_Error _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd,
|
||||
FT_UShort limit,
|
||||
FT_ULong class_offset,
|
||||
FT_ULong base_offset,
|
||||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_ULong cur_offset;
|
||||
|
||||
cur_offset = FILE_Pos();
|
||||
|
||||
if ( class_offset )
|
||||
{
|
||||
if ( !FILE_Seek( class_offset + base_offset ) )
|
||||
error = _HB_OPEN_Load_ClassDefinition( cd, limit, stream );
|
||||
}
|
||||
else
|
||||
error = _HB_OPEN_Load_EmptyClassDefinition ( cd );
|
||||
|
||||
if (error == HB_Err_Ok)
|
||||
(void)FILE_Seek( cur_offset ); /* Changes error as a side-effect */
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd )
|
||||
{
|
||||
if ( !cd->loaded )
|
||||
return;
|
||||
|
@ -1154,9 +1149,9 @@ void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd,
|
|||
|
||||
switch ( cd->ClassFormat )
|
||||
{
|
||||
case 1: Free_ClassDef1( &cd->cd.cd1, memory ); break;
|
||||
case 2: Free_ClassDef2( &cd->cd.cd2, memory ); break;
|
||||
default: break;
|
||||
case 1: Free_ClassDef1( &cd->cd.cd1 ); break;
|
||||
case 2: Free_ClassDef2( &cd->cd.cd2 ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1280,6 @@ HB_Error _HB_OPEN_Load_Device( HB_Device* d,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1337,8 +1331,7 @@ HB_Error _HB_OPEN_Load_Device( HB_Device* d,
|
|||
}
|
||||
|
||||
|
||||
void _HB_OPEN_Free_Device( HB_Device* d,
|
||||
FT_Memory memory )
|
||||
void _HB_OPEN_Free_Device( HB_Device* d )
|
||||
{
|
||||
FREE( d->DeltaValue );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue