ReactOS 0.4.15-dev-8100-g1887773
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   trace_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   trace_io

Definition at line 149 of file ftsystem.c.

◆ STREAM_FILE

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

Definition at line 153 of file ftsystem.c.

Function Documentation

◆ ft_alloc()

ft_alloc ( FT_Memory  memory,
long  size 
)

Definition at line 69 of file ftsystem.c.

71 {
73
74 return ft_smalloc( (size_t)size );
75 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#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 168 of file ftsystem.c.

169 {
171
172 stream->descriptor.pointer = NULL;
173 stream->size = 0;
174 stream->base = NULL;
175 }
#define NULL
Definition: types.h:112
#define ft_fclose
Definition: ftstdlib.h:105
#define STREAM_FILE(stream)
Definition: ftsystem.c:153
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 201 of file ftsystem.c.

205 {
206 FT_FILE* file;
207
208
209 if ( !count && offset > stream->size )
210 return 1;
211
213
214 if ( stream->pos != offset )
215 ft_fseek( file, (long)offset, SEEK_SET );
216
217 return (unsigned long)ft_fread( buffer, 1, count, file );
218 }
#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 311 of file ftsystem.c.

312 {
313#ifdef FT_DEBUG_MEMORY
314 ft_mem_debug_done( memory );
315#endif
316 ft_sfree( memory );
317 }
#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 125 of file ftsystem.c.

127 {
128 FT_UNUSED( memory );
129
130 ft_sfree( block );
131 }
static unsigned int block
Definition: xmlmemory.c:101

Referenced by FT_New_Memory().

◆ FT_New_Memory()

FT_New_Memory ( void  )

Definition at line 287 of file ftsystem.c.

288 {
290
291
292 memory = (FT_Memory)ft_smalloc( sizeof ( *memory ) );
293 if ( memory )
294 {
295 memory->user = NULL;
296 memory->alloc = ft_alloc;
297 memory->realloc = ft_realloc;
298 memory->free = ft_free;
299#ifdef FT_DEBUG_MEMORY
300 ft_mem_debug_init( memory );
301#endif
302 }
303
304 return memory;
305 }
ft_realloc(FT_Memory memory, long cur_size, long new_size, void *block)
Definition: ftsystem.c:99
ft_free(FT_Memory memory, void *block)
Definition: ftsystem.c:125
ft_alloc(FT_Memory memory, long size)
Definition: ftsystem.c:69
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66

Referenced by FT_Init_FreeType().

◆ ft_realloc()

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

Definition at line 99 of file ftsystem.c.

103 {
104 FT_UNUSED( memory );
105 FT_UNUSED( cur_size );
106
107 return ft_srealloc( block, (size_t)new_size );
108 }
#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 224 of file ftsystem.c.

226 {
227 FT_FILE* file;
228
229
230 if ( !stream )
231 return FT_THROW( Invalid_Stream_Handle );
232
233 stream->descriptor.pointer = NULL;
234 stream->pathname.pointer = (char*)filepathname;
235 stream->base = NULL;
236 stream->pos = 0;
237 stream->read = NULL;
238 stream->close = NULL;
239
240 file = ft_fopen( filepathname, "rb" );
241 if ( !file )
242 {
243 FT_ERROR(( "FT_Stream_Open:"
244 " could not open `%s'\n", filepathname ));
245
246 return FT_THROW( Cannot_Open_Resource );
247 }
248
249 ft_fseek( file, 0, SEEK_END );
250 stream->size = (unsigned long)ft_ftell( file );
251 if ( !stream->size )
252 {
253 FT_ERROR(( "FT_Stream_Open:" ));
254 FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
255 ft_fclose( file );
256 return FT_THROW( Cannot_Open_Stream );
257 }
258 ft_fseek( file, 0, SEEK_SET );
259
260 stream->descriptor.pointer = file;
263
264 FT_TRACE1(( "FT_Stream_Open:" ));
265 FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
266 filepathname, stream->size ));
267
268 return FT_Err_Ok;
269 }
#define SEEK_END
Definition: cabinet.c:29
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
#define ft_ftell
Definition: ftstdlib.h:109
#define ft_fopen
Definition: ftstdlib.h:106
ft_ansi_stream_close(FT_Stream stream)
Definition: ftsystem.c:168
ft_ansi_stream_io(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count)
Definition: ftsystem.c:201
#define long
Definition: qsort.c:33

Referenced by FT_Stream_New(), and main().