summaryrefslogtreecommitdiff
path: root/src/truetype/ttinterp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/truetype/ttinterp.c')
-rw-r--r--src/truetype/ttinterp.c107
1 files changed, 24 insertions, 83 deletions
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 69d01001f..8cf66ebae 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -278,57 +278,6 @@
/**************************************************************************
*
* @Function:
- * Update_Max
- *
- * @Description:
- * Checks the size of a buffer and reallocates it if necessary.
- *
- * @Input:
- * memory ::
- * A handle to the parent memory object.
- *
- * multiplier ::
- * The size in bytes of each element in the buffer.
- *
- * new_max ::
- * The new capacity (size) of the buffer.
- *
- * @InOut:
- * size ::
- * The address of the buffer's current size expressed
- * in elements.
- *
- * buff ::
- * The address of the buffer base pointer.
- *
- * @Return:
- * FreeType error code. 0 means success.
- */
- FT_LOCAL_DEF( FT_Error )
- Update_Max( FT_Memory memory,
- FT_ULong* size,
- FT_ULong multiplier,
- void* _pbuff,
- FT_ULong new_max )
- {
- FT_Error error;
- void** pbuff = (void**)_pbuff;
-
-
- if ( *size < new_max )
- {
- if ( FT_QREALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
- return error;
- *size = new_max;
- }
-
- return FT_Err_Ok;
- }
-
-
- /**************************************************************************
- *
- * @Function:
* TT_Load_Context
*
* @Description:
@@ -359,9 +308,9 @@
TT_Size size )
{
FT_Int i;
- FT_ULong tmp;
TT_MaxProfile* maxp;
FT_Error error;
+ FT_Memory memory = exec->memory;
exec->face = face;
@@ -406,25 +355,15 @@
/* XXX: We reserve a little more elements on the stack to deal safely */
/* with broken fonts like arialbs, courbs, timesbs, etc. */
- tmp = (FT_ULong)exec->stackSize;
- error = Update_Max( exec->memory,
- &tmp,
- sizeof ( FT_F26Dot6 ),
- (void*)&exec->stack,
- maxp->maxStackElements + 32 );
- exec->stackSize = (FT_Long)tmp;
- if ( error )
+ if ( FT_QRENEW_ARRAY( exec->stack,
+ exec->stackSize,
+ maxp->maxStackElements + 32 ) )
return error;
+ exec->stackSize = maxp->maxStackElements + 32;
- tmp = (FT_ULong)exec->glyphSize;
- error = Update_Max( exec->memory,
- &tmp,
- sizeof ( FT_Byte ),
- (void*)&exec->glyphIns,
- maxp->maxSizeOfInstructions );
- exec->glyphSize = (FT_UInt)tmp;
- if ( error )
- return error;
+ /* free previous glyph code range */
+ FT_FREE( exec->glyphIns );
+ exec->glyphSize = 0;
exec->pts.n_points = 0;
exec->pts.n_contours = 0;
@@ -1530,14 +1469,16 @@
if ( exc->iniRange == tt_coderange_glyph &&
exc->cvt != exc->glyfCvt )
{
- exc->error = Update_Max( exc->memory,
- &exc->glyfCvtSize,
- sizeof ( FT_Long ),
- (void*)&exc->glyfCvt,
- exc->cvtSize );
- if ( exc->error )
+ FT_Memory memory = exc->memory;
+ FT_Error error;
+
+
+ FT_MEM_QRENEW_ARRAY( exc->glyfCvt, exc->glyfCvtSize, exc->cvtSize );
+ exc->error = error;
+ if ( error )
return;
+ exc->glyfCvtSize = exc->cvtSize;
FT_ARRAY_COPY( exc->glyfCvt, exc->cvt, exc->glyfCvtSize );
exc->cvt = exc->glyfCvt;
}
@@ -3117,18 +3058,18 @@
if ( exc->iniRange == tt_coderange_glyph &&
exc->storage != exc->glyfStorage )
{
- FT_ULong tmp = (FT_ULong)exc->glyfStoreSize;
+ FT_Memory memory = exc->memory;
+ FT_Error error;
- exc->error = Update_Max( exc->memory,
- &tmp,
- sizeof ( FT_Long ),
- (void*)&exc->glyfStorage,
- exc->storeSize );
- exc->glyfStoreSize = (FT_UShort)tmp;
- if ( exc->error )
+ FT_MEM_QRENEW_ARRAY( exc->glyfStorage,
+ exc->glyfStoreSize,
+ exc->storeSize );
+ exc->error = error;
+ if ( error )
return;
+ exc->glyfStoreSize = exc->storeSize;
FT_ARRAY_COPY( exc->glyfStorage, exc->storage, exc->glyfStoreSize );
exc->storage = exc->glyfStorage;
}