OLD | NEW |
1 //------------------------------------------------------------------------------
--- | 1 //------------------------------------------------------------------------------
--- |
2 // | 2 // |
3 // Little Color Management System | 3 // Little Color Management System |
4 // Copyright (c) 1998-2012 Marti Maria Saguer | 4 // Copyright (c) 1998-2012 Marti Maria Saguer |
5 // | 5 // |
6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 #include "../../../../../include/fxcrt/fx_memory.h" | 255 #include "../../../../../include/fxcrt/fx_memory.h" |
256 | 256 |
257 cmsBool _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plugi
n) | 257 cmsBool _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plugi
n) |
258 { | 258 { |
259 return TRUE; | 259 return TRUE; |
260 } | 260 } |
261 | 261 |
262 // Generic allocate | 262 // Generic allocate |
263 void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size) | 263 void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size) |
264 { | 264 { |
265 return FXMEM_DefaultAlloc(size, FXMEM_NONLEAVE); | 265 return FXMEM_DefaultAlloc(size, 1); |
266 } | 266 } |
267 | 267 |
268 // Generic allocate & zero | 268 // Generic allocate & zero |
269 void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size) | 269 void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size) |
270 { | 270 { |
271 » void* p = FXMEM_DefaultAlloc(size, FXMEM_NONLEAVE); | 271 » void* p = FXMEM_DefaultAlloc(size, 1); |
272 if (p) FXSYS_memset32(p, 0, size); | 272 if (p) FXSYS_memset32(p, 0, size); |
273 return p; | 273 return p; |
274 } | 274 } |
275 | 275 |
276 // Generic calloc | 276 // Generic calloc |
277 void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32N
umber size) | 277 void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32N
umber size) |
278 { | 278 { |
279 cmsUInt32Number total = num * size; | 279 cmsUInt32Number total = num * size; |
280 if (total == 0 || total / size != num || total >= 512 * 1024 * 1024) | 280 if (total == 0 || total / size != num || total >= 512 * 1024 * 1024) |
281 return NULL; | 281 return NULL; |
282 | 282 |
283 return _cmsMallocZero(ContextID, num * size); | 283 return _cmsMallocZero(ContextID, num * size); |
284 } | 284 } |
285 | 285 |
286 // Generic reallocate | 286 // Generic reallocate |
287 void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number siz
e) | 287 void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number siz
e) |
288 { | 288 { |
289 » return FXMEM_DefaultRealloc(Ptr, size, FXMEM_NONLEAVE); | 289 » return FXMEM_DefaultRealloc(Ptr, size, 1); |
290 } | 290 } |
291 | 291 |
292 // Generic free memory | 292 // Generic free memory |
293 void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr) | 293 void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr) |
294 { | 294 { |
295 if (Ptr != NULL) FXMEM_DefaultFree(Ptr, 0); | 295 if (Ptr != NULL) FXMEM_DefaultFree(Ptr, 0); |
296 } | 296 } |
297 | 297 |
298 // Generic block duplication | 298 // Generic block duplication |
299 void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Numbe
r size) | 299 void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Numbe
r size) |
300 { | 300 { |
301 » void* p = FXMEM_DefaultAlloc(size, FXMEM_NONLEAVE); | 301 » void* p = FXMEM_DefaultAlloc(size, 1); |
302 FXSYS_memmove32(p, Org, size); | 302 FXSYS_memmove32(p, Org, size); |
303 return p; | 303 return p; |
304 } | 304 } |
305 | 305 |
306 _cmsMemPluginChunkType _cmsMemPluginChunk = {_cmsMalloc, _cmsMallocZero, _cmsFre
e, | 306 _cmsMemPluginChunkType _cmsMemPluginChunk = {_cmsMalloc, _cmsMallocZero, _cmsFre
e, |
307 _cmsRealloc, _cmsCalloc, _cm
sDupMem | 307 _cmsRealloc, _cmsCalloc, _cm
sDupMem |
308 }; | 308 }; |
309 | 309 |
310 void _cmsAllocMemPluginChunk(struct _cmsContext_struct* ctx, const struct _cmsCo
ntext_struct* src) | 310 void _cmsAllocMemPluginChunk(struct _cmsContext_struct* ctx, const struct _cmsCo
ntext_struct* src) |
311 { | 311 { |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 | 698 |
699 void CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx) | 699 void CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx) |
700 { | 700 { |
701 _cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetCl
ientChunk(ContextID, MutexPlugin); | 701 _cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetCl
ientChunk(ContextID, MutexPlugin); |
702 | 702 |
703 if (ptr ->UnlockMutexPtr != NULL) { | 703 if (ptr ->UnlockMutexPtr != NULL) { |
704 | 704 |
705 ptr ->UnlockMutexPtr(ContextID, mtx); | 705 ptr ->UnlockMutexPtr(ContextID, mtx); |
706 } | 706 } |
707 } | 707 } |
OLD | NEW |