comparison tools/lib64fmts.c @ 1751:768fddda73e9

Convert fmtDecodeAmicaPaintPacked() to use the new DMGrowBuf functions.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 11 Jun 2018 14:53:46 +0300
parents feaf5cf07603
children fe3ae3fdf0f3
comparison
equal deleted inserted replaced
1750:b9f3c1796fba 1751:768fddda73e9
294 DMGrowBuf mem, tmp; 294 DMGrowBuf mem, tmp;
295 DMCompParams cfg; 295 DMCompParams cfg;
296 296
297 // Amica Paint apparently is broken and stores one byte less than it should 297 // Amica Paint apparently is broken and stores one byte less than it should
298 // so we need to do some crappy buffer expansion here .. 298 // so we need to do some crappy buffer expansion here ..
299 if ((res = dmGrowBufAlloc(&tmp, buf->len + 4, 4)) != DMERR_OK) 299 if (dmGrowBufCopy(&tmp, buf, 1) == NULL)
300 return res; 300 return DMERR_MALLOC;
301 301
302 memcpy(tmp.data, buf->data, buf->len); 302 tmp.len = tmp.size;
303 tmp.len = buf->len + 1;
304 303
305 // Now do an RLE decode on the enlarged buffer 304 // Now do an RLE decode on the enlarged buffer
306 cfg.func = fmt->name; 305 cfg.func = fmt->name;
307 cfg.type = DM_COMP_RLE_MARKER; 306 cfg.type = DM_COMP_RLE_MARKER;
308 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; 307 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;