Mercurial > hg > dmlib
diff tools/gfxconv.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 | bb44c48cffac |
children | d683f47e4dd9 |
line wrap: on
line diff
--- a/tools/gfxconv.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/gfxconv.c Thu Dec 08 15:59:22 2022 +0200 @@ -116,7 +116,7 @@ typedef struct { - BOOL triplet, alpha; + bool triplet, alpha; DMColor color; unsigned int from, to; } DMMapValue; @@ -136,17 +136,17 @@ optShowHelp = 0; unsigned int optInSkip = 0; -BOOL optInSkipNeg = FALSE; +bool optInSkipNeg = false; int optCropMode = CROP_NONE, optCropX0, optCropY0, optCropW, optCropH; -BOOL optInMulticolor = FALSE, - optSequential = FALSE, - optRemapRemove = FALSE, - optRemapMatchAlpha = FALSE, - optUsePalette = FALSE; +bool optInMulticolor = false, + optSequential = false, + optRemapRemove = false, + optRemapMatchAlpha = false, + optUsePalette = false; int optRemapMode = REMAP_NONE; int optNRemapTable = 0, optScaleMode = SCALE_AUTO; @@ -166,7 +166,7 @@ .scaleY = 1, .nplanes = 0, .bpp = 8, - .planar = FALSE, + .planar = false, .pixfmt = 0, .compression = FCMP_BEST, }; @@ -402,7 +402,7 @@ } -BOOL dmGetConvFormat(const int type, const int format, DMConvFormat *pfmt) +bool dmGetConvFormat(const int type, const int format, DMConvFormat *pfmt) { for (int i = 0; i < nconvFormatList; i++) { @@ -411,7 +411,7 @@ fmt->format == format) { memcpy(pfmt, fmt, sizeof(DMConvFormat)); - return TRUE; + return true; } } @@ -424,18 +424,18 @@ const DMC64ImageFormat *cfmt = &dmC64ImageFormats[format]; memcpy(pfmt, fmt, sizeof(DMConvFormat)); pfmt->fext = cfmt->name; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL dmGetC64FormatByExt(const char *fext, int *type, int *format) +bool dmGetC64FormatByExt(const char *fext, int *type, int *format) { if (fext == NULL) - return FALSE; + return false; for (int i = 0; i < ndmC64ImageFormats; i++) { @@ -445,18 +445,18 @@ { *type = FFMT_BITMAP; *format = i; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL dmGetFormatByExt(const char *fext, int *type, int *format) +bool dmGetFormatByExt(const char *fext, int *type, int *format) { if (fext == NULL) - return FALSE; + return false; for (int i = 0; i < nconvFormatList; i++) { @@ -466,15 +466,15 @@ { *type = fmt->type; *format = fmt->format; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL dmParseMapOptionMapItem(const char *popt, DMMapValue *value, const unsigned int nmax, const char *msg) +bool dmParseMapOptionMapItem(const char *popt, DMMapValue *value, const unsigned int nmax, const char *msg) { char *end, *split, *opt = dm_strdup(popt); @@ -501,7 +501,7 @@ if (sscanf(opt + 1, "%2x%2x%2x%2x", &colR, &colG, &colB, &colA) == 4 || sscanf(opt + 1, "%2X%2X%2X%2X", &colR, &colG, &colB, &colA) == 4) { - value->alpha = TRUE; + value->alpha = true; value->color.a = colA; } else @@ -515,7 +515,7 @@ value->color.r = colR; value->color.g = colG; value->color.b = colB; - value->triplet = TRUE; + value->triplet = true; } else { @@ -524,7 +524,7 @@ dmErrorMsg("Invalid %s value '%s', could not parse source value '%s'.\n", msg, popt, opt); goto out; } - value->triplet = FALSE; + value->triplet = false; } // Trim whitespace @@ -551,15 +551,15 @@ } dmFree(opt); - return TRUE; + return true; out: dmFree(opt); - return FALSE; + return false; } -BOOL dmParseMapOptionItem(char *opt, char *end, void *pvalue, const int index, const int nmax, const BOOL requireIndex, const char *msg) +bool dmParseMapOptionItem(char *opt, char *end, void *pvalue, const int index, const int nmax, const bool requireIndex, const char *msg) { // Trim whitespace if (end != NULL) @@ -575,7 +575,7 @@ { DMMapValue *value = (DMMapValue *) pvalue; if (!dmParseMapOptionMapItem(opt, &value[index], nmax, msg)) - return FALSE; + return false; } else { @@ -584,21 +584,21 @@ if (split != NULL) { dmErrorMsg("Unexpected ':' in indexed %s '%s'.\n", msg, opt); - return FALSE; + return false; } if (!dmGetIntVal(opt, &value[index], NULL)) { dmErrorMsg("Invalid %s value '%s', could not parse.\n", msg, opt); - return FALSE; + return false; } } - return TRUE; + return true; } -BOOL dmParseMapOptionString(char *opt, void *values, int *nvalues, const int nmax, const BOOL requireIndex, const char *msg) +bool dmParseMapOptionString(char *opt, void *values, int *nvalues, const int nmax, const bool requireIndex, const char *msg) { char *start = opt; @@ -608,7 +608,7 @@ char *end = strchr(start, ','); if (!dmParseMapOptionItem(start, end, values, *nvalues, nmax, requireIndex, msg)) - return FALSE; + return false; (*nvalues)++; @@ -618,7 +618,7 @@ start = end + 1; } - return TRUE; + return true; } @@ -663,7 +663,7 @@ } -BOOL dmParseFormatOption(const char *msg1, const char *msg2, char *optArg, int *format, int *subFormat) +bool dmParseFormatOption(const char *msg1, const char *msg2, char *optArg, int *format, int *subFormat) { char *flags = strchr(optArg, ':'); if (flags != NULL) @@ -674,7 +674,7 @@ { dmErrorMsg("Invalid %s format '%s', see -F / --formats for format list.\n", msg1, optArg); - return FALSE; + return false; } if (flags != NULL) @@ -684,30 +684,30 @@ case FFMT_SPRITE: case FFMT_CHAR: if (strcasecmp(flags, "mc") == 0) - optInMulticolor = TRUE; + optInMulticolor = true; else if (strcasecmp(flags, "sc") == 0) - optInMulticolor = FALSE; + optInMulticolor = false; else { dmErrorMsg("Invalid %s format flags for sprite/char '%s', should be 'mc' or 'sc'.\n", msg1, flags); - return FALSE; + return false; } break; default: dmErrorMsg("%s format '%s' does not support any flags ('%s').\n", msg2, optArg, flags); - return FALSE; + return false; } } - return TRUE; + return true; } -char *dmParseValWithSep(char **arg, char *last, BOOL (*isok)(const int ch), const char *sep) +char *dmParseValWithSep(char **arg, char *last, bool (*isok)(const int ch), const char *sep) { char *ptr = *arg, *end, *start; @@ -744,19 +744,19 @@ } -BOOL dmParseIntValTok(const int ch) +bool dmParseIntValTok(const int ch) { return isxdigit(ch) || ch == 'x' || ch == '$'; } -BOOL dmParseIntValWithSep(char **arg, unsigned int *value, char *last, const char *sep) +bool dmParseIntValWithSep(char **arg, unsigned int *value, char *last, const char *sep) { return dmGetIntVal(dmParseValWithSep(arg, last, dmParseIntValTok, sep), value, NULL); } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { unsigned int tmpUInt; char *tmpStr; @@ -788,7 +788,7 @@ if (!dmGetIntVal(optArg, &optInSkip, &optInSkipNeg)) { dmErrorMsg("Invalid skip value argument '%s'.\n", optArg); - return FALSE; + return false; } break; @@ -797,14 +797,14 @@ DMConvFormat fmt; if (!dmParseFormatOption("input", "Input", optArg, &optInType, &optForcedInSubFormat)) - return FALSE; + return false; dmGetConvFormat(optInType, optForcedInSubFormat, &fmt); if ((fmt.flags & DM_FMT_RD) == 0) { dmErrorMsg("Invalid input format '%s', does not support reading.\n", fmt.name); - return FALSE; + return false; } } break; @@ -814,14 +814,14 @@ DMConvFormat fmt; if (!dmParseFormatOption("output", "Output", optArg, &optOutType, &optOutFormat)) - return FALSE; + return false; dmGetConvFormat(optOutType, optOutFormat, &fmt); if ((fmt.flags & DM_FMT_WR) == 0) { dmErrorMsg("Invalid output format '%s', does not support writing.\n", fmt.name); - return FALSE; + return false; } } break; @@ -831,7 +831,7 @@ break; case 20: - optSequential = TRUE; + optSequential = true; break; case 22: @@ -844,8 +844,8 @@ { int ncolors; if (!dmParseMapOptionString(optArg, optColorMap, - &ncolors, D64_NCOLORS, FALSE, "color index option")) - return FALSE; + &ncolors, D64_NCOLORS, false, "color index option")) + return false; dmMsg(1, "Set color index mapping: "); for (int index = 0; index < ncolors; index++) @@ -864,7 +864,7 @@ { dmErrorMsg("Invalid count value argument '%s' [1 .. MAXINT]\n", optArg); - return FALSE; + return false; } optItemCount = tmpUInt; break; @@ -875,7 +875,7 @@ { dmErrorMsg("Invalid planed width value '%s' [1 .. 512]\n", optArg); - return FALSE; + return false; } optPlanedWidth = tmpUInt; break; @@ -888,7 +888,7 @@ } else { - BOOL error = FALSE; + bool error = false; unsigned int tmpUInt2; char *tmpStr = dm_strdup(optArg), *tmpOpt = tmpStr, sep; @@ -925,10 +925,10 @@ optSpec.scaleX = optSpec.scaleY = tmpUInt; } else - error = TRUE; + error = true; } else - error = TRUE; + error = true; dmFree(tmpStr); @@ -937,24 +937,24 @@ dmErrorMsg( "Invalid scale option value '%s', should be [*]<n> or or <w>:<h>[*<n>].\n", optArg); - return FALSE; + return false; } if (optSpec.scaleX < 1 || optSpec.scaleX > 50) { dmErrorMsg("Invalid X scale value %d.\n", optSpec.scaleX); - return FALSE; + return false; } if (optSpec.scaleY < 1 || optSpec.scaleY > 50) { dmErrorMsg("Invalid Y scale value %d.\n", optSpec.scaleY); - return FALSE; + return false; } } break; case 30: - optUsePalette = TRUE; + optUsePalette = true; break; case 32: @@ -963,7 +963,7 @@ { dmErrorMsg("Invalid number of bitplanes value '%s' [1 .. 8]\n", optArg); - return FALSE; + return false; } optSpec.nplanes = tmpUInt; break; @@ -974,13 +974,13 @@ { dmErrorMsg("Invalid number of bits per plane value '%s' [1 .. 32]\n", optArg); - return FALSE; + return false; } optSpec.bpp = tmpUInt; break; case 36: - optSpec.planar = TRUE; + optSpec.planar = true; break; case 38: @@ -989,7 +989,7 @@ { dmErrorMsg("Invalid compression setting '%s' [%d .. %d]\n", optArg, FCMP_NONE, FCMP_BEST); - return FALSE; + return false; } optSpec.compression = tmpUInt; break; @@ -1003,11 +1003,11 @@ { unsigned int tx0, ty0, tx1, ty1; char sep, modeSep = 0, *tmpTok, *tmpStr; - BOOL ok; + bool ok; if ((tmpTok = tmpStr = dm_strdup(optArg)) == NULL) { dmErrorMsg("Could not allocate memory for temporary string.\n"); - return FALSE; + return false; } // Check for 'x0:y0-x1:y1' pattern @@ -1050,7 +1050,7 @@ else { dmErrorMsg("Invalid crop mode / argument '%s'.\n", optArg); - return FALSE; + return false; } } break; @@ -1073,10 +1073,10 @@ // Check what option we have if (strcasecmp(topt, "remove") == 0) - optRemapRemove = TRUE; + optRemapRemove = true; else if (strcasecmp(topt, "alpha") == 0) - optRemapMatchAlpha = TRUE; + optRemapMatchAlpha = true; else if (strncasecmp(topt, "max=", 4) == 0) { @@ -1087,7 +1087,7 @@ { dmErrorMsg("Invalid or missing value parameter for -R option flag: '%s'.\n", topt); - return FALSE; + return false; } } else @@ -1100,20 +1100,20 @@ { dmErrorMsg("Invalid or missing value parameter for -R option flag: '%s'.\n", topt); - return FALSE; + return false; } if (optRemapNoMatchColor < -1 || optRemapNoMatchColor > 255) { dmErrorMsg("Invalid remap no-match color value %d. Should be [-1 .. 255].\n", optRemapNoMatchColor); - return FALSE; + return false; } } else { dmErrorMsg("Unknown -R option flag '%s'.\n", topt); - return FALSE; + return false; } } while (*tmpStr != 0); } @@ -1124,7 +1124,7 @@ if (optRemapMode != REMAP_NONE && optRemapMode != REMAP_AUTO) { dmErrorMsg("Remap mode already set to something else than 'auto'. You can only have one remapping mode.\n"); - return FALSE; + return false; } optRemapMode = REMAP_AUTO; @@ -1134,7 +1134,7 @@ if (optRemapMode != REMAP_NONE && optRemapMode != REMAP_MAPPED) { dmErrorMsg("Remap mode already set to something else than 'mapped'. You can only have one remapping mode.\n"); - return FALSE; + return false; } if (optArg[0] == '@') @@ -1144,19 +1144,19 @@ int res; if ((res = dmParseColorRemapFile(optArg + 1, optRemapTable, &optNRemapTable, DM_MAX_COLORS)) != DMERR_OK) - return FALSE; + return false; } else { dmErrorMsg("No remap filename given.\n"); - return FALSE; + return false; } } else { if (!dmParseMapOptionString(optArg, optRemapTable, - &optNRemapTable, DM_MAX_COLORS, TRUE, "color remap option")) - return FALSE; + &optNRemapTable, DM_MAX_COLORS, true, "color remap option")) + return false; } optRemapMode = REMAP_MAPPED; @@ -1177,14 +1177,14 @@ default: dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleFile(char *currArg) +bool argHandleFile(char *currArg) { if (!optInFilename) optInFilename = currArg; @@ -1192,14 +1192,14 @@ { dmErrorMsg("Source filename already specified, extraneous argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -void dmPrintByte(FILE *out, const Uint8 byte, const int format, const BOOL multicolor, const BOOL dir) +void dmPrintByte(FILE *out, const Uint8 byte, const int format, const bool multicolor, const bool dir) { if (multicolor) { @@ -1242,18 +1242,18 @@ } -void dmDumpCharASCII(FILE *outFile, const Uint8 *buf, const size_t offs, const int fmt, const BOOL multicolor) +void dmDumpCharASCII(FILE *outFile, const Uint8 *buf, const size_t offs, const int fmt, const bool multicolor) { for (size_t yc = 0; yc < D64_CHR_HEIGHT_UT; yc++) { fprintf(outFile, "%04" DM_PRIx_SIZE_T " : ", offs + yc); - dmPrintByte(outFile, buf[yc], fmt, multicolor, FALSE); + dmPrintByte(outFile, buf[yc], fmt, multicolor, false); fprintf(outFile, "\n"); } } -void dmDumpSpriteASCII(FILE *outFile, const Uint8 *buf, const size_t offs, const int fmt, BOOL multicolor) +void dmDumpSpriteASCII(FILE *outFile, const Uint8 *buf, const size_t offs, const int fmt, bool multicolor) { size_t bufOffs, xc, yc; @@ -1262,7 +1262,7 @@ fprintf(outFile, "%04" DM_PRIx_SIZE_T " ", offs + bufOffs); for (xc = 0; xc < D64_SPR_WIDTH_UT; xc++) { - dmPrintByte(outFile, buf[bufOffs], fmt, multicolor, FALSE); + dmPrintByte(outFile, buf[bufOffs], fmt, multicolor, false); fprintf(outFile, " "); bufOffs++; } @@ -1272,7 +1272,7 @@ // XXX TODO: we need to evaluate the color vector itself, not just the distance -float dmGetColorDist(const DMColor *c1, const DMColor *c2, const BOOL alpha) +float dmGetColorDist(const DMColor *c1, const DMColor *c2, const bool alpha) { const float dr = (c1->r - c2->r) / 255.0, @@ -1289,9 +1289,9 @@ } -int dmScanUsedColors(const DMImage *src, const BOOL warn, BOOL *used, int *nused) +int dmScanUsedColors(const DMImage *src, const bool warn, bool *used, int *nused) { - BOOL warned = FALSE; + bool warned = false; *nused = 0; if (src == NULL || used == NULL || nused == NULL) @@ -1304,7 +1304,7 @@ } for (int index = 0; index < src->pal->ncolors; index++) - used[index] = FALSE; + used[index] = false; for (int yc = 0; yc < src->height; yc++) { @@ -1316,7 +1316,7 @@ { if (!used[col]) { - used[col] = TRUE; + used[col] = true; (*nused)++; } } @@ -1324,7 +1324,7 @@ if (warn && !warned) { dmErrorMsg("Image contains color indices that are out of bounds of the palette.\n"); - warned = TRUE; + warned = true; } } } @@ -1376,14 +1376,14 @@ int dmRemapImageColors(DMImage **pdst, const DMImage *src, const DMPalette *dpal, const float maxDist, const int noMatchColor, - const BOOL alpha, const BOOL removeUnused) + const bool alpha, const bool removeUnused) { DMPalette *tpal = NULL; const DMPalette *ppal; - BOOL *used = NULL; + bool *used = NULL; int *mapping = NULL, *mapped = NULL; int res = DMERR_OK; - BOOL fail = FALSE; + bool fail = false; if (pdst == NULL || src == NULL || dpal == NULL) return DMERR_NULLPTR; @@ -1454,7 +1454,7 @@ "No match for source color #%d. Closest: #%d (%02x %02x %02x) [dist=%1.3f > %1.3f]\n", sc, closestDC, dcol->r, dcol->g, dcol->b, closestDist, maxDist); - fail = TRUE; + fail = true; } else { @@ -1492,7 +1492,7 @@ } // Get the actually used colors - if ((res = dmScanUsedColors(src, TRUE, used, &nused)) != DMERR_OK) + if ((res = dmScanUsedColors(src, true, used, &nused)) != DMERR_OK) goto out; dmMsg(2, "Found %d used color indices.\n", nused); @@ -1505,12 +1505,12 @@ mapping[index] == mapping[n] && used[n] && used[index]) { - used[n] = FALSE; + used[n] = false; } } if (noMatchColor >= 0) - used[noMatchColor] = TRUE; + used[noMatchColor] = true; // Re-count number of actually used indices nused = 0; @@ -1572,13 +1572,13 @@ int dmMapImageColors(DMImage **pdst, const DMImage *src, const DMMapValue *mapTable, const int nmapTable, const float maxDist, const int noMatchColor, - const BOOL alpha, const BOOL removeUnused) + const bool alpha, const bool removeUnused) { DMPalette *tpal = NULL; - BOOL *mapped = NULL, *used = NULL; + bool *mapped = NULL, *used = NULL; int *mapping = NULL; int nused, res = DMERR_OK; - BOOL fail = FALSE; + bool fail = false; if (pdst == NULL || src == NULL || mapTable == NULL) return DMERR_NULLPTR; @@ -1603,7 +1603,7 @@ for (int index = 0; index < src->pal->ncolors; index++) { mapping[index] = -1; - mapped[index] = FALSE; + mapped[index] = false; } if ((res = dmPaletteAlloc(&tpal, src->pal->ncolors, -1)) != DMERR_OK) @@ -1652,7 +1652,7 @@ index, map->color.r, map->color.g, map->color.b, map->color.a, closestDC, dcol->r, dcol->g, dcol->b, dcol->a, closestDist, maxDist); - fail = TRUE; + fail = true; } else { @@ -1665,7 +1665,7 @@ closestDC, dcol->r, dcol->g, dcol->b, dcol->a, closestDist); mapping[closestDC] = map->to; - mapped[map->to] = TRUE; + mapped[map->to] = true; } } else @@ -1678,7 +1678,7 @@ closestDC, dcol->r, dcol->g, dcol->b, dcol->a, closestDist); mapping[closestDC] = map->to; - mapped[map->to] = TRUE; + mapped[map->to] = true; } } else @@ -1687,7 +1687,7 @@ map->from, map->to); mapping[map->from] = map->to; - mapped[map->to] = TRUE; + mapped[map->to] = true; } } @@ -1702,7 +1702,7 @@ { dmMsg(2, "Scanning for used colors.\n"); - if ((res = dmScanUsedColors(src, TRUE, used, &nused)) != DMERR_OK) + if ((res = dmScanUsedColors(src, true, used, &nused)) != DMERR_OK) goto out; dmMsg(2, "Removing unused colors: %d -> %d.\n", @@ -1717,7 +1717,7 @@ if (!mapped[n]) { mapping[index] = n; - mapped[n] = TRUE; + mapped[n] = true; break; } } @@ -1985,7 +1985,7 @@ { int res = DMERR_OK; DMImage *image = pimage; - BOOL allocated = FALSE; + bool allocated = false; // Check if writing is even supported if (fmt->write == NULL || (fmt->flags & DM_FMT_WR) == 0) @@ -2043,7 +2043,7 @@ optRemapMatchAlpha, optRemapRemove)) != DMERR_OK) goto out; - allocated = TRUE; + allocated = true; break; case REMAP_AUTO: @@ -2060,7 +2060,7 @@ optRemapMatchAlpha, optRemapRemove)) != DMERR_OK) goto out; - allocated = TRUE; + allocated = true; break; } } @@ -2207,7 +2207,7 @@ } -Uint8 dmConvertByte(const Uint8 *sp, const BOOL multicolor) +Uint8 dmConvertByte(const Uint8 *sp, const bool multicolor) { Uint8 byte = 0; int xc; @@ -2233,15 +2233,15 @@ } -BOOL dmConvertImage2Char(Uint8 *buf, const DMImage *image, - const int xoffs, const int yoffs, const BOOL multicolor) +bool dmConvertImage2Char(Uint8 *buf, const DMImage *image, + const int xoffs, const int yoffs, const bool multicolor) { int yc; if (xoffs < 0 || yoffs < 0 || xoffs + D64_CHR_WIDTH_PX > image->width || yoffs + D64_CHR_HEIGHT_PX > image->height) - return FALSE; + return false; for (yc = 0; yc < D64_CHR_HEIGHT_UT; yc++) { @@ -2249,19 +2249,19 @@ buf[yc] = dmConvertByte(sp, multicolor); } - return TRUE; + return true; } -BOOL dmConvertImage2Sprite(Uint8 *buf, const DMImage *image, - const int xoffs, const int yoffs, const BOOL multicolor) +bool dmConvertImage2Sprite(Uint8 *buf, const DMImage *image, + const int xoffs, const int yoffs, const bool multicolor) { int yc, xc; if (xoffs < 0 || yoffs < 0 || xoffs + D64_SPR_WIDTH_PX > image->width || yoffs + D64_SPR_HEIGHT_PX > image->height) - return FALSE; + return false; for (yc = 0; yc < D64_SPR_HEIGHT_UT; yc++) { @@ -2272,11 +2272,11 @@ } } - return TRUE; + return true; } -int dmWriteSpritesAndChars(const char *filename, DMImage *image, int outFormat, const BOOL multicolor) +int dmWriteSpritesAndChars(const char *filename, DMImage *image, int outFormat, const bool multicolor) { int ret = DMERR_OK; int outBlockW, outBlockH, bx, by; @@ -2411,7 +2411,7 @@ if (optOutType == FFMT_ANSI || optOutType == FFMT_ASCII) { - BOOL error = FALSE; + bool error = false; FILE *outFile; if (optOutFilename == NULL) @@ -2483,7 +2483,7 @@ outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight, DM_PIXFMT_PALETTE, -1); } - if ((err = dmC64SetImagePalette(outImage, &optC64Spec, FALSE)) != DMERR_OK) + if ((err = dmC64SetImagePalette(outImage, &optC64Spec, false)) != DMERR_OK) { dmErrorMsg("Could not allocate C64 palette for output image: %d\n", err); goto out; @@ -2636,7 +2636,7 @@ case 2: argShowHelp(); argShowFormats(); - argShowC64Formats(stdout, TRUE, TRUE); + argShowC64Formats(stdout, true, true); argShowC64PaletteHelp(stdout); for (int n = 0; n < optListN; n++) @@ -2649,7 +2649,7 @@ case 3: argShowFormats(); - argShowC64Formats(stdout, TRUE, dmVerbosity > 0); + argShowC64Formats(stdout, true, dmVerbosity > 0); goto out; } @@ -2877,7 +2877,7 @@ dmMsg(1, "Using internal palette '%s' (%s).\n", optC64Palette->name, optC64Palette->desc); - if ((res = dmC64PaletteFromC64Palette(&optPaletteData, optC64Palette, FALSE)) != DMERR_OK) + if ((res = dmC64PaletteFromC64Palette(&optPaletteData, optC64Palette, false)) != DMERR_OK) { dmErrorMsg("Could not set up palette: %s.\n", dmErrorStr(res)); @@ -2907,7 +2907,7 @@ dmMsg(1, "Using internal palette '%s' (%s).\n", optC64Palette->name, optC64Palette->desc); - if ((res = dmC64PaletteFromC64Palette(&optPaletteData, optC64Palette, FALSE)) != DMERR_OK) + if ((res = dmC64PaletteFromC64Palette(&optPaletteData, optC64Palette, false)) != DMERR_OK) { dmErrorMsg("Could not set up palette: %s.\n", dmErrorStr(res));