ReactOS 0.4.16-dev-1067-ge98bba2
ftsystem.c File Reference
#include <ft2build.h>
Include dependency graph for ftsystem.c:

Go to the source code of this file.

Macros

#define FT_COMPONENT   io
 
#define STREAM_FILE(stream)   ( (FT_FILE*)stream->descriptor.pointer )
 

Functions

 ft_alloc (FT_Memory memory, long size)
 
 ft_realloc (FT_Memory memory, long cur_size, long new_size, void *block)
 
 ft_free (FT_Memory memory, void *block)
 
 ft_ansi_stream_close (FT_Stream stream)
 
 ft_ansi_stream_io (FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count)
 
 FT_Stream_Open (FT_Stream stream, const char *filepathname)
 
 FT_New_Memory (void)
 
 FT_Done_Memory (FT_Memory memory)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   io

Definition at line 157 of file ftsystem.c.

◆ STREAM_FILE

#define STREAM_FILE (   stream)    ( (FT_FILE*)stream->descriptor.pointer )

Definition at line 161 of file ftsystem.c.

Function Documentation

◆ ft_alloc()

ft_alloc ( FT_Memory  memory,
long  size 
)

Definition at line 71 of file ftsystem.c.

73 {
75
76 return ft_smalloc( (size_t)size );
77 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:100
#define ft_smalloc
Definition: ftstdlib.h:134
GLsizeiptr size
Definition: glext.h:5919
static char memory[1024 *256]
Definition: process.c:116

Referenced by FT_New_Memory().

◆ ft_ansi_stream_close()

ft_ansi_stream_close ( FT_Stream  stream)

Definition at line 177 of file ftsystem.c.

178 {
180
181 stream->descriptor.pointer = NULL;
182 stream->size = 0;
183 stream->base = NULL;
184 }
#define NULL
Definition: types.h:112
#define ft_fclose
Definition: ftstdlib.h:105
#define STREAM_FILE(stream)
Definition: ftsystem.c:161
Definition: parse.h:23
unsigned int size
Definition: parse.h:27

Referenced by FT_Stream_Open().

◆ ft_ansi_stream_io()

ft_ansi_stream_io ( FT_Stream  stream,
unsigned long  offset,
unsigned char buffer,
unsigned long  count 
)

Definition at line 214 of file ftsystem.c.

218 {
219 FT_FILE* file;
220
221
222 if ( !count && offset > stream->size )
223 return 1;
224
226
227 if ( stream->pos != offset )
228 ft_fseek( file, (long)offset, SEEK_SET );
229
230 return (unsigned long)ft_fread( buffer, 1, count, file );
231 }
#define FT_FILE
Definition: ftstdlib.h:104
#define ft_fseek
Definition: ftstdlib.h:108
#define ft_fread
Definition: ftstdlib.h:107
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLintptr offset
Definition: glext.h:5920
#define SEEK_SET
Definition: jmemansi.c:26
Definition: fci.c:127
ULARGE_INTEGER pos
Definition: request.c:4380

Referenced by FT_Stream_Open().

◆ FT_Done_Memory()

FT_Done_Memory ( FT_Memory  memory)

Definition at line 324 of file ftsystem.c.

325 {
326#ifdef FT_DEBUG_MEMORY
327 ft_mem_debug_done( memory );
328#endif
329 ft_sfree( memory );
330 }
#define ft_sfree
Definition: ftstdlib.h:133

Referenced by FT_Done_FreeType(), and FT_Init_FreeType().

◆ ft_free()

ft_free ( FT_Memory  memory,
void block 
)

Definition at line 133 of file ftsystem.c.

135 {
136 FT_UNUSED( memory );
137
138 ft_sfree( block );
139 }
static unsigned int block
Definition: xmlmemory.c:101

Referenced by FT_New_Memory().

◆ FT_New_Memory()

FT_New_Memory ( void  )

Definition at line 300 of file ftsystem.c.

301 {
303
304
305 memory = (FT_Memory)ft_smalloc( sizeof ( *memory ) );
306 if ( memory )
307 {
308 memory->user = NULL;
309 memory->alloc = ft_alloc;
310 memory->realloc = ft_realloc;
311 memory->free = ft_free;
312#ifdef FT_DEBUG_MEMORY
313 ft_mem_debug_init( memory );
314#endif
315 }
316
317 return memory;
318 }
ft_realloc(FT_Memory memory, long cur_size, long new_size, void *block)
Definition: ftsystem.c:105
ft_free(FT_Memory memory, void *block)
Definition: ftsystem.c:133
ft_alloc(FT_Memory memory, long size)
Definition: ftsystem.c:71
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:65

Referenced by FT_Init_FreeType().

◆ ft_realloc()

ft_realloc ( FT_Memory  memory,
long  cur_size,
long  new_size,
void block 
)

Definition at line 105 of file ftsystem.c.

109 {
110 FT_UNUSED( memory );
111 FT_UNUSED( cur_size );
112
113 return ft_srealloc( block, (size_t)new_size );
114 }
size_t const new_size
Definition: expand.cpp:66
#define ft_srealloc
Definition: ftstdlib.h:135

Referenced by FT_New_Memory().

◆ FT_Stream_Open()

FT_Stream_Open ( FT_Stream  stream,
const char filepathname 
)

Definition at line 237 of file ftsystem.c.

239 {
240 FT_FILE* file;
241
242
243 if ( !stream )
244 return FT_THROW( Invalid_Stream_Handle );
245
246 stream->descriptor.pointer = NULL;
247 stream->pathname.pointer = (char*)filepathname;
248 stream->base = NULL;
249 stream->pos = 0;
250 stream->read = NULL;
251 stream->close = NULL;
252
253 file = ft_fopen( filepathname, "rb" );
254 if ( !file )
255 {
256 FT_ERROR(( "FT_Stream_Open:"
257 " could not open `%s'\n", filepathname ));
258
259 return FT_THROW( Cannot_Open_Resource );
260 }
261
262 ft_fseek( file, 0, SEEK_END );
263 stream->size = (unsigned long)ft_ftell( file );
264 if ( !stream->size )
265 {
266 FT_ERROR(( "FT_Stream_Open:" ));
267 FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
268 ft_fclose( file );
269 return FT_THROW( Cannot_Open_Stream );
270 }
271 ft_fseek( file, 0, SEEK_SET );
272
273 stream->descriptor.pointer = file;
276
277 FT_TRACE1(( "FT_Stream_Open:" ));
278 FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
279 filepathname, stream->size ));
280
281 return FT_Err_Ok;
282 }
#define SEEK_END
Definition: cabinet.c:29
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_ERROR(varformat)
Definition: ftdebug.h:209
#define FT_THROW(e)
Definition: ftdebug.h:241
#define FT_TRACE1(varformat)
Definition: ftdebug.h:186
#define ft_ftell
Definition: ftstdlib.h:109
#define ft_fopen
Definition: ftstdlib.h:106
ft_ansi_stream_close(FT_Stream stream)
Definition: ftsystem.c:177
ft_ansi_stream_io(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count)
Definition: ftsystem.c:214
#define long
Definition: qsort.c:33

Referenced by FT_Stream_New().