Lines Matching refs:dp
42 dynamicPtr *dp; member
48 static int allocDynamic (dynamicPtr * dp, int initialSize, void *data);
49 static int appendDynamic (dynamicPtr * dp, const void *src, int size);
50 static int gdReallocDynamic (dynamicPtr * dp, int required);
51 static int trimDynamic (dynamicPtr * dp);
73 dynamicPtr *dp; in gdNewDynamicCtxEx() local
77 dp = newDynamic(initialSize, data, freeOKFlag); in gdNewDynamicCtxEx()
79 ctx->dp = dp; in gdNewDynamicCtxEx()
97 dynamicPtr *dp; in gdDPExtractData() local
102 dp = dctx->dp; in gdDPExtractData()
105 if (dp->dataGood) { in gdDPExtractData()
106 trimDynamic (dp); in gdDPExtractData()
107 *size = dp->logicalSize; in gdDPExtractData()
108 data = dp->data; in gdDPExtractData()
112 if (dp->data != NULL && dp->freeOK) { in gdDPExtractData()
113 gdFree(dp->data); in gdDPExtractData()
117 dp->data = NULL; in gdDPExtractData()
118 dp->realSize = 0; in gdDPExtractData()
119 dp->logicalSize = 0; in gdDPExtractData()
126 dynamicPtr *dp; in gdFreeDynamicCtx() local
130 dp = dctx->dp; in gdFreeDynamicCtx()
134 dp->realSize = 0; in gdFreeDynamicCtx()
135 dp->logicalSize = 0; in gdFreeDynamicCtx()
137 gdFree(dp); in gdFreeDynamicCtx()
146 return (dctx->dp->pos); in dynamicTell()
152 dynamicPtr *dp; in dynamicSeek() local
159 dp = dctx->dp; in dynamicSeek()
161 if (!dp->dataGood) { in dynamicSeek()
166 if (bytesNeeded > dp->realSize) { in dynamicSeek()
168 if (!dp->freeOK) { in dynamicSeek()
171 gdReallocDynamic (dp, dp->realSize * 2); in dynamicSeek()
177 if (pos > dp->logicalSize) { in dynamicSeek()
178 dp->logicalSize = pos; in dynamicSeek()
181 dp->pos = pos; in dynamicSeek()
189 dynamicPtr *dp; in newDynamic() local
190 dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr)); in newDynamic()
192 allocDynamic (dp, initialSize, data); in newDynamic()
194 dp->pos = 0; in newDynamic()
195 dp->freeOK = freeOKFlag; in newDynamic()
197 return dp; in newDynamic()
206 appendDynamic (dctx->dp, buf, size); in dynamicPutbuf()
208 if (dctx->dp->dataGood) in dynamicPutbuf()
227 appendDynamic(dctx->dp, &b, 1); in dynamicPutchar()
234 dynamicPtr *dp; in dynamicGetbuf() local
237 dp = dctx->dp; in dynamicGetbuf()
239 remain = dp->logicalSize - dp->pos; in dynamicGetbuf()
249 memcpy(buf, (void *) ((char *) dp->data + dp->pos), rlen); in dynamicGetbuf()
250 dp->pos += rlen; in dynamicGetbuf()
275 allocDynamic (dynamicPtr * dp, int initialSize, void *data) in allocDynamic() argument
279 dp->logicalSize = 0; in allocDynamic()
280 dp->dataGood = FALSE; in allocDynamic()
281 dp->data = gdMalloc(initialSize); in allocDynamic()
283 dp->logicalSize = initialSize; in allocDynamic()
284 dp->dataGood = TRUE; in allocDynamic()
285 dp->data = data; in allocDynamic()
288 dp->realSize = initialSize; in allocDynamic()
289 dp->dataGood = TRUE; in allocDynamic()
290 dp->pos = 0; in allocDynamic()
296 static int appendDynamic (dynamicPtr * dp, const void *src, int size) in appendDynamic() argument
301 if (!dp->dataGood) { in appendDynamic()
306 bytesNeeded = dp->pos + size; in appendDynamic()
308 if (bytesNeeded > dp->realSize) { in appendDynamic()
310 if (!dp->freeOK) { in appendDynamic()
313 gdReallocDynamic(dp, bytesNeeded * 2); in appendDynamic()
319 tmp = (char *) dp->data; in appendDynamic()
320 memcpy((void *) (tmp + (dp->pos)), src, size); in appendDynamic()
321 dp->pos += size; in appendDynamic()
323 if (dp->pos > dp->logicalSize) { in appendDynamic()
324 dp->logicalSize = dp->pos; in appendDynamic()
331 static int gdReallocDynamic (dynamicPtr * dp, int required) in gdReallocDynamic() argument
336 if ((newPtr = gdRealloc(dp->data, required))) { in gdReallocDynamic()
337 dp->realSize = required; in gdReallocDynamic()
338 dp->data = newPtr; in gdReallocDynamic()
346 memcpy(newPtr, dp->data, dp->logicalSize); in gdReallocDynamic()
347 gdFree(dp->data); in gdReallocDynamic()
348 dp->data = newPtr; in gdReallocDynamic()
350 dp->realSize = required; in gdReallocDynamic()
356 static int trimDynamic (dynamicPtr * dp) in trimDynamic() argument
359 if (!dp->freeOK) { in trimDynamic()
362 return gdReallocDynamic(dp, dp->logicalSize); in trimDynamic()