OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftinit.c */ | 3 /* ftinit.c */ |
4 /* */ | 4 /* */ |
5 /* FreeType initialization layer (body). */ | 5 /* FreeType initialization layer (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2001, 2002, 2005, 2007, 2009, 2012 by */ | 7 /* Copyright 1996-2002, 2005, 2007, 2009, 2012, 2013 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 if ( error ) \ | 149 if ( error ) \ |
150 goto Exit; \ | 150 goto Exit; \ |
151 classes[i++] = clazz; | 151 classes[i++] = clazz; |
152 | 152 |
153 | 153 |
154 FT_BASE_DEF( FT_Error ) | 154 FT_BASE_DEF( FT_Error ) |
155 ft_create_default_module_classes( FT_Library library ) | 155 ft_create_default_module_classes( FT_Library library ) |
156 { | 156 { |
157 FT_Error error; | 157 FT_Error error; |
158 FT_Memory memory; | 158 FT_Memory memory; |
159 FT_Module_Class* *classes; | 159 FT_Module_Class* *classes = NULL; |
160 FT_Module_Class* clazz; | 160 FT_Module_Class* clazz; |
161 FT_UInt i; | 161 FT_UInt i; |
162 BasePIC* pic_container = (BasePIC*)library->pic_container.base; | 162 BasePIC* pic_container = (BasePIC*)library->pic_container.base; |
163 | 163 |
164 | 164 |
165 memory = library->memory; | 165 memory = library->memory; |
166 | 166 |
167 pic_container->default_module_classes = 0; | 167 pic_container->default_module_classes = 0; |
168 | 168 |
169 if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * | 169 if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * |
170 ( FT_NUM_MODULE_CLASSES + 1 ) ) ) | 170 ( FT_NUM_MODULE_CLASSES + 1 ) ) ) |
171 return error; | 171 return error; |
172 | 172 |
173 /* initialize all pointers to 0, especially the last one */ | 173 /* initialize all pointers to 0, especially the last one */ |
174 for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) | 174 for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) |
175 classes[i] = 0; | 175 classes[i] = 0; |
176 classes[FT_NUM_MODULE_CLASSES] = 0; | 176 classes[FT_NUM_MODULE_CLASSES] = 0; |
177 | 177 |
178 i = 0; | 178 i = 0; |
179 | 179 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 FT_Memory memory; | 235 FT_Memory memory; |
236 | 236 |
237 | 237 |
238 /* First of all, allocate a new system object -- this function is part */ | 238 /* First of all, allocate a new system object -- this function is part */ |
239 /* of the system-specific component, i.e. `ftsystem.c'. */ | 239 /* of the system-specific component, i.e. `ftsystem.c'. */ |
240 | 240 |
241 memory = FT_New_Memory(); | 241 memory = FT_New_Memory(); |
242 if ( !memory ) | 242 if ( !memory ) |
243 { | 243 { |
244 FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" )); | 244 FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" )); |
245 return FT_Err_Unimplemented_Feature; | 245 return FT_THROW( Unimplemented_Feature ); |
246 } | 246 } |
247 | 247 |
248 /* build a library out of it, then fill it with the set of */ | 248 /* build a library out of it, then fill it with the set of */ |
249 /* default drivers. */ | 249 /* default drivers. */ |
250 | 250 |
251 error = FT_New_Library( memory, alibrary ); | 251 error = FT_New_Library( memory, alibrary ); |
252 if ( error ) | 252 if ( error ) |
253 FT_Done_Memory( memory ); | 253 FT_Done_Memory( memory ); |
254 else | 254 else |
255 FT_Add_Default_Modules( *alibrary ); | 255 FT_Add_Default_Modules( *alibrary ); |
(...skipping 17 matching lines...) Expand all Loading... |
273 | 273 |
274 /* discard memory manager */ | 274 /* discard memory manager */ |
275 FT_Done_Memory( memory ); | 275 FT_Done_Memory( memory ); |
276 } | 276 } |
277 | 277 |
278 return FT_Err_Ok; | 278 return FT_Err_Ok; |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 /* END */ | 282 /* END */ |
OLD | NEW |