Mercurial > hg > dmlib
diff tools/lib64fmts.c @ 2586:9807ae37ad69
Require stdbool.h, we require C11 now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Dec 2022 15:59:22 +0200 |
parents | b0fc26d9fc26 |
children | b2c510f851dc |
line wrap: on
line diff
--- a/tools/lib64fmts.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/lib64fmts.c Thu Dec 08 15:59:22 2022 +0200 @@ -19,7 +19,7 @@ dmCompareAddr16(buf, 0, fmt->addr)) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -45,7 +45,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -78,7 +78,7 @@ return DM_PROBE_SCORE_MAX; } - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -266,7 +266,7 @@ } DMSupeResEncCtx; -static BOOL fmtEncodeSupeResRun(DMSupeResEncCtx *ctx) +static bool fmtEncodeSupeResRun(DMSupeResEncCtx *ctx) { if (ctx->cnt2 == 255) ctx->cnt2 = 0x24; @@ -274,33 +274,33 @@ if (ctx->cnt2 > 216) { if (!dmGrowBufPutU8(ctx->buf, 0x25)) - return FALSE; + return false; } else ctx->cnt2 += 0x26; if (!dmGrowBufPutU8(ctx->buf, ctx->cnt2)) - return FALSE; + return false; ctx->cnt1 = ctx->cnt2 = 0; - return TRUE; + return true; } -static BOOL fmtEncodeSupeResFlush(DMSupeResEncCtx *ctx) +static bool fmtEncodeSupeResFlush(DMSupeResEncCtx *ctx) { ctx->cnt1 += 0x26; if (!dmGrowBufPutU8(ctx->buf, 0x20) || !dmGrowBufPutU8(ctx->buf, ctx->cnt1)) - return FALSE; + return false; return fmtEncodeSupeResRun(ctx); } -static BOOL fmtEncodeSupeResSection(DMSupeResEncCtx *ctx, const DMC64MemBlock *blk) +static bool fmtEncodeSupeResSection(DMSupeResEncCtx *ctx, const DMC64MemBlock *blk) { for (size_t offs = 0; offs < blk->size; offs++) { @@ -314,7 +314,7 @@ if (ctx->cnt1 >= 215 && !fmtEncodeSupeResFlush(ctx)) - return FALSE; + return false; continue; } @@ -322,26 +322,26 @@ if (ctx->cnt1 != 0 && ctx->dbyte != ctx->cnt2) { if (!fmtEncodeSupeResFlush(ctx)) - return FALSE; + return false; } ctx->cnt2 = ctx->dbyte; if (!fmtEncodeSupeResRun(ctx)) - return FALSE; + return false; } if (ctx->cnt1 > 0) return fmtEncodeSupeResFlush(ctx); - return TRUE; + return true; } static int fmtEncodeSupeRes(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) { DMSupeResEncCtx ctx; - BOOL bres = FALSE; + bool bres = false; // Output magic header and data type if (!dmGrowBufPut(buf, fmtSupeRes_MagicID_1, sizeof(fmtSupeRes_MagicID_1)) || @@ -414,7 +414,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -498,7 +498,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -587,7 +587,7 @@ buf->data[0x0c44 - 0x0801 + 2] == 0x14) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -603,7 +603,7 @@ static int fmtProbeKoalaPainter(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { - int score = DM_PROBE_SCORE_FALSE; + int score = DM_PROBE_SCORE_false; if (buf->len == 10003 || buf->len == 10004) @@ -624,7 +624,7 @@ dmCompareAddr16(buf, 0, fmt->addr)) return DM_PROBE_SCORE_GOOD; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -643,7 +643,7 @@ return DM_PROBE_SCORE_MAX; } - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -653,7 +653,7 @@ dmCompareAddr16(buf, 0, 0x2000)) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -686,7 +686,7 @@ DMCompParams cfg; // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &tmp, img, fmt)) != DMERR_OK) goto out; // And now RLE compress the data to the existing buffer @@ -716,7 +716,7 @@ )) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -751,7 +751,7 @@ const char *magicID = (fmt->format->mode & D64_FMT_ILACE) ? "DRAZLACE! 1.0" : "DRAZPAINT 2.0"; // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &tmp, img, fmt)) != DMERR_OK) goto out; // Analyze and setup RLE @@ -788,7 +788,7 @@ DM_MEMCMP_LEN(buf->data + 2, "DRAZLACE! 1.0") == 0) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -833,7 +833,7 @@ DM_MEMCMP_LEN(buf->data + 2, fmtBDP5_MagicID) == 0) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -876,7 +876,7 @@ DMCompParams cfg; // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &mem, img, fmt)) != DMERR_OK) goto out; // Analyze and setup RLE @@ -920,7 +920,7 @@ memcmp(buf->data + fmtGunPaint_MagicOffs + 2, fmtGunPaint_MagicID, fmtGunPaint_MagicLen) == 0) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -944,13 +944,13 @@ size_t i, n; if (buf->len < 256 || !dmCompareAddr16(buf, 0, fmt->addr)) - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; // Interpaint Hi-Res gives a false positive // as do some GunPaint images .. if (buf->len == 9002 || fmtProbeGunPaint(buf, fmt) > DM_PROBE_SCORE_GOOD) - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; for (n = 0, i = 2; i < buf->len; i++) if (buf->data[i] == 0xC2) n++; @@ -962,7 +962,7 @@ if (n > 10) return DM_PROBE_SCORE_MAYBE; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1005,7 +1005,7 @@ DMCompParams cfg; // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &mem, img, fmt)) != DMERR_OK) goto out; // And now RLE compress the data to the existing buffer @@ -1030,7 +1030,7 @@ dmCompareAddr16(buf, 0, fmt->addr)) return DM_PROBE_SCORE_GOOD; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1054,7 +1054,7 @@ dmCompareAddr16(buf, 2 + 3, 0x7f3f)) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1095,7 +1095,7 @@ dmGrowBufInit(&tmp2); // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &tmp1, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &tmp1, img, fmt)) != DMERR_OK) goto out; // And now RLE compress the data to the existing buffer @@ -1174,7 +1174,7 @@ DM_MEMCMP_SIZE(buf->data + 2, magicID) == 0) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1227,12 +1227,12 @@ while ((res = fmtTruePaintGetByte(&src, &data, -1)) == DMERR_OK) { unsigned int count = 1; - BOOL found = FALSE; + bool found = false; for (int n = 0; n < 8; n++) if (codeBook1[n] == data && !found) { - found = TRUE; + found = true; switch (n) { case 4: // Y = 4, JTO = $0B @@ -1388,7 +1388,7 @@ dmCompareAddr16(buf, 0, fmt->addr)) return DM_PROBE_SCORE_MAYBE; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1425,7 +1425,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1442,7 +1442,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1459,7 +1459,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1498,7 +1498,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1522,7 +1522,7 @@ ) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1548,7 +1548,7 @@ } } - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1657,7 +1657,7 @@ return DM_PROBE_SCORE_MAX; } - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1704,7 +1704,7 @@ !dmGrowBufPutU8(buf, 0)) // RLE marker byte (not used in unpacked) return DMERR_MALLOC; - return dmC64EncodeGenericBMP(FALSE, buf, img, fmt); + return dmC64EncodeGenericBMP(false, buf, img, fmt); } @@ -1715,7 +1715,7 @@ DMCompParams cfg; // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &mem, img, fmt)) != DMERR_OK) goto out; // Analyze and setup RLE @@ -1854,7 +1854,7 @@ DM_MEMCMP_SIZE(buf->data + buf->len - sizeof(fmtCrestSHFLI_MagicID_Packed), fmtCrestSHFLI_MagicID_Packed) == 0) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -2113,7 +2113,7 @@ static int fmtProbeECIPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { - int score = DM_PROBE_SCORE_FALSE; + int score = DM_PROBE_SCORE_false; if (buf->len > 128 && dmCompareAddr16(buf, 0, fmt->addr)) @@ -2172,7 +2172,7 @@ DMCompParams cfg; // Encode the data to temp buffer - if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) + if ((res = dmC64EncodeGenericBMP(true, &tmp, img, fmt)) != DMERR_OK) goto out; // Analyze and setup RLE