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
156 dp = dctx->dp; in dynamicSeek()
158 if (!dp->dataGood) { in dynamicSeek()
163 if (bytesNeeded > dp->realSize) { in dynamicSeek()
165 if (!dp->freeOK) { in dynamicSeek()
168 gdReallocDynamic (dp, dp->realSize * 2); in dynamicSeek()
174 if (pos > dp->logicalSize) { in dynamicSeek()
175 dp->logicalSize = pos; in dynamicSeek()
178 dp->pos = pos; in dynamicSeek()
186 dynamicPtr *dp; in newDynamic() local
187 dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr)); in newDynamic()
189 allocDynamic (dp, initialSize, data); in newDynamic()
191 dp->pos = 0; in newDynamic()
192 dp->freeOK = freeOKFlag; in newDynamic()
194 return dp; in newDynamic()
203 appendDynamic (dctx->dp, buf, size); in dynamicPutbuf()
205 if (dctx->dp->dataGood) in dynamicPutbuf()
224 appendDynamic(dctx->dp, &b, 1); in dynamicPutchar()
231 dynamicPtr *dp; in dynamicGetbuf() local
234 dp = dctx->dp; in dynamicGetbuf()
236 remain = dp->logicalSize - dp->pos; in dynamicGetbuf()
246 memcpy(buf, (void *) ((char *) dp->data + dp->pos), rlen); in dynamicGetbuf()
247 dp->pos += rlen; in dynamicGetbuf()
272 allocDynamic (dynamicPtr * dp, int initialSize, void *data) in allocDynamic() argument
276 dp->logicalSize = 0; in allocDynamic()
277 dp->dataGood = FALSE; in allocDynamic()
278 dp->data = gdMalloc(initialSize); in allocDynamic()
280 dp->logicalSize = initialSize; in allocDynamic()
281 dp->dataGood = TRUE; in allocDynamic()
282 dp->data = data; in allocDynamic()
285 dp->realSize = initialSize; in allocDynamic()
286 dp->dataGood = TRUE; in allocDynamic()
287 dp->pos = 0; in allocDynamic()
293 static int appendDynamic (dynamicPtr * dp, const void *src, int size) in appendDynamic() argument
298 if (!dp->dataGood) { in appendDynamic()
303 bytesNeeded = dp->pos + size; in appendDynamic()
305 if (bytesNeeded > dp->realSize) { in appendDynamic()
307 if (!dp->freeOK) { in appendDynamic()
310 gdReallocDynamic(dp, bytesNeeded * 2); in appendDynamic()
316 tmp = (char *) dp->data; in appendDynamic()
317 memcpy((void *) (tmp + (dp->pos)), src, size); in appendDynamic()
318 dp->pos += size; in appendDynamic()
320 if (dp->pos > dp->logicalSize) { in appendDynamic()
321 dp->logicalSize = dp->pos; in appendDynamic()
328 static int gdReallocDynamic (dynamicPtr * dp, int required) in gdReallocDynamic() argument
333 if ((newPtr = gdRealloc(dp->data, required))) { in gdReallocDynamic()
334 dp->realSize = required; in gdReallocDynamic()
335 dp->data = newPtr; in gdReallocDynamic()
343 memcpy(newPtr, dp->data, dp->logicalSize); in gdReallocDynamic()
344 gdFree(dp->data); in gdReallocDynamic()
345 dp->data = newPtr; in gdReallocDynamic()
347 dp->realSize = required; in gdReallocDynamic()
353 static int trimDynamic (dynamicPtr * dp) in trimDynamic() argument
356 if (!dp->freeOK) { in trimDynamic()
359 return gdReallocDynamic(dp, dp->logicalSize); in trimDynamic()