# HG changeset patch # User Matti Hamalainen # Date 1528718026 -10800 # Node ID 768fddda73e93aaadf2f07cfaf7e07c5b205cdbd # Parent b9f3c1796fba03fee736e5a3c811c4e53f6b9991 Convert fmtDecodeAmicaPaintPacked() to use the new DMGrowBuf functions. diff -r b9f3c1796fba -r 768fddda73e9 tools/lib64fmts.c --- a/tools/lib64fmts.c Mon Jun 11 14:42:12 2018 +0300 +++ b/tools/lib64fmts.c Mon Jun 11 14:53:46 2018 +0300 @@ -296,11 +296,10 @@ // Amica Paint apparently is broken and stores one byte less than it should // so we need to do some crappy buffer expansion here .. - if ((res = dmGrowBufAlloc(&tmp, buf->len + 4, 4)) != DMERR_OK) - return res; + if (dmGrowBufCopy(&tmp, buf, 1) == NULL) + return DMERR_MALLOC; - memcpy(tmp.data, buf->data, buf->len); - tmp.len = buf->len + 1; + tmp.len = tmp.size; // Now do an RLE decode on the enlarged buffer cfg.func = fmt->name;