Align FreeType with standard C memory management.

* include/freetype/ftsystem.h: Include FT_TYPES_H.
(*FT_Alloc_Func, *FT_Realloc_Func): Use size_t for the size arguments.
* src/raster/ftmisc.h: Ditto.

* builds/amiga/src/base/ftsystem.c, builds/unix/ftsystem.c,
* builds/vms/ftsystem.c, src/base/ftsystem.c (ft_alloc, ft_realloc):
Use size_t for the size arguments.

* src/base/ftdbgmem.c (ft_mem_debug_alloc, ft_mem_debug_realloc): Use
FT_Offset, aka size_t, for the size arguments.
This commit is contained in:
Alexei Podtelezhnikov 2018-09-27 21:17:36 -04:00
parent 4500c701c2
commit 877aa1b2cc
8 changed files with 43 additions and 24 deletions

View File

@ -1,3 +1,18 @@
2018-09-27 Alexei Podtelezhnikov <apodtele@gmail.com>
Align FreeType with standard C memory management.
* include/freetype/ftsystem.h: Include FT_TYPES_H.
(*FT_Alloc_Func, *FT_Realloc_Func): Use size_t for the size arguments.
* src/raster/ftmisc.h: Ditto.
* builds/amiga/src/base/ftsystem.c, builds/unix/ftsystem.c,
* builds/vms/ftsystem.c, src/base/ftsystem.c (ft_alloc, ft_realloc):
Use size_t for the size arguments.
* src/base/ftdbgmem.c (ft_mem_debug_alloc, ft_mem_debug_realloc): Use
FT_Offset, aka size_t, for the size arguments.
2018-09-25 Werner Lemberg <wl@gnu.org> 2018-09-25 Werner Lemberg <wl@gnu.org>
Fix handling of `FT_Bool'. Fix handling of `FT_Bool'.
@ -39,7 +54,7 @@
* src/base/ftobjs.c (ft_glyphslot_preset_bimap): Another tweak. * src/base/ftobjs.c (ft_glyphslot_preset_bimap): Another tweak.
This one should be clearer. When the rounded monochrome bbox collapses This one should be clearer. When the rounded monochrome bbox collapses
we add a pixel that covers most if not all original cbox. we add a pixel that covers most if not all original cbox.
2018-09-21 Alexei Podtelezhnikov <apodtele@gmail.com> 2018-09-21 Alexei Podtelezhnikov <apodtele@gmail.com>

View File

