diff tools/gfxconv.c @ 1707:a0986cfd6f9d

More consistently use DMGrowBuf in the lib64gfx APIs, and implement "backwards" RLE decoding and encoding (optionally regards input/output). Not tested very much yet, there may be bugs.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 05 Jun 2018 21:58:10 +0300
parents cf0fddd4bf52
children 55db8d6dffa5
line wrap: on
line diff
--- a/tools/gfxconv.c	Tue Jun 05 19:57:08 2018 +0300
+++ b/tools/gfxconv.c	Tue Jun 05 21:58:10 2018 +0300
@@ -1686,7 +1686,7 @@
     // Check and compute the input skip
     if (optInSkip > dataSizeOrig)
     {
-        dmErrorMsg("Input skip value %d is larger than input size %d.\n",
+        dmErrorMsg("Input skip value %d is larger than input size %" DM_PRIu_SIZE_T ".\n",
             optInSkip, dataSizeOrig);
         goto error;
     }
@@ -1694,12 +1694,12 @@
     dataBuf = dataBufOrig + optInSkip;
     dataSize = dataSizeOrig - optInSkip;
 
-
     // Perform probing, if required
     if (optInFormat == FFMT_AUTO || optInFormat == FFMT_BITMAP)
     {
         // Probe for format
         const DMC64ImageFormat *forced = NULL;
+        DMGrowBuf tbuf;
         int res;
 
         if (optForcedFormat >= 0)
@@ -1709,7 +1709,7 @@
                 forced->name, forced->type, forced->fext);
         }
 
-        res = dmC64DecodeBMP(&inC64Image, dataBuf, dataSize, optInSkip, optInSkip + 2, &inC64Fmt, forced);
+        res = dmC64DecodeBMP(&inC64Image, dmGrowBufCreateFrom(&tbuf, dataBuf, dataSize), 0, 2, &inC64Fmt, forced);
         if (forced == NULL && inC64Fmt != NULL && res == DMERR_OK)
         {
             dmMsg(1, "Probed '%s' format image, type %d, %s\n",