Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrosglue.c
Go to the documentation of this file.
00001 /* $Id: rosglue.c 39928 2009-03-10 02:49:45Z tkreuzer $ 00002 * 00003 * COPYRIGHT: See COPYING in the top level directory 00004 * PROJECT: FreeType implementation for ReactOS 00005 * PURPOSE: Glue functions between FreeType 00006 * FILE: thirdparty/freetype/rosglue.c 00007 * PROGRAMMER: Ge van Geldorp (ge@gse.nl) 00008 * NOTES: 00009 */ 00010 00011 #include "ftfd.h" 00012 00013 #define NDEBUG 00014 #include <debug.h> 00015 00016 #define TAG_FREETYPE 'PYTF' 00017 00018 /* 00019 * First some generic routines 00020 */ 00021 00022 ULONG 00023 DbgPrint(IN PCCH Format, IN ...) 00024 { 00025 va_list args; 00026 00027 va_start(args, Format); 00028 EngDebugPrint("ft2: ", (PCHAR)Format, args); 00029 va_end(args); 00030 return 0; 00031 } 00032 00033 /* 00034 * Memory allocation 00035 * 00036 * Because of realloc, we need to keep track of the size of the allocated 00037 * buffer (need to copy the old contents to the new buffer). So, allocate 00038 * extra space for a size_t, store the allocated size in there and return 00039 * the address just past it as the allocated buffer. 00040 */ 00041 00042 void * 00043 malloc(size_t Size) 00044 { 00045 void *Object; 00046 00047 Object = EngAllocMem(0, sizeof(size_t) + Size, TAG_FREETYPE); 00048 if (NULL != Object) 00049 { 00050 *((size_t *) Object) = Size; 00051 Object = (void *)((size_t *) Object + 1); 00052 } 00053 00054 return Object; 00055 } 00056 00057 void * 00058 realloc(void *Object, size_t Size) 00059 { 00060 void *NewObject; 00061 size_t CopySize; 00062 00063 NewObject = EngAllocMem(0, sizeof(size_t) + Size, TAG_FREETYPE); 00064 if (NULL != NewObject) 00065 { 00066 *((size_t *) NewObject) = Size; 00067 NewObject = (void *)((size_t *) NewObject + 1); 00068 CopySize = *((size_t *) Object - 1); 00069 if (Size < CopySize) 00070 { 00071 CopySize = Size; 00072 } 00073 memcpy(NewObject, Object, CopySize); 00074 EngFreeMem((size_t *) Object - 1); 00075 } 00076 00077 return NewObject; 00078 } 00079 00080 void 00081 free(void *Object) 00082 { 00083 EngFreeMem((size_t *) Object - 1); 00084 } 00085 00086 /* 00087 * File I/O 00088 * 00089 * This is easy, we don't want FreeType to do any I/O. So return an 00090 * error on each I/O attempt. Note that errno is not being set, it is 00091 * not used by FreeType. 00092 */ 00093 00094 FILE * 00095 fopen(const char *FileName, const char *Mode) 00096 { 00097 DPRINT1("Freetype tries to open file %s\n", FileName); 00098 00099 return NULL; 00100 } 00101 00102 int 00103 fseek(FILE *Stream, long Offset, int Origin) 00104 { 00105 DPRINT1("Doubleplus ungood: freetype shouldn't fseek!\n"); 00106 00107 return -1; 00108 } 00109 00110 long 00111 ftell(FILE *Stream) 00112 { 00113 DPRINT1("Doubleplus ungood: freetype shouldn't ftell!\n"); 00114 00115 return -1; 00116 } 00117 00118 size_t 00119 fread(void *Buffer, size_t Size, size_t Count, FILE *Stream) 00120 { 00121 DPRINT1("Doubleplus ungood: freetype shouldn't fread!\n"); 00122 00123 return 0; 00124 } 00125 00126 int 00127 fclose(FILE *Stream) 00128 { 00129 DPRINT1("Doubleplus ungood: freetype shouldn't fclose!\n"); 00130 00131 return EOF; 00132 } Generated on Sat May 26 2012 04:36:57 for ReactOS by
1.7.6.1
|