OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftutil.c */ | 3 /* ftutil.c */ |
4 /* */ | 4 /* */ |
5 /* FreeType utility file for memory and list management (body). */ | 5 /* FreeType utility file for memory and list management (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2002, 2004-2007, 2013 by */ | 7 /* Copyright 2002-2015 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 FT_BASE_DEF( FT_Pointer ) | 176 FT_BASE_DEF( FT_Pointer ) |
177 ft_mem_dup( FT_Memory memory, | 177 ft_mem_dup( FT_Memory memory, |
178 const void* address, | 178 const void* address, |
179 FT_ULong size, | 179 FT_ULong size, |
180 FT_Error *p_error ) | 180 FT_Error *p_error ) |
181 { | 181 { |
182 FT_Error error; | 182 FT_Error error; |
183 FT_Pointer p = ft_mem_qalloc( memory, size, &error ); | 183 FT_Pointer p = ft_mem_qalloc( memory, (FT_Long)size, &error ); |
184 | 184 |
185 | 185 |
186 if ( !error && address ) | 186 if ( !error && address ) |
187 ft_memcpy( p, address, size ); | 187 ft_memcpy( p, address, size ); |
188 | 188 |
189 *p_error = error; | 189 *p_error = error; |
190 return p; | 190 return p; |
191 } | 191 } |
192 | 192 |
193 | 193 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 FT_ListNode node ) | 268 FT_ListNode node ) |
269 { | 269 { |
270 FT_ListNode before; | 270 FT_ListNode before; |
271 | 271 |
272 | 272 |
273 if ( !list || !node ) | 273 if ( !list || !node ) |
274 return; | 274 return; |
275 | 275 |
276 before = list->tail; | 276 before = list->tail; |
277 | 277 |
278 node->next = 0; | 278 node->next = NULL; |
279 node->prev = before; | 279 node->prev = before; |
280 | 280 |
281 if ( before ) | 281 if ( before ) |
282 before->next = node; | 282 before->next = node; |
283 else | 283 else |
284 list->head = node; | 284 list->head = node; |
285 | 285 |
286 list->tail = node; | 286 list->tail = node; |
287 } | 287 } |
288 | 288 |
289 | 289 |
290 /* documentation is in ftlist.h */ | 290 /* documentation is in ftlist.h */ |
291 | 291 |
292 FT_EXPORT_DEF( void ) | 292 FT_EXPORT_DEF( void ) |
293 FT_List_Insert( FT_List list, | 293 FT_List_Insert( FT_List list, |
294 FT_ListNode node ) | 294 FT_ListNode node ) |
295 { | 295 { |
296 FT_ListNode after; | 296 FT_ListNode after; |
297 | 297 |
298 | 298 |
299 if ( !list || !node ) | 299 if ( !list || !node ) |
300 return; | 300 return; |
301 | 301 |
302 after = list->head; | 302 after = list->head; |
303 | 303 |
304 node->next = after; | 304 node->next = after; |
305 node->prev = 0; | 305 node->prev = NULL; |
306 | 306 |
307 if ( !after ) | 307 if ( !after ) |
308 list->tail = node; | 308 list->tail = node; |
309 else | 309 else |
310 after->prev = node; | 310 after->prev = node; |
311 | 311 |
312 list->head = node; | 312 list->head = node; |
313 } | 313 } |
314 | 314 |
315 | 315 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if ( !before ) | 359 if ( !before ) |
360 return; | 360 return; |
361 | 361 |
362 before->next = after; | 362 before->next = after; |
363 | 363 |
364 if ( after ) | 364 if ( after ) |
365 after->prev = before; | 365 after->prev = before; |
366 else | 366 else |
367 list->tail = before; | 367 list->tail = before; |
368 | 368 |
369 node->prev = 0; | 369 node->prev = NULL; |
370 node->next = list->head; | 370 node->next = list->head; |
371 list->head->prev = node; | 371 list->head->prev = node; |
372 list->head = node; | 372 list->head = node; |
373 } | 373 } |
374 | 374 |
375 | 375 |
376 /* documentation is in ftlist.h */ | 376 /* documentation is in ftlist.h */ |
377 | 377 |
378 FT_EXPORT_DEF( FT_Error ) | 378 FT_EXPORT_DEF( FT_Error ) |
379 FT_List_Iterate( FT_List list, | 379 FT_List_Iterate( FT_List list, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 void* data = cur->data; | 426 void* data = cur->data; |
427 | 427 |
428 | 428 |
429 if ( destroy ) | 429 if ( destroy ) |
430 destroy( memory, data, user ); | 430 destroy( memory, data, user ); |
431 | 431 |
432 FT_FREE( cur ); | 432 FT_FREE( cur ); |
433 cur = next; | 433 cur = next; |
434 } | 434 } |
435 | 435 |
436 list->head = 0; | 436 list->head = NULL; |
437 list->tail = 0; | 437 list->tail = NULL; |
438 } | 438 } |
439 | 439 |
440 | 440 |
441 /* END */ | 441 /* END */ |
OLD | NEW |