Lines Matching defs:size

113 void* _cmsMallocDefaultFn(cmsContext ContextID, cmsUInt32Number size)
115 if (size > MAX_MEMORY_FOR_ALLOC) return NULL; // Never allow over maximum
117 return (void*) malloc(size);
124 void* _cmsMallocZeroDefaultFn(cmsContext ContextID, cmsUInt32Number size)
126 void *pt = _cmsMalloc(ContextID, size);
129 memset(pt, 0, size);
147 // realloc behaves the same way as malloc and allocates a new block of size bytes.
149 void* _cmsReallocDefaultFn(cmsContext ContextID, void* Ptr, cmsUInt32Number size)
152 if (size > MAX_MEMORY_FOR_ALLOC) return NULL; // Never realloc over 512Mb
154 return realloc(Ptr, size);
160 // The default calloc function. Allocates an array of num elements, each one of size bytes
163 void* _cmsCallocDefaultFn(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size)
165 cmsUInt32Number Total = num * size;
171 if (num >= UINT_MAX / size) return NULL;
174 if (Total < num || Total < size) {
185 void* _cmsDupDefaultFn(cmsContext ContextID, const void* Org, cmsUInt32Number size)
189 if (size > MAX_MEMORY_FOR_ALLOC) return NULL; // Never dup over 512Mb
191 mem = _cmsMalloc(ContextID, size);
194 memmove(mem, Org, size);
200 static void * (* MallocPtr)(cmsContext ContextID, cmsUInt32Number size) = _cmsMallocDefaultFn;
201 static void * (* MallocZeroPtr)(cmsContext ContextID, cmsUInt32Number size) = _cmsMallocZeroDefaultFn;
204 static void * (* CallocPtr)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size)= _cmsCallocDefaultFn;
205 static void * (* DupPtr)(cmsContext ContextID, const void* Org, cmsUInt32Number size) = _cmsDupDefaultFn;
242 void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size)
244 return MallocPtr(ContextID, size);
248 void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size)
250 return MallocZeroPtr(ContextID, size);
254 void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size)
256 return CallocPtr(ContextID, num, size);
260 void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number size)
262 return ReallocPtr(ContextID, Ptr, size);
272 void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Number size)
274 return DupPtr(ContextID, Org, size);
279 // Sub allocation takes care of many pointers of small size. The memory allocated in
354 void* _cmsSubAlloc(_cmsSubAllocator* sub, cmsUInt32Number size)
359 size = _cmsALIGNMEM(size);
361 // Check for memory. If there is no room, allocate a new chunk of double memory size.
362 if (size > Free) {
368 if (newSize < size) newSize = size;
380 sub -> h -> Used += size;