* src/psaux/psobjs.c (shift_elements): Remove if clause (which is

obsolete now).

(reallocate_t1_table, PS_Table_Done): Replace REALLOC() with ALLOC()
+ MEM_Copy() to avoid a memory bug.
This commit is contained in:
Werner Lemberg 2001-02-03 04:34:53 +00:00
parent 3b5915dee7
commit a15e07e31c
2 changed files with 30 additions and 19 deletions

View File

@ -1,3 +1,11 @@
2001-02-02 Werner Lemberg <wl@gnu.org>
* src/psaux/psobjs.c (shift_elements): Remove if clause (which is
obsolete now).
(reallocate_t1_table, PS_Table_Done): Replace REALLOC() with ALLOC()
+ MEM_Copy() to avoid a memory bug.
2001-02-01 David Turner <david.turner@freetype.org>
* docs/docmaker.py: Improved the index sorting routine to place

View File

@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
/* Copyright 1996-2000 by */
/* Copyright 1996-2001 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -89,12 +89,11 @@
FT_Byte** limit = offset + table->max_elems;
if ( delta )
for ( ; offset < limit; offset++ )
{
if ( offset[0] )
offset[0] += delta;
}
for ( ; offset < limit; offset++ )
{
if ( offset[0] )
offset[0] += delta;
}
}
@ -107,15 +106,19 @@
FT_Error error;
/* reallocate the base block */
if ( REALLOC( table->block, table->capacity, new_size ) )
/* allocate new base block */
if ( ALLOC( table->block, new_size ) )
return error;
table->capacity = new_size;
/* shift all offsets if necessary */
if ( old_base )
/* copy elements and shift offsets */
if (old_base )
{
MEM_Copy( table->block, old_base, table->capacity );
shift_elements( table, old_base );
FREE( old_base );
}
table->capacity = new_size;
return FT_Err_Ok;
}
@ -200,20 +203,20 @@
{
FT_Memory memory = table->memory;
FT_Error error;
FT_Byte* old_base;
FT_Byte* old_base = table->block;
/* should never fail, because rec.cursor <= rec.size */
old_base = table->block;
if ( !old_base )
return;
if ( REALLOC( table->block, table->capacity, table->cursor ) )
if ( ALLOC( table->block, table->cursor ) )
return;
table->capacity = table->cursor;
MEM_Copy( table->block, old_base, table->cursor );
shift_elements( table, old_base );
if ( old_base != table->block )
shift_elements( table, old_base );
table->capacity = table->cursor;
FREE( old_base );
}