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)
20 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
21 #define TAG_FREETYPE TAG('F', 'T', 'Y', 'P')
24 * First some generic routines
28 DbgPrint(IN PCCH Format
, IN
...)
32 va_start(args
, Format
);
33 EngDebugPrint("ft2: ", (PCHAR
)Format
, args
);
41 * Because of realloc, we need to keep track of the size of the allocated
42 * buffer (need to copy the old contents to the new buffer). So, allocate
43 * extra space for a size_t, store the allocated size in there and return
44 * the address just past it as the allocated buffer.
52 Object
= EngAllocMem(0, sizeof(size_t) + Size
, TAG_FREETYPE
);
55 *((size_t *) Object
) = Size
;
56 Object
= (void *)((size_t *) Object
+ 1);
63 realloc(void *Object
, size_t Size
)
68 NewObject
= EngAllocMem(0, sizeof(size_t) + Size
, TAG_FREETYPE
);
69 if (NULL
!= NewObject
)
71 *((size_t *) NewObject
) = Size
;
72 NewObject
= (void *)((size_t *) NewObject
+ 1);
73 CopySize
= *((size_t *) Object
- 1);
78 memcpy(NewObject
, Object
, CopySize
);
79 EngFreeMem((size_t *) Object
- 1);
88 EngFreeMem((size_t *) Object
- 1);
94 * This is easy, we don't want FreeType to do any I/O. So return an
95 * error on each I/O attempt. Note that errno is not being set, it is
96 * not used by FreeType.
100 fopen(const char *FileName
, const char *Mode
)
102 DPRINT1("Freetype tries to open file %s\n", FileName
);
108 fseek(FILE *Stream
, long Offset
, int Origin
)
110 DPRINT1("Doubleplus ungood: freetype shouldn't fseek!\n");
118 DPRINT1("Doubleplus ungood: freetype shouldn't ftell!\n");
124 fread(void *Buffer
, size_t Size
, size_t Count
, FILE *Stream
)
126 DPRINT1("Doubleplus ungood: freetype shouldn't fread!\n");
134 DPRINT1("Doubleplus ungood: freetype shouldn't fclose!\n");