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