40 #include FT_INTERNAL_DEBUG_H 64 arrstack->memory = memory;
65 arrstack->error =
error;
66 arrstack->sizeItem = sizeItem;
67 arrstack->allocated = 0;
70 arrstack->totalSize = 0;
83 arrstack->allocated = 0;
85 arrstack->totalSize = 0;
104 FT_Long newSize = numElements * arrstack->sizeItem;
107 if ( numElements > LONG_MAX / arrstack->sizeItem )
113 if ( !
FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
115 arrstack->allocated = numElements;
116 arrstack->totalSize = newSize;
118 if ( arrstack->count > numElements )
122 arrstack->count = numElements;
145 if ( numElements > arrstack->allocated )
148 if ( !cf2_arrstack_setNumElements( arrstack, numElements ) )
152 arrstack->count = numElements;
172 return arrstack->count;
181 return arrstack->ptr;
195 if (
idx >= arrstack->count )
202 newPtr = (
FT_Byte*)arrstack->ptr +
idx * arrstack->sizeItem;
217 if ( arrstack->count == arrstack->allocated )
220 if ( !cf2_arrstack_setNumElements(
221 arrstack, arrstack->allocated + arrstack->chunk ) )
231 size_t offset = arrstack->count * arrstack->sizeItem;
232 void* newPtr = (
FT_Byte*)arrstack->ptr + offset;
236 arrstack->count += 1;
cf2_arrstack_setCount(CF2_ArrStack arrstack, size_t numElements)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_ASSERT(condition)
#define CF2_SET_ERROR(error, e)
cf2_arrstack_finalize(CF2_ArrStack arrstack)
cf2_arrstack_init(CF2_ArrStack arrstack, FT_Memory memory, FT_Error *error, size_t sizeItem)
cf2_arrstack_push(CF2_ArrStack arrstack, const void *ptr)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
cf2_arrstack_clear(CF2_ArrStack arrstack)
#define FT_REALLOC(ptr, cursz, newsz)
cf2_arrstack_getPointer(const CF2_ArrStack arrstack, size_t idx)
cf2_arrstack_size(const CF2_ArrStack arrstack)
cf2_arrstack_getBuffer(const CF2_ArrStack arrstack)
#define FT_MEM_COPY(dest, source, count)
FT_BEGIN_HEADER struct CF2_ArrStackRec_ * CF2_ArrStack