changeset 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 b9f3c1796fba
children fe3ae3fdf0f3
files tools/lib64fmts.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;