changeset 2188:9b7d5e219d4b

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 13 Jun 2019 00:01:54 +0300
parents ec47c60d26e2
children 83391646ff16
files tools/lib64fmts.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64fmts.c	Wed Jun 12 21:47:29 2019 +0300
+++ b/tools/lib64fmts.c	Thu Jun 13 00:01:54 2019 +0300
@@ -1045,8 +1045,7 @@
     for (size_t n = 0; n < 0x100; n++)
         dstBuf[0x40 + n] = 0x00;
 
-    dmGrowBufConstCreateFrom(&tmp, dstBuf, dstSize);
-    res = dmC64DecodeGenericBMP(img, &tmp, fmt);
+    res = dmC64DecodeGenericBMP(img, dmGrowBufConstCreateFrom(&tmp, dstBuf, dstSize), fmt);
 
 out:
     dmFree(dstBuf);
@@ -1054,14 +1053,14 @@
 }
 
 
-#define FUNPAINT2_HEADER_SIZE (0x10)
-static const char *fmtFunPaint2MagicID = "FUNPAINT (MT) ";
+static const char *fmtFunPaint2_MagicID = "FUNPAINT (MT) ";
+#define fmtFunPaint2_Header_Size (0x10)
 
 
 static int fmtProbeFunPaint2(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
 {
     if (buf->len > 30 &&
-        DM_MEMCMP_LEN(buf->data + 2, fmtFunPaint2MagicID) == 0)
+        DM_MEMCMP_LEN(buf->data + 2, fmtFunPaint2_MagicID) == 0)
     {
         // Unpacked variant
         if (fmt->size != 0 && buf->data[14 + 2] == 0)
@@ -1092,7 +1091,7 @@
         cfg.flags        = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
         cfg.rleMarkerB   = buf->data[15];
 
-        dmGrowBufCopyOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE, 1);
+        dmGrowBufCopyOffs(&tmp, buf, fmtFunPaint2_Header_Size, 1);
         tmp.len = tmp.size;
 
         if ((res = dmDecodeGenericRLEAlloc(
@@ -1104,7 +1103,7 @@
     }
     else
     {
-        res = dmC64DecodeGenericBMP(img, dmGrowBufConstCopyOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE), fmt);
+        res = dmC64DecodeGenericBMP(img, dmGrowBufConstCopyOffs(&tmp, buf, fmtFunPaint2_Header_Size), fmt);
     }
 
     return res;
@@ -1114,7 +1113,7 @@
 static int fmtEncodeFunPaint2Unpacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
 {
     // Add the header bits
-    if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) ||
+    if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2_MagicID, strlen(fmtFunPaint2_MagicID)) ||
         !dmGrowBufPutU8(buf, 0) || // 0 == unpacked variant
         !dmGrowBufPutU8(buf, 0))   // RLE marker byte (not used in unpacked)
         return DMERR_MALLOC;
@@ -1143,7 +1142,7 @@
     dmGenericRLEAnalyze(&mem, &cfg);
 
     // Add the header bits
-    if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) ||
+    if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2_MagicID, strlen(fmtFunPaint2_MagicID)) ||
         !dmGrowBufPutU8(buf, 1) || // non-zero == packed variant
         !dmGrowBufPutU8(buf, cfg.rleMarkerB))
     {