@ -139,7 +139,7 @@ Free_VecPooled( APTR poolHeader,
/* */ /* */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory, ft_alloc( FT_Memory memory,
long size ) size_t size )
{ {
#ifdef __amigaos4__ #ifdef __amigaos4__
return AllocVecPooled( memory->user, size ); return AllocVecPooled( memory->user, size );
@ -171,8 +171,8 @@ Free_VecPooled( APTR poolHeader,
/* */ /* */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory, ft_realloc( FT_Memory memory,
long cur_size, size_t cur_size,
long new_size, size_t new_size,
void* block ) void* block )
{ {
void* new_block; void* new_block;

View File

@ -95,7 +95,7 @@
/* */ /* */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory, ft_alloc( FT_Memory memory,
long size ) size_t size )
{ {
FT_UNUSED( memory ); FT_UNUSED( memory );
@ -125,8 +125,8 @@
/* */ /* */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory, ft_realloc( FT_Memory memory,
long cur_size, size_t cur_size,
long new_size, size_t new_size,
void* block ) void* block )
{ {
FT_UNUSED( memory ); FT_UNUSED( memory );

View File

@ -94,7 +94,7 @@
/* */ /* */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory, ft_alloc( FT_Memory memory,
long size ) size_t size )
{ {
FT_UNUSED( memory ); FT_UNUSED( memory );
@ -124,8 +124,8 @@
/* */ /* */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory, ft_realloc( FT_Memory memory,
long cur_size, size_t cur_size,
long new_size, size_t new_size,
void* block ) void* block )
{ {
FT_UNUSED( memory ); FT_UNUSED( memory );

View File

@ -21,6 +21,7 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_TYPES_H
FT_BEGIN_HEADER FT_BEGIN_HEADER
@ -86,7 +87,7 @@ FT_BEGIN_HEADER
*/ */
typedef void* typedef void*
(*FT_Alloc_Func)( FT_Memory memory, (*FT_Alloc_Func)( FT_Memory memory,
long size ); size_t size );
/************************************************************************** /**************************************************************************
@ -140,8 +141,8 @@ FT_BEGIN_HEADER
*/ */
typedef void* typedef void*
(*FT_Realloc_Func)( FT_Memory memory, (*FT_Realloc_Func)( FT_Memory memory,
long cur_size, size_t cur_size,
long new_size, size_t new_size,
void* block ); void* block );

View File

@ -676,10 +676,11 @@
static FT_Pointer static FT_Pointer
ft_mem_debug_alloc( FT_Memory memory, ft_mem_debug_alloc( FT_Memory memory,
FT_Long size ) FT_Offset size_ )
{ {
FT_MemTable table = (FT_MemTable)memory->user; FT_MemTable table = (FT_MemTable)memory->user;
FT_Byte* block; FT_Byte* block;
FT_Long size = (FT_Long)size_;
if ( size <= 0 ) if ( size <= 0 )
@ -736,14 +737,16 @@
static FT_Pointer static FT_Pointer
ft_mem_debug_realloc( FT_Memory memory, ft_mem_debug_realloc( FT_Memory memory,
FT_Long cur_size, FT_Offset cur_size_,
FT_Long new_size, FT_Offset new_size_,
FT_Pointer block ) FT_Pointer block )
{ {
FT_MemTable table = (FT_MemTable)memory->user; FT_MemTable table = (FT_MemTable)memory->user;
FT_MemNode node, *pnode; FT_MemNode node, *pnode;
FT_Pointer new_block; FT_Pointer new_block;
FT_Long delta; FT_Long delta;
FT_Long cur_size = (FT_Long)cur_size_;
FT_Long new_size = (FT_Long)new_size_;
const char* file_name = FT_FILENAME( _ft_debug_file ); const char* file_name = FT_FILENAME( _ft_debug_file );
FT_Long line_no = _ft_debug_lineno; FT_Long line_no = _ft_debug_lineno;

View File

@ -69,11 +69,11 @@
*/ */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory, ft_alloc( FT_Memory memory,
long size ) size_t size )
{ {
FT_UNUSED( memory ); FT_UNUSED( memory );
return ft_smalloc( (size_t)size ); return ft_smalloc( size );
} }
@ -103,14 +103,14 @@
*/ */
FT_CALLBACK_DEF( void* ) FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory, ft_realloc( FT_Memory memory,
long cur_size, size_t cur_size,
long new_size, size_t new_size,
void* block ) void* block )
{ {
FT_UNUSED( memory ); FT_UNUSED( memory );
FT_UNUSED( cur_size ); FT_UNUSED( cur_size );
return ft_srealloc( block, (size_t)new_size ); return ft_srealloc( block, new_size );
} }

View File

@ -59,14 +59,14 @@
typedef struct FT_MemoryRec_* FT_Memory; typedef struct FT_MemoryRec_* FT_Memory;
typedef void* (*FT_Alloc_Func)( FT_Memory memory, typedef void* (*FT_Alloc_Func)( FT_Memory memory,
long size ); size_t size );
typedef void (*FT_Free_Func)( FT_Memory memory, typedef void (*FT_Free_Func)( FT_Memory memory,
void* block ); void* block );
typedef void* (*FT_Realloc_Func)( FT_Memory memory, typedef void* (*FT_Realloc_Func)( FT_Memory memory,
long cur_size, size_t cur_size,
long new_size, size_t new_size,
void* block ); void* block );
typedef struct FT_MemoryRec_ typedef struct FT_MemoryRec_