]>
git.bts.cx Git - benzene.git/blob - third_party/soloud_speech/darray.cpp
8 mAllocated
= mUsed
= 0;
16 mAllocated
= mUsed
= 0;
25 char * darray::getDataInPos(int aPosition
)
27 if (aPosition
< mAllocated
&& aPosition
< mUsed
)
28 return mData
+ aPosition
;
30 if (aPosition
>= mAllocated
)
32 int newsize
= mAllocated
;
34 while (newsize
<= aPosition
)
36 newsize
+= mAllocChunk
;
40 char *newdata
= (char*)realloc(mData
, newsize
);
45 mAllocated
= mUsed
= 0;
50 memset(newdata
+ mAllocated
, 0, newsize
- mAllocated
);
57 if (aPosition
>= mUsed
)
59 mUsed
= aPosition
+ 1;
62 return mData
+ aPosition
;
65 void darray::put(int aData
)
67 char *s
= getDataInPos(mUsed
);