Mercurial > hg > dmlib
diff tools/lib64gfx.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 | c6ee41fd98dd |
children | c3c1d3c75f53 |
line wrap: on
line diff
--- a/tools/lib64gfx.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/lib64gfx.c Thu Dec 08 15:59:22 2022 +0200 @@ -12,7 +12,7 @@ #define BUF_SIZE_GROW (4*1024) -int dmC64PaletteFromC64Colors(DMPalette **ppal, const DMColor *colors, const BOOL mixed) +int dmC64PaletteFromC64Colors(DMPalette **ppal, const DMColor *colors, const bool mixed) { int res; @@ -52,7 +52,7 @@ } -int dmC64PaletteFromC64Palette(DMPalette **ppal, const DMC64Palette *cpal, const BOOL mixed) +int dmC64PaletteFromC64Palette(DMPalette **ppal, const DMC64Palette *cpal, const bool mixed) { if (ppal == NULL || cpal == NULL) return DMERR_NULLPTR; @@ -61,7 +61,7 @@ } -int dmC64SetImagePalette(DMImage *img, const DMC64ImageConvSpec *spec, const BOOL mixed) +int dmC64SetImagePalette(DMImage *img, const DMC64ImageConvSpec *spec, const bool mixed) { if (img == NULL || spec == NULL) return DMERR_NULLPTR; @@ -70,7 +70,7 @@ if (!img->constpal) dmPaletteFree(img->pal); - img->constpal = FALSE; + img->constpal = false; // If specific palette is wanted, use it if (spec->pal != NULL) @@ -87,7 +87,7 @@ } -BOOL dmCompareAddr16(const DMGrowBuf *buf, const size_t offs, const Uint16 addr) +bool dmCompareAddr16(const DMGrowBuf *buf, const size_t offs, const Uint16 addr) { return offs + 1 < buf->len && @@ -225,7 +225,7 @@ int dmC64ConvertCSDataToImage(DMImage *img, const int xoffs, const int yoffs, const Uint8 *buf, - const int width, const int height, const BOOL multicolor, + const int width, const int height, const bool multicolor, const int *colors) { int yc, widthpx = width * 8; @@ -349,12 +349,12 @@ if (src != NULL && (cfg->flags & DM_RLE_BACKWARDS_INPUT)) { src->offs = src->len; - src->backwards = TRUE; + src->backwards = true; } if (dst != NULL && (cfg->flags & DM_RLE_BACKWARDS_OUTPUT)) { - dst->backwards = TRUE; + dst->backwards = true; dst->offs = dst->size; } @@ -566,7 +566,7 @@ int dmEncodeGenericRLESequence(DMGrowBuf *dst, const Uint8 data, unsigned int count, const DMCompParams *cfg) { - BOOL copyOnly = FALSE; + bool copyOnly = false; int res; switch (cfg->type) @@ -622,7 +622,7 @@ } } else - copyOnly = TRUE; + copyOnly = true; break; case DM_COMP_RLE_MASK: @@ -635,7 +635,7 @@ goto out; } else - copyOnly = TRUE; + copyOnly = true; break; } @@ -1075,7 +1075,7 @@ } -int dmC64EncodeGenericBMP(const BOOL allocate, DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) +int dmC64EncodeGenericBMP(const bool allocate, DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) { DMC64EncDecCtx ctx; int res = DMERR_OK; @@ -1481,7 +1481,7 @@ int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *pspec) { DMC64ImageConvSpec spec; - BOOL mixed; + bool mixed; int res; if (pdst == NULL || src == NULL || pspec == NULL) @@ -1533,7 +1533,7 @@ return DMERR_OUT_OF_DATA; dmGrowBufConstCopyOffs(&tmp, buf, probeOffs); - if (dmC64ProbeBMP(&tmp, fmt) == DM_PROBE_SCORE_FALSE) + if (dmC64ProbeBMP(&tmp, fmt) == DM_PROBE_SCORE_false) return DMERR_NOT_SUPPORTED; } @@ -1643,7 +1643,7 @@ if (fmt->encode != NULL) res = fmt->encode(buf, img, fmt); else - res = dmC64EncodeGenericBMP(FALSE, buf, img, fmt); + res = dmC64EncodeGenericBMP(false, buf, img, fmt); if (res != DMERR_OK) goto out; @@ -1673,12 +1673,12 @@ // is found, pointer to format description is set to *pfmt. int dmC64ProbeBMP(const DMGrowBuf *buf, const DMC64ImageFormat **pfmt) { - int scoreMax = DM_PROBE_SCORE_FALSE, scoreIndex = -1; + int scoreMax = DM_PROBE_SCORE_false, scoreIndex = -1; for (int i = 0; i < ndmC64ImageFormats; i++) { const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; - int score = DM_PROBE_SCORE_FALSE; + int score = DM_PROBE_SCORE_false; if (fmt->probe == NULL && fmt->size > 0 && fmt->addr > 0) { // Generic probe just checks matching size and load address @@ -1702,11 +1702,11 @@ return scoreMax; } else - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } -BOOL dmLib64GFXInitialized = FALSE; +bool dmLib64GFXInitialized = false; DMC64ImageFormat **dmC64ImageFormatsSorted = NULL; @@ -1730,7 +1730,7 @@ if (dmLib64GFXInitialized) dmLib64GFXClose(); - dmLib64GFXInitialized = TRUE; + dmLib64GFXInitialized = true; if ((dmC64ImageFormatsSorted = dmCalloc(ndmC64ImageFormats, sizeof(dmC64ImageFormatsSorted[0]))) == NULL) return DMERR_MALLOC; @@ -1754,5 +1754,5 @@ void dmLib64GFXClose(void) { dmFreeR(&dmC64ImageFormatsSorted); - dmLib64GFXInitialized = FALSE; + dmLib64GFXInitialized = false; }