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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
diff --git a/ChangeLog b/ChangeLog
index 201d1ca..0b8da23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
Fix handling of `FT_Bool'.
@@ -39,7 +54,7 @@
* src/base/ftobjs.c (ft_glyphslot_preset_bimap): Another tweak.
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>
diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c
index 53abdb0..031bd29 100644
--- a/builds/amiga/src/base/ftsystem.c
+++ b/builds/amiga/src/base/ftsystem.c
@@ -139,7 +139,7 @@ Free_VecPooled( APTR poolHeader,
/* */
FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory,
- long size )
+ size_t size )
{
#ifdef __amigaos4__
return AllocVecPooled( memory->user, size );
@@ -171,8 +171,8 @@ Free_VecPooled( APTR poolHeader,
/* */
FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory,
- long cur_size,
- long new_size,
+ size_t cur_size,
+ size_t new_size,
void* block )
{
void* new_block;
diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c
index 449c0ed..8e70988 100644
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -95,7 +95,7 @@
/* */
FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory,
- long size )
+ size_t size )
{
FT_UNUSED( memory );
@@ -125,8 +125,8 @@
/* */
FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory,
- long cur_size,
- long new_size,
+ size_t cur_size,
+ size_t new_size,
void* block )
{
FT_UNUSED( memory );
diff --git a/builds/vms/ftsystem.c b/builds/vms/ftsystem.c
index 71aab35..51a7a3f 100644
--- a/builds/vms/ftsystem.c
+++ b/builds/vms/ftsystem.c
@@ -94,7 +94,7 @@
/* */
FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory,
- long size )
+ size_t size )
{
FT_UNUSED( memory );
@@ -124,8 +124,8 @@
/* */
FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory,
- long cur_size,
- long new_size,
+ size_t cur_size,
+ size_t new_size,
void* block )
{
FT_UNUSED( memory );
diff --git a/include/freetype/ftsystem.h b/include/freetype/ftsystem.h
index d6947f5..810b7b8 100644
--- a/include/freetype/ftsystem.h
+++ b/include/freetype/ftsystem.h
@@ -21,6 +21,7 @@
#include <ft2build.h>
+#include FT_TYPES_H
FT_BEGIN_HEADER
@@ -86,7 +87,7 @@ FT_BEGIN_HEADER
*/
typedef void*
(*FT_Alloc_Func)( FT_Memory memory,
- long size );
+ size_t size );
/**************************************************************************
@@ -140,8 +141,8 @@ FT_BEGIN_HEADER
*/
typedef void*
(*FT_Realloc_Func)( FT_Memory memory,
- long cur_size,
- long new_size,
+ size_t cur_size,
+ size_t new_size,
void* block );
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 6e0a074..0354a1f 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -676,10 +676,11 @@
static FT_Pointer
ft_mem_debug_alloc( FT_Memory memory,
- FT_Long size )
+ FT_Offset size_ )
{
FT_MemTable table = (FT_MemTable)memory->user;
FT_Byte* block;
+ FT_Long size = (FT_Long)size_;
if ( size <= 0 )
@@ -736,14 +737,16 @@
static FT_Pointer
ft_mem_debug_realloc( FT_Memory memory,
- FT_Long cur_size,
- FT_Long new_size,
+ FT_Offset cur_size_,
+ FT_Offset new_size_,
FT_Pointer block )
{
FT_MemTable table = (FT_MemTable)memory->user;
FT_MemNode node, *pnode;
FT_Pointer new_block;
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 );
FT_Long line_no = _ft_debug_lineno;
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index 8fffe48..ded49a4 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -69,11 +69,11 @@
*/
FT_CALLBACK_DEF( void* )
ft_alloc( FT_Memory memory,
- long size )
+ size_t size )
{
FT_UNUSED( memory );
- return ft_smalloc( (size_t)size );
+ return ft_smalloc( size );
}
@@ -103,14 +103,14 @@
*/
FT_CALLBACK_DEF( void* )
ft_realloc( FT_Memory memory,
- long cur_size,
- long new_size,
+ size_t cur_size,
+ size_t new_size,
void* block )
{
FT_UNUSED( memory );
FT_UNUSED( cur_size );
- return ft_srealloc( block, (size_t)new_size );
+ return ft_srealloc( block, new_size );
}
diff --git a/src/raster/ftmisc.h b/src/raster/ftmisc.h
index 97db371..fb63a02 100644
--- a/src/raster/ftmisc.h
+++ b/src/raster/ftmisc.h
@@ -59,14 +59,14 @@
typedef struct FT_MemoryRec_* FT_Memory;
typedef void* (*FT_Alloc_Func)( FT_Memory memory,
- long size );
+ size_t size );
typedef void (*FT_Free_Func)( FT_Memory memory,
void* block );
typedef void* (*FT_Realloc_Func)( FT_Memory memory,
- long cur_size,
- long new_size,
+ size_t cur_size,
+ size_t new_size,
void* block );
typedef struct FT_MemoryRec_