# HG changeset patch # User Matti Hamalainen # Date 1560373314 -10800 # Node ID 9b7d5e219d4b2a48cc49e4638dc9a176a4872266 # Parent ec47c60d26e2ec8a15dc1ae2a44c8b73c8ad753a Cleanups. diff -r ec47c60d26e2 -r 9b7d5e219d4b tools/lib64fmts.c --- 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)) {