* include/freetype/internal/ftmemory.h: s/new/newsz/ (for C++).
(FT_ALLOC): Remove redundant redefinition. * builds/compiler/gcc-dev.mk (CFLAGS) [g++]: Don't use `-Wstrict-prototypes'. * src/base/ftstream.c (FT_Stream_EnterFrame): Add cast. Formatting, copyright years.
This commit is contained in:
parent
9482ba50b7
commit
c6afa1221a
120
ChangeLog
120
ChangeLog
|
@ -1,53 +1,91 @@
|
|||
2006-05-02 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* include/freetype/internal/ftmemory.h: s/new/newsz/ (for C++).
|
||||
(FT_ALLOC): Remove redundant redefinition.
|
||||
|
||||
* builds/compiler/gcc-dev.mk (CFLAGS) [g++]: Don't use
|
||||
`-Wstrict-prototypes'.
|
||||
|
||||
* src/base/ftstream.c (FT_Stream_EnterFrame): Add cast.
|
||||
|
||||
2006-05-02 David Turner <david@freetype.org>
|
||||
|
||||
* include/freetype/ftstream.h, src/base/ftstream.c: modifying
|
||||
various frame-related functions to report the place where the
|
||||
frames were entered/extracted/exited/released in the memory debugger.
|
||||
* include/freetype/ftstream.h (FT_FRAME_ENTER, FT_FRAME_EXIT,
|
||||
FT_FRAME_EXTRACT, FT_FRAME_RELEASE: Use FT_DEBUG_INNER to report the
|
||||
place where the frames were entered, extracted, exited or released
|
||||
in the memory debugger.
|
||||
|
||||
* include/freetype/internal/ftmemory.h, src/base/ftbitmap.c,
|
||||
src/base/ftmac.c, src/base/ftrfork.c, src/lzw/ftzopen.c,
|
||||
src/raster/ftrend1.c, src/sfnt/ttpost.c, src/truetype/ttgxvar.c,
|
||||
src/type42/t42parse.c, src/winfonts/winfnt.c: hardening the code
|
||||
against out-of-bounds conditions when allocating arrays. This is
|
||||
for the cases where FT_NEW_ARRAY and FT_RENEW_ARRAY are not used
|
||||
already. Introducing the new FT_ALLOC_MULT and FT_REALLOC_MULT
|
||||
macros.
|
||||
* src/base/ftstream.c (FT_Stream_ReleaseFrame) [FT_DEBUG_MEMORY]:
|
||||
Call ft_mem_free.
|
||||
(FT_Stream_EnterFrame) [FT_DEBUG_MEMORY]: Use ft_mem_qalloc.
|
||||
(FT_Stream_ExitFrame) [FT_DEBUG_MEMORY]: Use ft_mem_free.
|
||||
|
||||
|
||||
* include/freetype/fterrdef.h, include/freetype/config/ftconfig.h,
|
||||
include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c,
|
||||
src/base/ftutil.c: udpating the memory management functions and
|
||||
macros to safely deal with array size buffer overflows, this
|
||||
corresponds to attemps to allocate arrays that are too large. For
|
||||
an example, consider the following code:
|
||||
Update the memory management functions and macros to safely deal
|
||||
with array size buffer overflows. This corresponds to attemps to
|
||||
allocate arrays that are too large. For an example, consider the
|
||||
following code:
|
||||
|
||||
count = read_uint32_from_file();
|
||||
array = malloc( sizeof(Item) * count );
|
||||
for ( nn = 0; nn < count; nn++ )
|
||||
array[nn] = read_item_from_file();
|
||||
count = read_uint32_from_file(); array = malloc( sizeof ( Item ) *
|
||||
count ); for ( nn = 0; nn < count; nn++ )
|
||||
array[nn] = read_item_from_file();
|
||||
|
||||
if 'count' is larger than FT_UINT_MAX/sizeof(Item), the multiplication
|
||||
will overflow and the array allocated will be smaller than the data
|
||||
read from the file. In this case, the heap will be trashed, and this
|
||||
can be used as a denial-of-service, or make the engine crash later.
|
||||
If `count' is larger than `FT_UINT_MAX/sizeof(Item)', the
|
||||
multiplication overflows, and the array allocated os smaller than
|
||||
the data read from the file. In this case, the heap will be
|
||||
trashed, and this can be used as a denial-of-service attack, or make
|
||||
the engine crash later.
|
||||
|
||||
the FT_ARRAY_NEW and FT_ARRAY_RENEW macro now check that the new
|
||||
count is no more than FT_INT_MAX/item_size, otherwise, a new error,
|
||||
named 'FT_Err_Array_Too_Large' will be returned.
|
||||
The FT_ARRAY_NEW and FT_ARRAY_RENEW macros now ensure that the new
|
||||
count is no larger than `FT_INT_MAX/item_size', otherwise a new
|
||||
error code `FT_Err_Array_Too_Large' will be returned.
|
||||
|
||||
note that the memory debugger now works again when FT_DEBUG_MEMORY
|
||||
is defined, and FT_STRICT_ALIASING has disappeared, the corresponding
|
||||
code being now the default.
|
||||
Note that the memory debugger now works again when FT_DEBUG_MEMORY
|
||||
is defined. FT_STRICT_ALIASING has disappeared; the corresponding
|
||||
code is now the default.
|
||||
|
||||
|
||||
2006-04-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
* include/freetype/config/ftconfig.h (FT_BASE_DEF) [!__cplusplus]:
|
||||
Don't use `extern'.
|
||||
|
||||
Fix bug in Mac_Read_POST_Resource() to parse PFB font with MacOS
|
||||
resource fork (bug since 2003-09-11). Patch is provided by
|
||||
Huib-Jan Imbens <ft@imbens.nl>.
|
||||
* include/freetype/fterrdef.h (FT_Err_Array_Too_Large): New error
|
||||
code.
|
||||
|
||||
* src/base/ftobjs.c: fix pfb_pos initialization, remove extra cast
|
||||
to copy to pfb_lenpos.
|
||||
* include/freetype/internal/ftmemory.h (FT_DEBUG_INNER)
|
||||
[FT_DEBUG_MEMORY]: New macro.
|
||||
(ft_mem_realloc, ft_mem_qrealloc): Pass new object size count also.
|
||||
(ft_mem_alloc_debug, ft_mem_qalloc_debug, ft_mem_realloc_debug,
|
||||
ft_mem_qrealloc_debug, ft_mem_free_debug): Removed.
|
||||
(FT_MEM_ALLOC, FT_MEM_REALLOC, FT_MEM_QALLOC, FT_MEM_QREALLOC,
|
||||
FT_MEM_FREE): Redefine.
|
||||
(FT_MEM_NEW_ARRAY, FT_MEM_RENEW_ARRAY, FT_MEM_QNEW_ARRAY,
|
||||
FT_MEM_QRENEW_ARRAY): Redefine.
|
||||
(FT_ALLOC_MULT, FT_REALLOC_MULT, FT_MEM_QALLOC_MULT,
|
||||
FT_MEM_QREALLOC_MULT): New macros. Update callers where
|
||||
appropriate.
|
||||
(FT_MEM_SET_ERROR): Slightly redefine.
|
||||
|
||||
|
||||
* src/base/ftdbgmem.c (_ft_debug_file, _ft_debug_lineno)
|
||||
[FT_DEBUG_MEMORY]: New global variables, replacing...
|
||||
(FT_MemTable_Rec) [FT_DEBUG_MEMORY]: Remove `filename' and
|
||||
`line_no'. Update all callers.
|
||||
(ft_mem_debug_alloc) [FT_DEBUG_MEMORY]: Avoid possible integer
|
||||
overflow.
|
||||
(ft_mem_alloc_debug, ft_mem_realloc_debug, ft_mem_qalloc_debug,
|
||||
ft_mem_qrealloc_debug, ft_mem_free_debug): Removed.
|
||||
|
||||
* src/base/ftmac.c (read_lwfn): Catch integer overflow.
|
||||
* src/base/ftrfork.c (raccess_guess_darwin_hfsplus): Ditto.
|
||||
* src/base/ftutil.c: Remove special code for FT_STRICT_ALIASING.
|
||||
(ft_mem_alloc. ft_mem_realloc, ft_mem_qrealloc): Rewrite.
|
||||
|
||||
2006-04-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
|
||||
* src/base/ftobjs.c (Mac_Read_POST_Resource): Correct pfb_pos
|
||||
initialization, remove extra cast to copy to pfb_lenpos. This fixes
|
||||
parsing of PFB fonts with MacOS resource fork (bug introduced
|
||||
2003-09-11). Patch provided by Huib-Jan Imbens <ft@imbens.nl>.
|
||||
|
||||
2006-04-29 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
|
@ -82,7 +120,7 @@
|
|||
|
||||
|
||||
* Version 2.2 released.
|
||||
=======================
|
||||
=======================
|
||||
|
||||
|
||||
Tag sources with `VER-2-2-0'.
|
||||
|
@ -185,7 +223,7 @@
|
|||
2006-03-23 David Turner <david@freetype.org>
|
||||
|
||||
Add FT_Get_SubGlyph_Info API to retrieve subglyph data. Note that
|
||||
we do not expose the FT_SubGlyphRec structure.
|
||||
we do not expose the FT_SubGlyphRec structure.
|
||||
|
||||
* include/freetype/internal/ftgloadr.h (FT_SUBGLYPH_FLAGS_*): Moved
|
||||
to...
|
||||
|
@ -196,7 +234,7 @@
|
|||
|
||||
|
||||
* src/autofit/afloader.c (af_loader_load_g): Compute lsb_delta and
|
||||
rsb_delta correctly in edge cases.
|
||||
rsb_delta correctly in edge cases.
|
||||
|
||||
2006-03-22 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
|
@ -363,7 +401,7 @@
|
|||
order so that type42 module is removed before truetype module. This
|
||||
avoids double free in some occasions.
|
||||
|
||||
2006-02-28 David Turner <david@freetype.org>
|
||||
2006-02-28 David Turner <david@freetype.org>
|
||||
|
||||
* Release candidate VER-2-2-0-RC4.
|
||||
----------------------------------
|
||||
|
|
|
@ -64,7 +64,8 @@ T := -o$(space)
|
|||
#
|
||||
ifndef CFLAGS
|
||||
ifeq ($(findstring g++,$(CC)),)
|
||||
nested_externs := -Wnested-externs
|
||||
nested_externs := -Wnested-externs
|
||||
strict_prototypes := -Wstrict-prototypes
|
||||
endif
|
||||
|
||||
CFLAGS := -c -g -O0 \
|
||||
|
@ -74,10 +75,10 @@ ifndef CFLAGS
|
|||
-Wshadow \
|
||||
-Wpointer-arith \
|
||||
-Wwrite-strings \
|
||||
-Wstrict-prototypes \
|
||||
-Wredundant-decls \
|
||||
-Wno-long-long \
|
||||
$(nested_externs)
|
||||
$(nested_externs) \
|
||||
$(strict_prototypes)
|
||||
endif
|
||||
|
||||
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
|
||||
|
|
|
@ -265,7 +265,7 @@ FT_BEGIN_HEADER
|
|||
#ifndef FT_BASE_DEF
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define FT_BASE_DEF( x ) extern "C" x
|
||||
#define FT_BASE_DEF( x ) x
|
||||
#else
|
||||
#define FT_BASE_DEF( x ) x
|
||||
#endif
|
||||
|
|
|
@ -59,16 +59,19 @@ FT_BEGIN_HEADER
|
|||
|
||||
#ifdef FT_DEBUG_MEMORY
|
||||
|
||||
FT_BASE( const char* ) _ft_debug_file;
|
||||
FT_BASE( long ) _ft_debug_lineno;
|
||||
FT_BASE( const char* ) _ft_debug_file;
|
||||
FT_BASE( long ) _ft_debug_lineno;
|
||||
|
||||
# define FT_DEBUG_INNER(exp) ( _ft_debug_file = __FILE__, _ft_debug_lineno = __LINE__, (exp) )
|
||||
#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \
|
||||
_ft_debug_lineno = __LINE__, \
|
||||
(exp) )
|
||||
|
||||
#else /* !FT_DEBUG_MEMORY */
|
||||
|
||||
# define FT_DEBUG_INNER(exp) (exp)
|
||||
#define FT_DEBUG_INNER( exp ) (exp)
|
||||
|
||||
#endif /* !FT_DEBUG_MEMORY */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The allocation functions return a pointer, and the error code
|
||||
|
@ -107,51 +110,61 @@ FT_BASE( long ) _ft_debug_lineno;
|
|||
const void* P );
|
||||
|
||||
|
||||
#define FT_MEM_ALLOC(ptr,size) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_alloc( memory, (size), &error ) )
|
||||
#define FT_MEM_ALLOC( ptr, size ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_alloc( memory, (size), &error ) )
|
||||
|
||||
#define FT_MEM_FREE(ptr) \
|
||||
FT_BEGIN_STMNT \
|
||||
ft_mem_free( memory, (ptr) ); \
|
||||
(ptr) = NULL; \
|
||||
FT_END_STMNT
|
||||
#define FT_MEM_FREE( ptr ) \
|
||||
FT_BEGIN_STMNT \
|
||||
ft_mem_free( memory, (ptr) ); \
|
||||
(ptr) = NULL; \
|
||||
FT_END_STMNT
|
||||
|
||||
#define FT_MEM_NEW(ptr) \
|
||||
FT_MEM_ALLOC( ptr, sizeof(*(ptr)) )
|
||||
#define FT_MEM_NEW( ptr ) \
|
||||
FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
|
||||
|
||||
#define FT_MEM_REALLOC( ptr, cur, new ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, 1, (cur), (new), (ptr), &error ) )
|
||||
#define FT_MEM_REALLOC( ptr, cursz, newsz ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, 1, \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
|
||||
#define FT_MEM_QALLOC(ptr,size) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qalloc( memory, (size), &error ) )
|
||||
#define FT_MEM_QALLOC( ptr, size ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qalloc( memory, (size), &error ) )
|
||||
|
||||
#define FT_MEM_QNEW(ptr) \
|
||||
FT_MEM_QALLOC( ptr, sizeof(*(ptr)) )
|
||||
#define FT_MEM_QNEW( ptr ) \
|
||||
FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
|
||||
|
||||
#define FT_MEM_QREALLOC( ptr, cur, new ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, 1, (cur), (new), (ptr), &error ) )
|
||||
#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, 1, \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
|
||||
#define FT_MEM_QRENEW_ARRAY(ptr,cur,new) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof(*(ptr)), (cur), (new), (ptr), &error ) )
|
||||
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
|
||||
#define FT_MEM_ALLOC_MULT(ptr,count,item_size) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (item_size), 0, (count), NULL, &error ) )
|
||||
#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (item_size), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
|
||||
#define FT_MEM_REALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (itmsz), (oldcnt), (newcnt), (ptr), &error ) )
|
||||
#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (itmsz), \
|
||||
(oldcnt), (newcnt), \
|
||||
(ptr), &error ) )
|
||||
|
||||
#define FT_MEM_QALLOC_MULT(ptr,count,item_size) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (item_size), 0, (count), NULL, &error ) )
|
||||
#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (item_size), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
|
||||
#define FT_MEM_QREALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (itmsz), (oldcnt), (newcnt), (ptr), &error ) )
|
||||
#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (itmsz), \
|
||||
(oldcnt), (newcnt), \
|
||||
(ptr), &error ) )
|
||||
|
||||
|
||||
#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
|
||||
|
||||
|
||||
#define FT_ALLOC(ptr,size) FT_MEM_SET_ERROR( FT_MEM_ALLOC(ptr,size) )
|
||||
|
||||
#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
|
||||
|
||||
|
||||
#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count )
|
||||
|
@ -192,63 +205,71 @@ FT_BASE( long ) _ft_debug_lineno;
|
|||
/* _typed_ in order to automatically compute array element sizes. */
|
||||
/* */
|
||||
|
||||
#define FT_MEM_NEW_ARRAY(ptr,count) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof(*(ptr)), 0, (count), NULL, &error ) )
|
||||
#define FT_MEM_NEW_ARRAY( ptr, count ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof ( *(ptr) ), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
|
||||
#define FT_MEM_RENEW_ARRAY(ptr,cur,new) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof(*(ptr)), (cur), (new), (ptr), &error ) )
|
||||
#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof ( *(ptr) ), \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
|
||||
#define FT_MEM_QNEW_ARRAY(ptr,count) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof(*(ptr)), 0, (count), NULL, &error ) )
|
||||
#define FT_MEM_QNEW_ARRAY( ptr, count ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
|
||||
#define FT_MEM_QRENEW_ARRAY(ptr,cur,new) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof(*(ptr)), (cur), (new), (ptr), &error ) )
|
||||
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
|
||||
|
||||
#define FT_ALLOC(ptr,size) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_ALLOC(ptr,size) )
|
||||
#define FT_ALLOC( ptr, size ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
|
||||
|
||||
#define FT_REALLOC(ptr,cursz,newsz) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_REALLOC(ptr,cursz,newsz) )
|
||||
#define FT_REALLOC( ptr, cursz, newsz ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )
|
||||
|
||||
#define FT_ALLOC_MULT(ptr,count,item_size) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT(ptr,count,item_size) )
|
||||
#define FT_ALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )
|
||||
|
||||
#define FT_REALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT(ptr,oldcnt,newcnt,itmsz) )
|
||||
#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \
|
||||
newcnt, itmsz ) )
|
||||
|
||||
#define FT_QALLOC(ptr,size) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QALLOC(ptr,size) )
|
||||
#define FT_QALLOC( ptr, size ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )
|
||||
|
||||
#define FT_QREALLOC(ptr,cursz,newsz) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QREALLOC(ptr,cursz,newsz) )
|
||||
#define FT_QREALLOC( ptr, cursz, newsz ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )
|
||||
|
||||
#define FT_QALLOC_MULT(ptr,count,item_size) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT(ptr,count,item_size) )
|
||||
#define FT_QALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )
|
||||
|
||||
#define FT_QREALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT(ptr,oldcnt,newcnt,itmsz) )
|
||||
#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \
|
||||
newcnt, itmsz ) )
|
||||
|
||||
#define FT_FREE(ptr) FT_MEM_FREE( ptr )
|
||||
#define FT_FREE( ptr ) FT_MEM_FREE( ptr )
|
||||
|
||||
#define FT_NEW(ptr) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_NEW(ptr) )
|
||||
#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )
|
||||
|
||||
#define FT_NEW_ARRAY(ptr,count) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY(ptr,count) )
|
||||
#define FT_NEW_ARRAY( ptr, count ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
|
||||
|
||||
#define FT_RENEW_ARRAY(ptr,curcnt,newcnt) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY(ptr,curcnt,newcnt) )
|
||||
#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
|
||||
|
||||
#define FT_QNEW(ptr) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QNEW(ptr) )
|
||||
#define FT_QNEW( ptr ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )
|
||||
|
||||
#define FT_QNEW_ARRAY(ptr,count) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY(ptr,count) )
|
||||
|
||||
#define FT_QRENEW_ARRAY(ptr,curcnt,newcnt) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY(ptr,curcnt,newcnt) )
|
||||
#define FT_QNEW_ARRAY( ptr, count ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
|
||||
|
||||
#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
|
@ -274,6 +295,7 @@ FT_BASE( long ) _ft_debug_lineno;
|
|||
FT_Long current,
|
||||
FT_Long size,
|
||||
void* *p );
|
||||
|
||||
FT_BASE( void )
|
||||
FT_Free( FT_Memory memory,
|
||||
void* *P );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* Stream handling (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001, 2002, 2004, 2005 by */
|
||||
/* Copyright 1996-2001, 2002, 2004, 2005, 2006 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -514,19 +514,21 @@ FT_BEGIN_HEADER
|
|||
FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
|
||||
|
||||
|
||||
#define FT_FRAME_ENTER( size ) \
|
||||
FT_SET_ERROR( FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
|
||||
#define FT_FRAME_ENTER( size ) \
|
||||
FT_SET_ERROR( \
|
||||
FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
|
||||
|
||||
#define FT_FRAME_EXIT() \
|
||||
FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
|
||||
|
||||
#define FT_FRAME_EXTRACT( size, bytes ) \
|
||||
FT_SET_ERROR( \
|
||||
FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \
|
||||
(FT_Byte**)&(bytes) ) ) )
|
||||
#define FT_FRAME_EXTRACT( size, bytes ) \
|
||||
FT_SET_ERROR( \
|
||||
FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \
|
||||
(FT_Byte**)&(bytes) ) ) )
|
||||
|
||||
#define FT_FRAME_RELEASE( bytes ) \
|
||||
FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) ) )
|
||||
#define FT_FRAME_RELEASE( bytes ) \
|
||||
FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \
|
||||
(FT_Byte**)&(bytes) ) )
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
|
@ -50,10 +50,11 @@
|
|||
|
||||
#define FT_MEM_VAL( addr ) ((FT_ULong)(FT_Pointer)( addr ))
|
||||
|
||||
/* this structure holds statistics for a single allocation/release
|
||||
* site. This is useful to know where memory operations happen the
|
||||
* most.
|
||||
*/
|
||||
/*
|
||||
* This structure holds statistics for a single allocation/release
|
||||
* site. This is useful to know where memory operations happen the
|
||||
* most.
|
||||
*/
|
||||
typedef struct FT_MemSourceRec_
|
||||
{
|
||||
const char* file_name;
|
||||
|
@ -81,12 +82,13 @@
|
|||
*/
|
||||
#define FT_MEM_SOURCE_BUCKETS 128
|
||||
|
||||
/* this structure holds information related to a single allocated
|
||||
* memory block. if KEEPALIVE is defined, blocks that are freed by
|
||||
* FreeType are never released to the system. Instead, their 'size'
|
||||
* field is set to -size. This is mainly useful to detect double frees,
|
||||
* at the price of large memory footprint during execution !!
|
||||
*/
|
||||
/*
|
||||
* This structure holds information related to a single allocated
|
||||
* memory block. If KEEPALIVE is defined, blocks that are freed by
|
||||
* FreeType are never released to the system. Instead, their `size'
|
||||
* field is set to -size. This is mainly useful to detect double frees,
|
||||
* at the price of large memory footprint during execution.
|
||||
*/
|
||||
typedef struct FT_MemNodeRec_
|
||||
{
|
||||
FT_Byte* address;
|
||||
|
@ -104,9 +106,10 @@
|
|||
} FT_MemNodeRec;
|
||||
|
||||
|
||||
/* the global structure, containing compound statistics and all hash
|
||||
* tables
|
||||
*/
|
||||
/*
|
||||
* The global structure, containing compound statistics and all hash
|
||||
* tables.
|
||||
*/
|
||||
typedef struct FT_MemTableRec_
|
||||
{
|
||||
FT_ULong size;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* I/O stream support (body). */
|
||||
/* */
|
||||
/* Copyright 2000-2001, 2002, 2004, 2005 by */
|
||||
/* Copyright 2000-2001, 2002, 2004, 2005, 2006 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -241,7 +241,7 @@
|
|||
|
||||
#ifdef FT_DEBUG_MEMORY
|
||||
/* assume _ft_debug_file and _ft_debug_lineno are already set */
|
||||
stream->base = ft_mem_qalloc( memory, count, &error );
|
||||
stream->base = (unsigned char*)ft_mem_qalloc( memory, count, &error );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
#else
|
||||
|
|
|
@ -98,10 +98,11 @@
|
|||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
block = ft_mem_qrealloc( memory, item_size, cur_count, new_count, block, &error );
|
||||
block = ft_mem_qrealloc( memory, item_size,
|
||||
cur_count, new_count, block, &error );
|
||||
if ( !error && new_count > cur_count )
|
||||
FT_MEM_ZERO( (char*)block + cur_count*item_size,
|
||||
(new_count-cur_count)*item_size );
|
||||
FT_MEM_ZERO( (char*)block + cur_count * item_size,
|
||||
( new_count - cur_count ) * item_size );
|
||||
|
||||
*p_error = error;
|
||||
return block;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
/* be used to parse compressed PCF fonts, as found with many X11 server */
|
||||
/* distributions. */
|
||||
/* */
|
||||
/* Copyright 2005 by David Turner. */
|
||||
/* Copyright 2005, 2006 by David Turner. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
|
@ -128,7 +128,7 @@
|
|||
*
|
||||
*/
|
||||
if ( FT_REALLOC_MULT( state->prefix, old_size, new_size,
|
||||
sizeof(FT_UShort)+sizeof(FT_Byte) ) )
|
||||
sizeof ( FT_UShort ) + sizeof ( FT_Byte ) ) )
|
||||
return -1;
|
||||
|
||||
/* now adjust `suffix' and move the data accordingly */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* The FreeType glyph rasterizer interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2005 by */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* TrueType GX Font Variation loader */
|
||||
/* */
|
||||
/* Copyright 2004, 2005 by */
|
||||
/* Copyright 2004, 2005, 2006 by */
|
||||
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/* */
|
||||
/* Type 42 font parser (body). */
|
||||
/* */
|
||||
/* Copyright 2002, 2003, 2004, 2005 by Roberto Alameda. */
|
||||
/* Copyright 2002, 2003, 2004, 2005, 2006 by Roberto Alameda. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
|
|
Loading…
Reference in New Issue