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
42
src/ftglue.c
42
src/ftglue.c
|
@ -30,8 +30,7 @@ _hb_ftglue_log( const char* format, ... )
|
|||
|
||||
/* only used internally */
|
||||
static FT_Pointer
|
||||
_hb_ftglue_qalloc( FT_Memory memory,
|
||||
FT_ULong size,
|
||||
_hb_ftglue_qalloc( FT_ULong size,
|
||||
HB_Error *perror )
|
||||
{
|
||||
HB_Error error = 0;
|
||||
|
@ -39,7 +38,7 @@ _hb_ftglue_qalloc( FT_Memory memory,
|
|||
|
||||
if ( size > 0 )
|
||||
{
|
||||
block = memory->alloc( memory, size );
|
||||
block = malloc( size );
|
||||
if ( !block )
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
}
|
||||
|
@ -49,12 +48,11 @@ _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_ftglue_alloc( FT_ULong size,
|
||||
HB_Error *perror )
|
||||
{
|
||||
HB_Error error = 0;
|
||||
|
@ -62,7 +60,7 @@ _hb_ftglue_alloc( FT_Memory memory,
|
|||
|
||||
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,
|
||||
_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 )
|
||||
block2 = realloc( block, new_size );
|
||||
if ( block2 == NULL && new_size != 0 )
|
||||
error = HB_Err_Out_Of_Memory;
|
||||
else if ( new_size > old_size )
|
||||
memset( (char*)block2 + old_size, 0, (size_t)(new_size - old_size) );
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
22
src/ftglue.h
22
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_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,
|
||||
_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,8 +99,7 @@ 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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -35,7 +35,6 @@ HB_Error HB_Load_GSUB_Table( FT_Face face,
|
|||
HB_GDEFHeader* gdef )
|
||||
{
|
||||
FT_Stream stream = face->stream;
|
||||
FT_Memory memory = face->memory;
|
||||
HB_Error error;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
||||
|
@ -54,7 +53,6 @@ HB_Error HB_Load_GSUB_Table( FT_Face face,
|
|||
if ( ALLOC ( gsub, sizeof( *gsub ) ) )
|
||||
return error;
|
||||
|
||||
gsub->memory = memory;
|
||||
|
||||
/* skip version */
|
||||
|
||||
|
@ -137,13 +135,13 @@ HB_Error HB_Load_GSUB_Table( FT_Face face,
|
|||
return HB_Err_Ok;
|
||||
|
||||
Fail1:
|
||||
_HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB, memory );
|
||||
_HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_FeatureList( &gsub->FeatureList, memory );
|
||||
_HB_OPEN_Free_FeatureList( &gsub->FeatureList );
|
||||
|
||||
Fail3:
|
||||
_HB_OPEN_Free_ScriptList( &gsub->ScriptList, memory );
|
||||
_HB_OPEN_Free_ScriptList( &gsub->ScriptList );
|
||||
|
||||
Fail4:
|
||||
FREE ( gsub );
|
||||
|
@ -155,11 +153,9 @@ Fail4:
|
|||
|
||||
HB_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub )
|
||||
{
|
||||
FT_Memory memory = gsub->memory;
|
||||
|
||||
_HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB, memory );
|
||||
_HB_OPEN_Free_FeatureList( &gsub->FeatureList, memory );
|
||||
_HB_OPEN_Free_ScriptList( &gsub->ScriptList, memory );
|
||||
_HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB );
|
||||
_HB_OPEN_Free_FeatureList( &gsub->FeatureList );
|
||||
_HB_OPEN_Free_ScriptList( &gsub->ScriptList );
|
||||
|
||||
FREE( gsub );
|
||||
|
||||
|
@ -180,7 +176,6 @@ static HB_Error Load_SingleSubst( HB_GSUB_SubTable* st,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_SingleSubst* ss = &st->single;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
@ -252,13 +247,12 @@ Fail1:
|
|||
FREE( s );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &ss->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ss->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_SingleSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_SingleSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
HB_SingleSubst* ss = &st->single;
|
||||
|
||||
|
@ -275,7 +269,7 @@ static void Free_SingleSubst( HB_GSUB_SubTable* st,
|
|||
break;
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &ss->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ss->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -344,7 +338,6 @@ static HB_Error Load_Sequence( HB_Sequence* s,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
FT_UShort* sub;
|
||||
|
@ -382,8 +375,7 @@ static HB_Error Load_Sequence( HB_Sequence* s,
|
|||
}
|
||||
|
||||
|
||||
static void Free_Sequence( HB_Sequence* s,
|
||||
FT_Memory memory )
|
||||
static void Free_Sequence( HB_Sequence* s )
|
||||
{
|
||||
FREE( s->Substitute );
|
||||
}
|
||||
|
@ -395,7 +387,6 @@ static HB_Error Load_MultipleSubst( HB_GSUB_SubTable* st,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_MultipleSubst* ms = &st->multiple;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
|
@ -454,18 +445,17 @@ static HB_Error Load_MultipleSubst( HB_GSUB_SubTable* st,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_Sequence( &s[m], memory );
|
||||
Free_Sequence( &s[m] );
|
||||
|
||||
FREE( s );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &ms->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ms->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_MultipleSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_MultipleSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
HB_MultipleSubst* ms = &st->multiple;
|
||||
|
@ -479,12 +469,12 @@ static void Free_MultipleSubst( HB_GSUB_SubTable* st,
|
|||
s = ms->Sequence;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_Sequence( &s[n], memory );
|
||||
Free_Sequence( &s[n] );
|
||||
|
||||
FREE( s );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &ms->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ms->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -549,7 +539,6 @@ static HB_Error Load_AlternateSet( HB_AlternateSet* as,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
FT_UShort* a;
|
||||
|
@ -584,8 +573,7 @@ static HB_Error Load_AlternateSet( HB_AlternateSet* as,
|
|||
}
|
||||
|
||||
|
||||
static void Free_AlternateSet( HB_AlternateSet* as,
|
||||
FT_Memory memory )
|
||||
static void Free_AlternateSet( HB_AlternateSet* as )
|
||||
{
|
||||
FREE( as->Alternate );
|
||||
}
|
||||
|
@ -597,7 +585,6 @@ static HB_Error Load_AlternateSubst( HB_GSUB_SubTable* st,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_AlternateSubst* as = &st->alternate;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
|
@ -656,18 +643,17 @@ static HB_Error Load_AlternateSubst( HB_GSUB_SubTable* st,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_AlternateSet( &aset[m], memory );
|
||||
Free_AlternateSet( &aset[m] );
|
||||
|
||||
FREE( aset );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &as->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &as->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_AlternateSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_AlternateSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
HB_AlternateSubst* as = &st->alternate;
|
||||
|
@ -681,12 +667,12 @@ static void Free_AlternateSubst( HB_GSUB_SubTable* st,
|
|||
aset = as->AlternateSet;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_AlternateSet( &aset[n], memory );
|
||||
Free_AlternateSet( &aset[n] );
|
||||
|
||||
FREE( aset );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &as->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &as->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -751,7 +737,6 @@ static HB_Error Load_Ligature( HB_Ligature* l,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
FT_UShort* c;
|
||||
|
@ -789,8 +774,7 @@ static HB_Error Load_Ligature( HB_Ligature* l,
|
|||
}
|
||||
|
||||
|
||||
static void Free_Ligature( HB_Ligature* l,
|
||||
FT_Memory memory )
|
||||
static void Free_Ligature( HB_Ligature* l )
|
||||
{
|
||||
FREE( l->Component );
|
||||
}
|
||||
|
@ -802,7 +786,6 @@ static HB_Error Load_LigatureSet( HB_LigatureSet* ls,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -846,15 +829,14 @@ static HB_Error Load_LigatureSet( HB_LigatureSet* ls,
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_Ligature( &l[m], memory );
|
||||
Free_Ligature( &l[m] );
|
||||
|
||||
FREE( l );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_LigatureSet( HB_LigatureSet* ls,
|
||||
FT_Memory memory )
|
||||
static void Free_LigatureSet( HB_LigatureSet* ls )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -867,7 +849,7 @@ static void Free_LigatureSet( HB_LigatureSet* ls,
|
|||
l = ls->Ligature;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_Ligature( &l[n], memory );
|
||||
Free_Ligature( &l[n] );
|
||||
|
||||
FREE( l );
|
||||
}
|
||||
|
@ -880,7 +862,6 @@ static HB_Error Load_LigatureSubst( HB_GSUB_SubTable* st,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_LigatureSubst* ls = &st->ligature;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
|
@ -939,18 +920,17 @@ static HB_Error Load_LigatureSubst( HB_GSUB_SubTable* st,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_LigatureSet( &lset[m], memory );
|
||||
Free_LigatureSet( &lset[m] );
|
||||
|
||||
FREE( lset );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &ls->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ls->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_LigatureSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_LigatureSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
HB_LigatureSubst* ls = &st->ligature;
|
||||
|
@ -964,12 +944,12 @@ static void Free_LigatureSubst( HB_GSUB_SubTable* st,
|
|||
lset = ls->LigatureSet;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_LigatureSet( &lset[n], memory );
|
||||
Free_LigatureSet( &lset[n] );
|
||||
|
||||
FREE( lset );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &ls->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ls->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1165,7 +1145,6 @@ static HB_Error Load_SubRule( HB_SubRule* sr,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
FT_UShort* i;
|
||||
|
@ -1229,8 +1208,7 @@ Fail2:
|
|||
}
|
||||
|
||||
|
||||
static void Free_SubRule( HB_SubRule* sr,
|
||||
FT_Memory memory )
|
||||
static void Free_SubRule( HB_SubRule* sr )
|
||||
{
|
||||
FREE( sr->SubstLookupRecord );
|
||||
FREE( sr->Input );
|
||||
|
@ -1243,7 +1221,6 @@ static HB_Error Load_SubRuleSet( HB_SubRuleSet* srs,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -1287,15 +1264,14 @@ static HB_Error Load_SubRuleSet( HB_SubRuleSet* srs,
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_SubRule( &sr[m], memory );
|
||||
Free_SubRule( &sr[m] );
|
||||
|
||||
FREE( sr );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_SubRuleSet( HB_SubRuleSet* srs,
|
||||
FT_Memory memory )
|
||||
static void Free_SubRuleSet( HB_SubRuleSet* srs )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1308,7 +1284,7 @@ static void Free_SubRuleSet( HB_SubRuleSet* srs,
|
|||
sr = srs->SubRule;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_SubRule( &sr[n], memory );
|
||||
Free_SubRule( &sr[n] );
|
||||
|
||||
FREE( sr );
|
||||
}
|
||||
|
@ -1321,7 +1297,6 @@ static HB_Error Load_ContextSubst1( HB_ContextSubstFormat1* csf1,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -1378,18 +1353,17 @@ static HB_Error Load_ContextSubst1( HB_ContextSubstFormat1* csf1,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_SubRuleSet( &srs[m], memory );
|
||||
Free_SubRuleSet( &srs[m] );
|
||||
|
||||
FREE( srs );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &csf1->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &csf1->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ContextSubst1( HB_ContextSubstFormat1* csf1,
|
||||
FT_Memory memory )
|
||||
static void Free_ContextSubst1( HB_ContextSubstFormat1* csf1 )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1402,12 +1376,12 @@ static void Free_ContextSubst1( HB_ContextSubstFormat1* csf1,
|
|||
srs = csf1->SubRuleSet;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_SubRuleSet( &srs[n], memory );
|
||||
Free_SubRuleSet( &srs[n] );
|
||||
|
||||
FREE( srs );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &csf1->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &csf1->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1418,7 +1392,6 @@ static HB_Error Load_SubClassRule( HB_ContextSubstFormat2* csf2,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1494,8 +1467,7 @@ Fail2:
|
|||
}
|
||||
|
||||
|
||||
static void Free_SubClassRule( HB_SubClassRule* scr,
|
||||
FT_Memory memory )
|
||||
static void Free_SubClassRule( HB_SubClassRule* scr )
|
||||
{
|
||||
FREE( scr->SubstLookupRecord );
|
||||
FREE( scr->Class );
|
||||
|
@ -1509,7 +1481,6 @@ static HB_Error Load_SubClassSet( HB_ContextSubstFormat2* csf2,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -1554,15 +1525,14 @@ static HB_Error Load_SubClassSet( HB_ContextSubstFormat2* csf2,
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_SubClassRule( &scr[m], memory );
|
||||
Free_SubClassRule( &scr[m] );
|
||||
|
||||
FREE( scr );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_SubClassSet( HB_SubClassSet* scs,
|
||||
FT_Memory memory )
|
||||
static void Free_SubClassSet( HB_SubClassSet* scs )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1575,7 +1545,7 @@ static void Free_SubClassSet( HB_SubClassSet* scs,
|
|||
scr = scs->SubClassRule;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_SubClassRule( &scr[n], memory );
|
||||
Free_SubClassRule( &scr[n] );
|
||||
|
||||
FREE( scr );
|
||||
}
|
||||
|
@ -1588,7 +1558,6 @@ static HB_Error Load_ContextSubst2( HB_ContextSubstFormat2* csf2,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -1669,21 +1638,20 @@ static HB_Error Load_ContextSubst2( HB_ContextSubstFormat2* csf2,
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_SubClassSet( &scs[m], memory );
|
||||
Free_SubClassSet( &scs[m] );
|
||||
|
||||
FREE( scs );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_ClassDefinition( &csf2->ClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &csf2->ClassDef );
|
||||
|
||||
Fail3:
|
||||
_HB_OPEN_Free_Coverage( &csf2->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &csf2->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ContextSubst2( HB_ContextSubstFormat2* csf2,
|
||||
FT_Memory memory )
|
||||
static void Free_ContextSubst2( HB_ContextSubstFormat2* csf2 )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1696,13 +1664,13 @@ static void Free_ContextSubst2( HB_ContextSubstFormat2* csf2,
|
|||
scs = csf2->SubClassSet;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_SubClassSet( &scs[n], memory );
|
||||
Free_SubClassSet( &scs[n] );
|
||||
|
||||
FREE( scs );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_ClassDefinition( &csf2->ClassDef, memory );
|
||||
_HB_OPEN_Free_Coverage( &csf2->Coverage, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &csf2->ClassDef );
|
||||
_HB_OPEN_Free_Coverage( &csf2->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1712,7 +1680,6 @@ static HB_Error Load_ContextSubst3( HB_ContextSubstFormat3* csf3,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -1784,15 +1751,14 @@ Fail1:
|
|||
|
||||
Fail2:
|
||||
for ( m = 0; m < n; m++ )
|
||||
_HB_OPEN_Free_Coverage( &c[m], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[m] );
|
||||
|
||||
FREE( c );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ContextSubst3( HB_ContextSubstFormat3* csf3,
|
||||
FT_Memory memory )
|
||||
static void Free_ContextSubst3( HB_ContextSubstFormat3* csf3 )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -1807,7 +1773,7 @@ static void Free_ContextSubst3( HB_ContextSubstFormat3* csf3,
|
|||
c = csf3->Coverage;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
_HB_OPEN_Free_Coverage( &c[n], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[n] );
|
||||
|
||||
FREE( c );
|
||||
}
|
||||
|
@ -1842,16 +1808,15 @@ static HB_Error Load_ContextSubst( HB_GSUB_SubTable* st,
|
|||
}
|
||||
|
||||
|
||||
static void Free_ContextSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_ContextSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
HB_ContextSubst* cs = &st->context;
|
||||
|
||||
switch ( cs->SubstFormat )
|
||||
{
|
||||
case 1: Free_ContextSubst1( &cs->csf.csf1, memory ); break;
|
||||
case 2: Free_ContextSubst2( &cs->csf.csf2, memory ); break;
|
||||
case 3: Free_ContextSubst3( &cs->csf.csf3, memory ); break;
|
||||
case 1: Free_ContextSubst1( &cs->csf.csf1 ); break;
|
||||
case 2: Free_ContextSubst2( &cs->csf.csf2 ); break;
|
||||
case 3: Free_ContextSubst3( &cs->csf.csf3 ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -1929,7 +1894,6 @@ static HB_Error Lookup_ContextSubst2( HB_GSUBHeader* gsub,
|
|||
{
|
||||
FT_UShort index, property;
|
||||
HB_Error error;
|
||||
FT_Memory memory = gsub->memory;
|
||||
FT_UShort i, j, k, known_classes;
|
||||
|
||||
FT_UShort* classes;
|
||||
|
@ -2107,7 +2071,6 @@ static HB_Error Load_ChainSubRule( HB_ChainSubRule* csr,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
FT_UShort* b;
|
||||
|
@ -2233,8 +2196,7 @@ Fail4:
|
|||
}
|
||||
|
||||
|
||||
static void Free_ChainSubRule( HB_ChainSubRule* csr,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainSubRule( HB_ChainSubRule* csr )
|
||||
{
|
||||
FREE( csr->SubstLookupRecord );
|
||||
FREE( csr->Lookahead );
|
||||
|
@ -2249,7 +2211,6 @@ static HB_Error Load_ChainSubRuleSet( HB_ChainSubRuleSet* csrs,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -2293,15 +2254,14 @@ static HB_Error Load_ChainSubRuleSet( HB_ChainSubRuleSet* csrs,
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_ChainSubRule( &csr[m], memory );
|
||||
Free_ChainSubRule( &csr[m] );
|
||||
|
||||
FREE( csr );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ChainSubRuleSet( HB_ChainSubRuleSet* csrs,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainSubRuleSet( HB_ChainSubRuleSet* csrs )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -2314,7 +2274,7 @@ static void Free_ChainSubRuleSet( HB_ChainSubRuleSet* csrs,
|
|||
csr = csrs->ChainSubRule;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_ChainSubRule( &csr[n], memory );
|
||||
Free_ChainSubRule( &csr[n] );
|
||||
|
||||
FREE( csr );
|
||||
}
|
||||
|
@ -2328,7 +2288,6 @@ static HB_Error Load_ChainContextSubst1(
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -2385,18 +2344,17 @@ static HB_Error Load_ChainContextSubst1(
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_ChainSubRuleSet( &csrs[m], memory );
|
||||
Free_ChainSubRuleSet( &csrs[m] );
|
||||
|
||||
FREE( csrs );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_Coverage( &ccsf1->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ccsf1->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ChainContextSubst1( HB_ChainContextSubstFormat1* ccsf1,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainContextSubst1( HB_ChainContextSubstFormat1* ccsf1 )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -2409,12 +2367,12 @@ static void Free_ChainContextSubst1( HB_ChainContextSubstFormat1* ccsf1,
|
|||
csrs = ccsf1->ChainSubRuleSet;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_ChainSubRuleSet( &csrs[n], memory );
|
||||
Free_ChainSubRuleSet( &csrs[n] );
|
||||
|
||||
FREE( csrs );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_Coverage( &ccsf1->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ccsf1->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2426,7 +2384,6 @@ static HB_Error Load_ChainSubClassRule(
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -2584,8 +2541,7 @@ Fail4:
|
|||
}
|
||||
|
||||
|
||||
static void Free_ChainSubClassRule( HB_ChainSubClassRule* cscr,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainSubClassRule( HB_ChainSubClassRule* cscr )
|
||||
{
|
||||
FREE( cscr->SubstLookupRecord );
|
||||
FREE( cscr->Lookahead );
|
||||
|
@ -2602,7 +2558,6 @@ static HB_Error Load_ChainSubClassSet(
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -2648,15 +2603,14 @@ static HB_Error Load_ChainSubClassSet(
|
|||
|
||||
Fail:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_ChainSubClassRule( &cscr[m], memory );
|
||||
Free_ChainSubClassRule( &cscr[m] );
|
||||
|
||||
FREE( cscr );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ChainSubClassSet( HB_ChainSubClassSet* cscs,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainSubClassSet( HB_ChainSubClassSet* cscs )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -2669,37 +2623,12 @@ static void Free_ChainSubClassSet( HB_ChainSubClassSet* cscs,
|
|||
cscr = cscs->ChainSubClassRule;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_ChainSubClassRule( &cscr[n], memory );
|
||||
Free_ChainSubClassRule( &cscr[n] );
|
||||
|
||||
FREE( cscr );
|
||||
}
|
||||
}
|
||||
|
||||
static HB_Error GSUB_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, stream );
|
||||
|
||||
if (error == HB_Err_Ok)
|
||||
(void)FILE_Seek( cur_offset ); /* Changes error as a side-effect */
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* ChainContextSubstFormat2 */
|
||||
|
||||
|
@ -2708,7 +2637,6 @@ static HB_Error Load_ChainContextSubst2(
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n = 0, m, count;
|
||||
FT_ULong cur_offset, new_offset, base_offset;
|
||||
|
@ -2747,16 +2675,16 @@ static HB_Error Load_ChainContextSubst2(
|
|||
|
||||
FORGET_Frame();
|
||||
|
||||
if ( ( error = GSUB_Load_EmptyOrClassDefinition( &ccsf2->BacktrackClassDef, 65535,
|
||||
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->BacktrackClassDef, 65535,
|
||||
backtrack_offset, base_offset,
|
||||
stream ) ) != HB_Err_Ok )
|
||||
goto Fail5;
|
||||
|
||||
if ( ( error = GSUB_Load_EmptyOrClassDefinition( &ccsf2->InputClassDef, count,
|
||||
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->InputClassDef, count,
|
||||
input_offset, base_offset,
|
||||
stream ) ) != HB_Err_Ok )
|
||||
goto Fail4;
|
||||
if ( ( error = GSUB_Load_EmptyOrClassDefinition( &ccsf2->LookaheadClassDef, 65535,
|
||||
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->LookaheadClassDef, 65535,
|
||||
lookahead_offset, base_offset,
|
||||
stream ) ) != HB_Err_Ok )
|
||||
goto Fail3;
|
||||
|
@ -2802,27 +2730,26 @@ static HB_Error Load_ChainContextSubst2(
|
|||
|
||||
Fail1:
|
||||
for ( m = 0; m < n; m++ )
|
||||
Free_ChainSubClassSet( &cscs[m], memory );
|
||||
Free_ChainSubClassSet( &cscs[m] );
|
||||
|
||||
FREE( cscs );
|
||||
|
||||
Fail2:
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->LookaheadClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->LookaheadClassDef );
|
||||
|
||||
Fail3:
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->InputClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->InputClassDef );
|
||||
|
||||
Fail4:
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->BacktrackClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->BacktrackClassDef );
|
||||
|
||||
Fail5:
|
||||
_HB_OPEN_Free_Coverage( &ccsf2->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ccsf2->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ChainContextSubst2( HB_ChainContextSubstFormat2* ccsf2,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainContextSubst2( HB_ChainContextSubstFormat2* ccsf2 )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -2835,16 +2762,16 @@ static void Free_ChainContextSubst2( HB_ChainContextSubstFormat2* ccsf2,
|
|||
cscs = ccsf2->ChainSubClassSet;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
Free_ChainSubClassSet( &cscs[n], memory );
|
||||
Free_ChainSubClassSet( &cscs[n] );
|
||||
|
||||
FREE( cscs );
|
||||
}
|
||||
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->LookaheadClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->InputClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->BacktrackClassDef, memory );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->LookaheadClassDef );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->InputClassDef );
|
||||
_HB_OPEN_Free_ClassDefinition( &ccsf2->BacktrackClassDef );
|
||||
|
||||
_HB_OPEN_Free_Coverage( &ccsf2->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &ccsf2->Coverage );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2855,7 +2782,6 @@ static HB_Error Load_ChainContextSubst3(
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
FT_UShort n, nb = 0, ni =0, nl = 0, m, count;
|
||||
FT_UShort backtrack_count, input_count, lookahead_count;
|
||||
|
@ -3002,27 +2928,26 @@ Fail1:
|
|||
|
||||
Fail2:
|
||||
for ( m = 0; m < nl; m++ )
|
||||
_HB_OPEN_Free_Coverage( &l[m], memory );
|
||||
_HB_OPEN_Free_Coverage( &l[m] );
|
||||
|
||||
FREE( l );
|
||||
|
||||
Fail3:
|
||||
for ( m = 0; m < ni; m++ )
|
||||
_HB_OPEN_Free_Coverage( &i[m], memory );
|
||||
_HB_OPEN_Free_Coverage( &i[m] );
|
||||
|
||||
FREE( i );
|
||||
|
||||
Fail4:
|
||||
for ( m = 0; m < nb; m++ )
|
||||
_HB_OPEN_Free_Coverage( &b[m], memory );
|
||||
_HB_OPEN_Free_Coverage( &b[m] );
|
||||
|
||||
FREE( b );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ChainContextSubst3( HB_ChainContextSubstFormat3* ccsf3,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainContextSubst3( HB_ChainContextSubstFormat3* ccsf3 )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
|
||||
|
@ -3037,7 +2962,7 @@ static void Free_ChainContextSubst3( HB_ChainContextSubstFormat3* ccsf3,
|
|||
c = ccsf3->LookaheadCoverage;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
_HB_OPEN_Free_Coverage( &c[n], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[n] );
|
||||
|
||||
FREE( c );
|
||||
}
|
||||
|
@ -3048,7 +2973,7 @@ static void Free_ChainContextSubst3( HB_ChainContextSubstFormat3* ccsf3,
|
|||
c = ccsf3->InputCoverage;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
_HB_OPEN_Free_Coverage( &c[n], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[n] );
|
||||
|
||||
FREE( c );
|
||||
}
|
||||
|
@ -3059,7 +2984,7 @@ static void Free_ChainContextSubst3( HB_ChainContextSubstFormat3* ccsf3,
|
|||
c = ccsf3->BacktrackCoverage;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
_HB_OPEN_Free_Coverage( &c[n], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[n] );
|
||||
|
||||
FREE( c );
|
||||
}
|
||||
|
@ -3092,15 +3017,14 @@ static HB_Error Load_ChainContextSubst( HB_GSUB_SubTable* st,
|
|||
}
|
||||
|
||||
|
||||
static void Free_ChainContextSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_ChainContextSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
HB_ChainContextSubst* ccs = &st->chain;
|
||||
|
||||
switch ( ccs->SubstFormat ) {
|
||||
case 1: Free_ChainContextSubst1( &ccs->ccsf.ccsf1, memory ); break;
|
||||
case 2: Free_ChainContextSubst2( &ccs->ccsf.ccsf2, memory ); break;
|
||||
case 3: Free_ChainContextSubst3( &ccs->ccsf.ccsf3, memory ); break;
|
||||
case 1: Free_ChainContextSubst1( &ccs->ccsf.ccsf1 ); break;
|
||||
case 2: Free_ChainContextSubst2( &ccs->ccsf.ccsf2 ); break;
|
||||
case 3: Free_ChainContextSubst3( &ccs->ccsf.ccsf3 ); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -3241,7 +3165,6 @@ static HB_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub,
|
|||
int nesting_level )
|
||||
{
|
||||
FT_UShort index, property;
|
||||
FT_Memory memory;
|
||||
HB_Error error;
|
||||
FT_UShort i, j, k;
|
||||
FT_UShort bgc, igc, lgc;
|
||||
|
@ -3263,7 +3186,6 @@ static HB_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub,
|
|||
|
||||
|
||||
gdef = gsub->gdef;
|
||||
memory = gsub->memory;
|
||||
|
||||
if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) )
|
||||
return error;
|
||||
|
@ -3566,7 +3488,6 @@ static HB_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st,
|
|||
FT_Stream stream )
|
||||
{
|
||||
HB_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
HB_ReverseChainContextSubst* rccs = &st->reverse;
|
||||
|
||||
FT_UShort m, count;
|
||||
|
@ -3704,31 +3625,30 @@ Fail1:
|
|||
|
||||
Fail2:
|
||||
for ( m = 0; m < nl; m++ )
|
||||
_HB_OPEN_Free_Coverage( &l[m], memory );
|
||||
_HB_OPEN_Free_Coverage( &l[m] );
|
||||
|
||||
FREE( l );
|
||||
|
||||
Fail3:
|
||||
for ( m = 0; m < nb; m++ )
|
||||
_HB_OPEN_Free_Coverage( &b[m], memory );
|
||||
_HB_OPEN_Free_Coverage( &b[m] );
|
||||
|
||||
FREE( b );
|
||||
|
||||
Fail4:
|
||||
_HB_OPEN_Free_Coverage( &rccs->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &rccs->Coverage );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static void Free_ReverseChainContextSubst( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory )
|
||||
static void Free_ReverseChainContextSubst( HB_GSUB_SubTable* st )
|
||||
{
|
||||
FT_UShort n, count;
|
||||
HB_ReverseChainContextSubst* rccs = &st->reverse;
|
||||
|
||||
HB_Coverage* c;
|
||||
|
||||
_HB_OPEN_Free_Coverage( &rccs->Coverage, memory );
|
||||
_HB_OPEN_Free_Coverage( &rccs->Coverage );
|
||||
|
||||
if ( rccs->LookaheadCoverage )
|
||||
{
|
||||
|
@ -3736,7 +3656,7 @@ static void Free_ReverseChainContextSubst( HB_GSUB_SubTable* st,
|
|||
c = rccs->LookaheadCoverage;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
_HB_OPEN_Free_Coverage( &c[n], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[n] );
|
||||
|
||||
FREE( c );
|
||||
}
|
||||
|
@ -3747,7 +3667,7 @@ static void Free_ReverseChainContextSubst( HB_GSUB_SubTable* st,
|
|||
c = rccs->BacktrackCoverage;
|
||||
|
||||
for ( n = 0; n < count; n++ )
|
||||
_HB_OPEN_Free_Coverage( &c[n], memory );
|
||||
_HB_OPEN_Free_Coverage( &c[n] );
|
||||
|
||||
FREE( c );
|
||||
}
|
||||
|
@ -3995,7 +3915,6 @@ HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
|
|||
{
|
||||
FT_UShort n;
|
||||
HB_Error error;
|
||||
FT_Memory memory;
|
||||
FT_ULong* stl;
|
||||
|
||||
HB_ScriptList* sl;
|
||||
|
@ -4005,8 +3924,6 @@ HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub,
|
|||
if ( !gsub || !script_tag_list )
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
memory = gsub->memory;
|
||||
|
||||
sl = &gsub->ScriptList;
|
||||
sr = sl->ScriptRecord;
|
||||
|
||||
|
@ -4030,7 +3947,6 @@ HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
|
|||
{
|
||||
FT_UShort n;
|
||||
HB_Error error;
|
||||
FT_Memory memory;
|
||||
FT_ULong* ltl;
|
||||
|
||||
HB_ScriptList* sl;
|
||||
|
@ -4042,8 +3958,6 @@ HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub,
|
|||
if ( !gsub || !language_tag_list )
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
memory = gsub->memory;
|
||||
|
||||
sl = &gsub->ScriptList;
|
||||
sr = sl->ScriptRecord;
|
||||
|
||||
|
@ -4077,7 +3991,6 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
|
|||
{
|
||||
FT_UShort n;
|
||||
HB_Error error;
|
||||
FT_Memory memory;
|
||||
FT_ULong* ftl;
|
||||
|
||||
HB_ScriptList* sl;
|
||||
|
@ -4094,8 +4007,6 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub,
|
|||
if ( !gsub || !feature_tag_list )
|
||||
return HB_Err_Invalid_Argument;
|
||||
|
||||
memory = gsub->memory;
|
||||
|
||||
sl = &gsub->ScriptList;
|
||||
sr = sl->ScriptRecord;
|
||||
|
||||
|
@ -4220,18 +4131,17 @@ HB_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st,
|
|||
|
||||
|
||||
void _HB_GSUB_Free_SubTable( HB_GSUB_SubTable* st,
|
||||
FT_Memory memory,
|
||||
FT_UShort lookup_type )
|
||||
{
|
||||
switch ( lookup_type ) {
|
||||
case HB_GSUB_LOOKUP_SINGLE: Free_SingleSubst ( st, memory ); return;
|
||||
case HB_GSUB_LOOKUP_MULTIPLE: Free_MultipleSubst ( st, memory ); return;
|
||||
case HB_GSUB_LOOKUP_ALTERNATE: Free_AlternateSubst ( st, memory ); return;
|
||||
case HB_GSUB_LOOKUP_LIGATURE: Free_LigatureSubst ( st, memory ); return;
|
||||
case HB_GSUB_LOOKUP_CONTEXT: Free_ContextSubst ( st, memory ); return;
|
||||
case HB_GSUB_LOOKUP_CHAIN: Free_ChainContextSubst ( st, memory ); return;
|
||||
/*case HB_GSUB_LOOKUP_EXTENSION: Free_ExtensionSubst ( st, memory ); return;*/
|
||||
case HB_GSUB_LOOKUP_REVERSE_CHAIN: Free_ReverseChainContextSubst ( st, memory ); return;
|
||||
case HB_GSUB_LOOKUP_SINGLE: Free_SingleSubst ( st ); return;
|
||||
case HB_GSUB_LOOKUP_MULTIPLE: Free_MultipleSubst ( st ); return;
|
||||
case HB_GSUB_LOOKUP_ALTERNATE: Free_AlternateSubst ( st ); return;
|
||||
case HB_GSUB_LOOKUP_LIGATURE: Free_LigatureSubst ( st ); return;
|
||||
case HB_GSUB_LOOKUP_CONTEXT: Free_ContextSubst ( st ); return;
|
||||
case HB_GSUB_LOOKUP_CHAIN: Free_ChainContextSubst ( st ); return;
|
||||
/*case HB_GSUB_LOOKUP_EXTENSION: Free_ExtensionSubst ( st ); return;*/
|
||||
case HB_GSUB_LOOKUP_REVERSE_CHAIN: Free_ReverseChainContextSubst ( st ); return;
|
||||
default: return;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,8 +1149,8 @@ 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;
|
||||
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