1 /* $Id: rosglue.c 39928 2009-03-10 02:49:45Z tkreuzer $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: FreeType implementation for ReactOS
5 * PURPOSE: Glue functions between FreeType
6 * FILE: thirdparty/freetype/rosglue.c
7 * PROGRAMMER: Ge van Geldorp (ge@gse.nl)
16 #define TAG_FREETYPE 'PYTF'
19 * First some generic routines
23 DbgPrint(IN PCCH Format
, IN
...)
27 va_start(args
, Format
);
28 EngDebugPrint("ft2: ", (PCHAR
)Format
, args
);
36 * Because of realloc, we need to keep track of the size of the allocated
37 * buffer (need to copy the old contents to the new buffer). So, allocate
38 * extra space for a size_t, store the allocated size in there and return
39 * the address just past it as the allocated buffer.
47 Object
= EngAllocMem(0, sizeof(size_t) + Size
, TAG_FREETYPE
);
50 *((size_t *) Object
) = Size
;
51 Object
= (void *)((size_t *) Object
+ 1);
58 realloc(void *Object
, size_t Size
)
63 NewObject
= EngAllocMem(0, sizeof(size_t) + Size
, TAG_FREETYPE
);
64 if (NULL
!= NewObject
)
66 *((size_t *) NewObject
) = Size
;
67 NewObject
= (void *)((size_t *) NewObject
+ 1);
68 CopySize
= *((size_t *) Object
- 1);
73 memcpy(NewObject
, Object
, CopySize
);
74 EngFreeMem((size_t *) Object
- 1);
83 EngFreeMem((size_t *) Object
- 1);
89 * This is easy, we don't want FreeType to do any I/O. So return an
90 * error on each I/O attempt. Note that errno is not being set, it is
91 * not used by FreeType.
95 fopen(const char *FileName
, const char *Mode
)
97 DPRINT1("Freetype tries to open file %s\n", FileName
);
103 fseek(FILE *Stream
, long Offset
, int Origin
)
105 DPRINT1("Doubleplus ungood: freetype shouldn't fseek!\n");
113 DPRINT1("Doubleplus ungood: freetype shouldn't ftell!\n");
119 fread(void *Buffer
, size_t Size
, size_t Count
, FILE *Stream
)
121 DPRINT1("Doubleplus ungood: freetype shouldn't fread!\n");
129 DPRINT1("Doubleplus ungood: freetype shouldn't fclose!\n");