# HG changeset patch # User Matti Hamalainen # Date 1670507962 -7200 # Node ID 9807ae37ad69bb14f92703cc8cf41c9d55ec4e08 # Parent ef6c826c5b7a10a3afb6048e32a1ab11af0c1f08 Require stdbool.h, we require C11 now. diff -r ef6c826c5b7a -r 9807ae37ad69 Makefile.gen --- a/Makefile.gen Thu Dec 08 15:56:36 2022 +0200 +++ b/Makefile.gen Thu Dec 08 15:59:22 2022 +0200 @@ -21,9 +21,9 @@ # -march=corei7 endif -CFLAGS += -g -W -Wall $(EXTRA_CFLAGS) -#CFLAGS += -std=c11 -D_FILE_OFFSET_BITS=64 -D_POSIX_C_SOURCE=200808L +CFLAGS += -g -W -Wall -D_FILE_OFFSET_BITS=64 -D_POSIX_C_SOURCE=200808L $(EXTRA_CFLAGS) CXXFLAGS = $(CFLAGS) +CFLAGS += -std=c11 DM_CFLAGS += -I$(DMLIB_SRC) $(SDL_CFLAGS) DM_LDFLAGS += $(LDFLAGS) diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jloadjss.c --- a/minijss/jloadjss.c Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jloadjss.c Thu Dec 08 15:59:22 2022 +0200 @@ -374,7 +374,7 @@ #endif -int jssLoadJSSMOD(DMResource *inFile, JSSModule **pmodule, BOOL probe) +int jssLoadJSSMOD(DMResource *inFile, JSSModule **pmodule, bool probe) { JSSModule *module; JSSMODHeader jssH; diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jloadxm.c --- a/minijss/jloadxm.c Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jloadxm.c Thu Dec 08 15:59:22 2022 +0200 @@ -311,7 +311,7 @@ XMPattern xmP; off_t remainder, pos = dmftell(inFile); Uint32 headSize = 0; - BOOL ret = FALSE; + bool ret = false; int res; // Get the pattern header size and packing @@ -709,20 +709,20 @@ } -static BOOL jssXMLoadEnvelopePoints(DMResource *inFile, XMEnvelope *env) +static bool jssXMLoadEnvelopePoints(DMResource *inFile, XMEnvelope *env) { int i; for (i = 0; i < XM_MaxEnvPoints; i++) { if (!dmf_read_le16(inFile, &(env->points[i].frame)) || !dmf_read_le16(inFile, &(env->points[i].value))) - return FALSE; + return false; } - return TRUE; + return true; } -static BOOL jssXMLoadEnvelopeData(DMResource *inFile, XMEnvelope *env) +static bool jssXMLoadEnvelopeData(DMResource *inFile, XMEnvelope *env) { return dmf_read_byte(inFile, &(env->sustain)) && @@ -918,7 +918,7 @@ /* Load XM-format module from given file-stream */ -int jssLoadXM(DMResource *inFile, JSSModule **pmodule, BOOL probe) +int jssLoadXM(DMResource *inFile, JSSModule **pmodule, bool probe) { JSSModule *module; XMHeader xmH; diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jss.c --- a/minijss/jss.c Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jss.c Thu Dec 08 15:59:22 2022 +0200 @@ -10,7 +10,7 @@ /* Memory and error handling functions */ -BOOL jssWarningIsFatal, jssErrorIsFatal; +bool jssWarningIsFatal, jssErrorIsFatal; #ifndef JSS_LIGHT @@ -60,8 +60,8 @@ { // Error handling #ifndef JSS_LIGHT - jssWarningIsFatal = FALSE; - jssErrorIsFatal = TRUE; + jssWarningIsFatal = false; + jssErrorIsFatal = true; jssError = jssDefaultError; jssWarning = jssDefaultWarning; diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jss.h --- a/minijss/jss.h Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jss.h Thu Dec 08 15:59:22 2022 +0200 @@ -72,8 +72,8 @@ /* Error handling routines and related variables */ #ifndef JSS_LIGHT -extern BOOL jssWarningIsFatal, // if TRUE, warnings are considered fatal -> function returns - jssErrorIsFatal; // if FALSE, error is considered non-fatal. this may cause strange problems. +extern bool jssWarningIsFatal, // if true, warnings are considered fatal -> function returns + jssErrorIsFatal; // if false, error is considered non-fatal. this may cause strange problems. extern void (*jssError)(int code, const char *filename, int linen, const char *fmt, ...); extern void (*jssWarning)(int code, const char *filename, int linen, const char *fmt, ...); diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jssmix.c --- a/minijss/jssmix.c Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jssmix.c Thu Dec 08 15:59:22 2022 +0200 @@ -260,7 +260,7 @@ DMFixedPoint end; FP_ADD_R(end, chn->chLoopE, chn->chLoopE); FP_SUB_R(chn->chPos, end, chn->chPos); - chn->chDirection = FALSE; + chn->chDirection = false; } } else @@ -279,7 +279,7 @@ // Normal (non-looped) sample if (chn->chPos.dw >= chn->chSize.dw) { - chn->chPlaying = FALSE; + chn->chPlaying = false; return; } } @@ -298,7 +298,7 @@ DMFixedPoint start; FP_ADD_R(start, chn->chLoopS, chn->chLoopS); FP_SUB_R(chn->chPos, start, chn->chPos); - chn->chDirection = TRUE; + chn->chDirection = true; } } else @@ -317,7 +317,7 @@ // Normal (non-looped) sample if (chn->chPos.dw <= 0) { - chn->chPlaying = FALSE; + chn->chPlaying = false; return; } } @@ -486,7 +486,7 @@ void jvmPlay(JSSMixer * mixer, const int channel) { JSS_LOCK(mixer); - mixer->channels[channel].chPlaying = TRUE; + mixer->channels[channel].chPlaying = true; JSS_UNLOCK(mixer); } @@ -494,7 +494,7 @@ void jvmStop(JSSMixer * mixer, const int channel) { JSS_LOCK(mixer); - mixer->channels[channel].chPlaying = FALSE; + mixer->channels[channel].chPlaying = false; JSS_UNLOCK(mixer); } @@ -506,7 +506,7 @@ JSS_LOCK(mixer); c = &mixer->channels[channel]; - c->chDirection = TRUE; + c->chDirection = true; c->chPos.dw = c->chDeltaO.dw = 0; JSS_UNLOCK(mixer); @@ -527,7 +527,7 @@ FP_SETHL(c->chLoopE, loopE, 0); c->chData = data; c->chFlags = flags; - c->chDirection = TRUE; + c->chDirection = true; c->chPos.dw = c->chDeltaO.dw = 0; JSS_UNLOCK(mixer); @@ -669,7 +669,7 @@ } -void jvmMute(JSSMixer * mixer, const int channel, const BOOL mute) +void jvmMute(JSSMixer * mixer, const int channel, const bool mute) { JSS_LOCK(mixer); mixer->channels[channel].chMute = mute; @@ -677,9 +677,9 @@ } -BOOL jvmGetMute(JSSMixer * mixer, const int channel) +bool jvmGetMute(JSSMixer * mixer, const int channel) { - BOOL tmp; + bool tmp; JSS_LOCK(mixer); tmp = mixer->channels[channel].chMute; diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jssmix.h --- a/minijss/jssmix.h Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jssmix.h Thu Dec 08 15:59:22 2022 +0200 @@ -46,9 +46,9 @@ void *chData; // Pointer to data - BOOL chPlaying, // TRUE = playing - chMute, // TRUE = muted - chDirection; // TRUE = playing forwards, FALSE = backwards + bool chPlaying, // true = playing + chMute, // true = muted + chDirection; // true = playing forwards, false = backwards int chFlags; // Flags @@ -154,8 +154,8 @@ void jvmSetPanRamp(JSSMixer * mixer, const int channel, const int start, const int end, const int len); int jvmGetPan(JSSMixer *mixer, const int channel); -void jvmMute(JSSMixer *mixer, const int channel, const BOOL mute); -BOOL jvmGetMute(JSSMixer *mixer, const int channel); +void jvmMute(JSSMixer *mixer, const int channel, const bool mute); +bool jvmGetMute(JSSMixer *mixer, const int channel); void jvmClear(JSSMixer *mixer, const int channel); void jvmClearChannels(JSSMixer *mixer); diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jssmod.c --- a/minijss/jssmod.c Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jssmod.c Thu Dec 08 15:59:22 2022 +0200 @@ -386,7 +386,7 @@ for (int chn = 0; chn < nchannels; chn++) { pattern->map[chn] = chn; - pattern->used[chn] = TRUE; + pattern->used[chn] = true; } return pattern; diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jssmod.h --- a/minijss/jssmod.h Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jssmod.h Thu Dec 08 15:59:22 2022 +0200 @@ -144,7 +144,7 @@ typedef struct { int nrows, nchannels, nmap; - BOOL *used; + bool *used; Uint8 *map; JSSNote *data; } JSSPattern; @@ -324,11 +324,11 @@ void jssFreeExtInstrument(JSSExtInstrument *inst); #ifdef JSS_SUP_XM -int jssLoadXM(DMResource *file, JSSModule **pmodule, BOOL probe); +int jssLoadXM(DMResource *file, JSSModule **pmodule, bool probe); #endif #ifdef JSS_SUP_JSSMOD -int jssLoadJSSMOD(DMResource *file, JSSModule **pmodule, BOOL probe); +int jssLoadJSSMOD(DMResource *file, JSSModule **pmodule, bool probe); #endif diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jssplr.c --- a/minijss/jssplr.c Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jssplr.c Thu Dec 08 15:59:22 2022 +0200 @@ -118,12 +118,12 @@ } -static BOOL jmpExecEnvelope(JSSEnvelope *env, JSSPlayerEnvelope *pe, BOOL keyOff) +static bool jmpExecEnvelope(JSSEnvelope *env, JSSPlayerEnvelope *pe, bool keyOff) { int point; if (!pe->exec) - return FALSE; + return false; // Find current point, if not last point for (point = 0; point < env->npoints - 1; point++) @@ -143,7 +143,7 @@ if (pe->frame >= env->points[env->npoints - 1].frame) { point = env->npoints - 1; - pe->exec = FALSE; + pe->exec = false; pe->value = env->points[point].value; } else @@ -172,7 +172,7 @@ pe->frame++; } - return TRUE; + return true; } @@ -280,7 +280,7 @@ static void jmpResetEnvelope(JSSPlayerEnvelope *env) { env->frame = env->value = 0; - env->exec = TRUE; + env->exec = true; } @@ -305,8 +305,8 @@ // Initialize general variables mp->patternDelay = 0; - mp->newRowSet = FALSE; - mp->newOrderSet = FALSE; + mp->newRowSet = false; + mp->newOrderSet = false; mp->tick = jsetNotSet; mp->row = 0; mp->lastPatLoopRow = 0; @@ -345,7 +345,7 @@ if (mp->isPlaying) { jvmRemoveCallback(mp->device); - mp->isPlaying = FALSE; + mp->isPlaying = false; } JSS_UNLOCK(mp); @@ -365,7 +365,7 @@ if (result != DMERR_OK) JSSERROR(result,, "Could not initialize callback for player.\n"); - mp->isPlaying = TRUE; + mp->isPlaying = true; } JSS_UNLOCK(mp); @@ -378,16 +378,16 @@ */ static void jmpSetNewOrder(JSSPlayer * mp, int order) { - BOOL orderOK; + bool orderOK; mp->order = jsetNotSet; - orderOK = FALSE; + orderOK = false; while (!orderOK) { if (order < 0 || order >= mp->module->norders) { jmpStop(mp); - orderOK = TRUE; + orderOK = true; } else { @@ -400,12 +400,12 @@ if (pattern >= mp->module->npatterns || pattern == jsetOrderEnd) { jmpStop(mp); - orderOK = TRUE; + orderOK = true; } else { // All OK - orderOK = TRUE; + orderOK = true; mp->pattern = mp->module->patterns[pattern]; mp->npattern = pattern; mp->order = order; @@ -462,7 +462,7 @@ JSSERROR(result, result, "Could not initialize callback for player.\n"); } - mp->isPlaying = TRUE; + mp->isPlaying = true; return DMERR_OK; } @@ -704,7 +704,7 @@ jmpChangeVolume(chn, channel, -paramY); } -static void jmpTriggerNote(JSSPlayer * mp, JSSPlayerChannel *chn, BOOL newExtInstrument); +static void jmpTriggerNote(JSSPlayer * mp, JSSPlayerChannel *chn, bool newExtInstrument); static void jmpDoMultiRetrigNote(JSSPlayer *mp, JSSPlayerChannel *chn, int channel) @@ -712,7 +712,7 @@ if (chn->lastMultiRetrigParamY != 0 && (mp->tick % chn->lastMultiRetrigParamY) == 0) { - BOOL change = TRUE; + bool change = true; int volume = chn->volume; switch (chn->lastMultiRetrigParamX) { @@ -731,9 +731,9 @@ case 0xD: volume += 16; break; case 0xE: volume = (volume * 3) / 2; break; case 0xF: volume *= 2; break; - default: change = FALSE; + default: change = false; } - jmpTriggerNote(mp, chn, FALSE); + jmpTriggerNote(mp, chn, false); if (change) jmpSetVolume(chn, channel, volume); } @@ -766,7 +766,7 @@ // Loop to specified row chn->iPatLoopCount--; mp->newRow = chn->iPatLoopRow; - mp->newRowSet = TRUE; + mp->newRowSet = true; } } else @@ -813,7 +813,7 @@ * Separate function used from various places where note * triggering is needed (retrig, multi-retrig, etc.) */ -static void jmpTriggerNote(JSSPlayer * mp, JSSPlayerChannel *chn, BOOL newExtInstrument) +static void jmpTriggerNote(JSSPlayer * mp, JSSPlayerChannel *chn, bool newExtInstrument) { if (chn->nextInstrument >= 0 && chn->nextInstrument < mp->module->nextInstruments && @@ -882,7 +882,7 @@ static void jmpProcessNewRow(JSSPlayer * mp, int channel) { JSSNote *currNote; - BOOL newNote = FALSE, newExtInstrument = FALSE, volumePortaSet = FALSE; + bool newNote = false, newExtInstrument = false, volumePortaSet = false; char effect; int param, paramX, paramY; JSSPlayerChannel *chn = &(mp->channels[channel]); @@ -891,14 +891,14 @@ // Check for a new note/keyoff here if (currNote->note == jsetNoteOff) - chn->keyOff = TRUE; + chn->keyOff = true; else if (currNote->note >= 0 && currNote->note <= 96) { - newNote = TRUE; + newNote = true; chn->oldNote = chn->note; chn->note = currNote->note; - chn->keyOff = FALSE; + chn->keyOff = false; } // Check for new instrument @@ -909,14 +909,14 @@ */ jmpResetEnvelope(&chn->volumeEnv); jmpResetEnvelope(&chn->panningEnv); - chn->keyOff = FALSE; + chn->keyOff = false; chn->fadeOutVol = mpMaxFadeoutVol; JMPSETNDFLAGS(cdfNewPanPos | cdfPlay | cdfNewVolume); // We save the instrument number here for later use chn->nextInstrument = currNote->instrument; - newExtInstrument = TRUE; + newExtInstrument = true; } if (newNote) @@ -965,7 +965,7 @@ chn->pitch = chn->oldPitch; chn->note = chn->oldNote; JMPUNSETNDFLAGS(cdfNewPitch | cdfPlay); - volumePortaSet = TRUE; + volumePortaSet = true; } break; } @@ -1072,8 +1072,8 @@ case 'B': // Bxx = Pattern Jump : IMPL.VERIFIED mp->newOrder = param; - mp->newOrderSet = TRUE; - mp->jumpFlag = TRUE; + mp->newOrderSet = true; + mp->jumpFlag = true; mp->lastPatLoopRow = 0; break; @@ -1087,16 +1087,16 @@ if (mp->newRow >= mp->pattern->nrows) mp->newRow = 0; - mp->newRowSet = TRUE; + mp->newRowSet = true; // Now we do some tricky tests if (!mp->breakFlag && !mp->jumpFlag) { mp->newOrder = mp->order + 1; - mp->newOrderSet = TRUE; + mp->newOrderSet = true; } - mp->breakFlag = TRUE; + mp->breakFlag = true; break; case 'E': // Exy = Special Effects @@ -1146,7 +1146,7 @@ case 0x09: // E9x - Retrig note if (mp->tick == paramY) - jmpTriggerNote(mp, chn, FALSE); + jmpTriggerNote(mp, chn, false); break; case 0x0a: // EAx - Fine Volumeslide Up @@ -1209,15 +1209,15 @@ break; case 'K': // Kxx = Key-off (Same as key-off note) - chn->keyOff = TRUE; + chn->keyOff = true; break; case 'L': // Lxx = Set Envelope Position JMPDEBUG("Set Envelope Position used, NOT verified with FT2"); chn->panningEnv.frame = param; chn->volumeEnv.frame = param; - chn->panningEnv.exec = TRUE; - chn->volumeEnv.exec = TRUE; + chn->panningEnv.exec = true; + chn->volumeEnv.exec = true; break; case 'R': // Rxy = Multi Retrig note @@ -1347,7 +1347,7 @@ { case 0x09: // E9x - Retrig note if (mp->tick == paramY) - jmpTriggerNote(mp, chn, FALSE); + jmpTriggerNote(mp, chn, false); break; case 0x0c: // ECx - Set Note Cut @@ -1403,8 +1403,8 @@ goto out; // Clear channel new data flags - mp->jumpFlag = FALSE; - mp->breakFlag = FALSE; + mp->jumpFlag = false; + mp->breakFlag = false; for (int channel = 0; channel < jsetNChannels; channel++) mp->channels[channel].newDataFlags = 0; @@ -1416,7 +1416,7 @@ { // Initialize pattern mp->newRow = 0; - mp->newRowSet = TRUE; + mp->newRowSet = true; mp->tick = mp->speed; mp->patternDelay = 0; } @@ -1445,7 +1445,7 @@ if (mp->newRowSet) { mp->row = mp->newRow; - mp->newRowSet = FALSE; + mp->newRowSet = false; } else mp->row++; @@ -1456,7 +1456,7 @@ if (mp->order != jsetNotSet) jmpSetNewOrder(mp, mp->order + 1); else - mp->isPlaying = FALSE; + mp->isPlaying = false; // Check for FT2 quirks if (JMPGETMODFLAGS(mp, jmdfFT2Replay)) @@ -1472,7 +1472,7 @@ if (mp->newOrderSet) { jmpSetNewOrder(mp, mp->newOrder); - mp->newOrderSet = FALSE; + mp->newOrderSet = false; } //fprintf(stderr, "3: tick=%d, order=%d, iPattern=%d, row=%d\n", mp->tick, mp->order, mp->npattern, mp->row); @@ -1551,7 +1551,7 @@ if (flags & cdfNewVolume) { - BOOL init = flags & (cdfNewInstr | cdfPlay); + bool init = flags & (cdfNewInstr | cdfPlay); jvmSetVolumeRamp(mp->device, channel, init ? 0 : jvmGetVolume(mp->device, channel), (chn->fadeOutVol * chn->volumeEnv.value * chn->volume) / (16 * 65536), diff -r ef6c826c5b7a -r 9807ae37ad69 minijss/jssplr.h --- a/minijss/jssplr.h Thu Dec 08 15:56:36 2022 +0200 +++ b/minijss/jssplr.h Thu Dec 08 15:59:22 2022 +0200 @@ -39,7 +39,7 @@ typedef struct { int frame, value; - BOOL exec; + bool exec; } JSSPlayerEnvelope; @@ -56,7 +56,7 @@ JSSPlayerVData vibrato, tremolo; - BOOL keyOff; + bool keyOff; JSSInstrument *instrument; // Instrument JSSExtInstrument *extInstrument; // ExtInstrument @@ -118,17 +118,17 @@ row, globalVol, options; // Playing option flags - BOOL isPlaying; // Are we playing? + bool isPlaying; // Are we playing? int newOrder, // NEW order number newRow; // NEW row number - BOOL newOrderSet, // TRUE if new order has been set - newRowSet; // TRUE if new row has been set + bool newOrderSet, // true if new order has been set + newRowSet; // true if new row has been set int patternDelay, // Pattern delay tick-counter lastPatLoopRow; // Latest set pattern loop row (any channel) - BOOL jumpFlag, // Pattern jump flag + bool jumpFlag, // Pattern jump flag breakFlag; // Pattern break flag // All channels for this player diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmargs.c --- a/src/dmargs.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmargs.c Thu Dec 08 15:59:22 2022 +0200 @@ -19,15 +19,15 @@ * @param opts options list array * @param nopts number of elements in options list array * @param handle_option function pointer to callback that handles option arguments - * @param process if TRUE, actually handle the argument, aka call the handle_option() function. if FALSE, only validity of options are checked. - * @param isLong TRUE if the option is a --long-format one + * @param process if true, actually handle the argument, aka call the handle_option() function. if false, only validity of options are checked. + * @param isLong true if the option is a --long-format one */ -static BOOL dmArgsProcessOpt( +static bool dmArgsProcessOpt( char *currArg, int *argIndex, int argc, char *argv[], const DMOptArg opts[], int nopts, - BOOL (*handle_option)(int id, char *, char *), - BOOL process, BOOL isLong) + bool (*handle_option)(int id, char *, char *), + bool process, bool isLong) { const DMOptArg *opt = NULL; char *optArg = NULL; @@ -80,13 +80,13 @@ dmErrorMsg("Option '%s%s' requires an argument.\n", isLong ? "--" : "-", currArg); - return FALSE; + return false; } } // Option was given succesfully, try to process it if (process && !handle_option(opt->id, optArg, currArg)) - return FALSE; + return false; } else { @@ -95,10 +95,10 @@ isLong ? "--" : "-", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -113,15 +113,15 @@ * @param handle_option callback function * @param handle_other callback function * @param flags processing flags - * @return return TRUE if all is well + * @return return true if all is well */ -BOOL dmArgsProcess(int argc, char *argv[], +bool dmArgsProcess(int argc, char *argv[], const DMOptArg *opts, const int nopts, - BOOL(*handle_option)(int id, char *, char *), - BOOL(*handle_other)(char *), const int flags) + bool(*handle_option)(int id, char *, char *), + bool(*handle_other)(char *), const int flags) { int handleFlags = flags & OPTH_ONLY_MASK; - BOOL optionsOK = TRUE, endOfOptions = FALSE; + bool optionsOK = true, endOfOptions = false; for (int argIndex = 1; argIndex < argc; argIndex++) { @@ -129,8 +129,8 @@ if (*str == '-' && !endOfOptions) { // Should we process options? - BOOL process = (handleFlags & OPTH_ONLY_OPTS) || handleFlags == 0; - BOOL isLong; + bool process = (handleFlags & OPTH_ONLY_OPTS) || handleFlags == 0; + bool isLong; str++; if (*str == '-') @@ -139,19 +139,19 @@ str++; if (*str == 0) { - endOfOptions = TRUE; + endOfOptions = true; continue; } // We have a long option - isLong = TRUE; + isLong = true; } else - isLong = FALSE; + isLong = false; if (!dmArgsProcessOpt(str, &argIndex, argc, argv, opts, nopts, handle_option, process, isLong)) - optionsOK = FALSE; + optionsOK = false; } else if (handleFlags == OPTH_ONLY_OTHER || handleFlags == 0) @@ -160,13 +160,13 @@ if (handle_other == NULL || (handle_other != NULL && !handle_other(str))) { - optionsOK = FALSE; + optionsOK = false; } } // Check if we bail out on invalid argument if (!optionsOK && (flags & OPTH_BAILOUT)) - return FALSE; + return false; } return optionsOK; @@ -193,14 +193,14 @@ const int width, const char *str) { size_t pos = 0; - BOOL first = TRUE; + bool first = true; while (str[pos]) { // Pre-pad line int linelen = first ? spad : rpad; dmPrintPad(fh, first ? 0 : rpad, ' '); - first = FALSE; + first = false; // Skip whitespace at line start while (isspace(str[pos]) || str[pos] == '\n') @@ -254,12 +254,12 @@ static void dmArgsPrintHelpPrintItem(FILE *fh, const DMOptArg *opt, int *optWidth, const int maxOptWidth, const int termWidth, - const BOOL doPrint) + const bool doPrint) { const char *arg = dmArgsGetOptArg(opt); char fmtBuf[32]; int padWidth; - BOOL hasLongOpt = opt->o_long != NULL; + bool hasLongOpt = opt->o_long != NULL; if (opt->o_short != 0) { @@ -343,7 +343,7 @@ for (index = 0; index < nopts; index++) { int optWidth = 0; - dmArgsPrintHelpPrintItem(NULL, &opts[index], &optWidth, 0, width, FALSE); + dmArgsPrintHelpPrintItem(NULL, &opts[index], &optWidth, 0, width, false); if (optWidth > maxOptWidth) maxOptWidth = optWidth; } @@ -354,6 +354,6 @@ for (index = 0; index < nopts; index++) { int optWidth; - dmArgsPrintHelpPrintItem(fh, &opts[index], &optWidth, maxOptWidth, width, TRUE); + dmArgsPrintHelpPrintItem(fh, &opts[index], &optWidth, maxOptWidth, width, true); } } diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmargs.h --- a/src/dmargs.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmargs.h Thu Dec 08 15:59:22 2022 +0200 @@ -45,10 +45,10 @@ } DMOptArg; -BOOL dmArgsProcess(int argc, char *argv[], +bool dmArgsProcess(int argc, char *argv[], const DMOptArg *opts, const int nopts, - BOOL (*handle_option)(int id, char *, char *), - BOOL (*handle_other)(char *), const int flags); + bool (*handle_option)(int id, char *, char *), + bool (*handle_other)(char *), const int flags); void dmArgsPrintHelp(FILE *fh, const DMOptArg *opts, const int nopts, const int flags, const int width); diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmengine.c --- a/src/dmengine.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmengine.c Thu Dec 08 15:59:22 2022 +0200 @@ -127,7 +127,7 @@ SDL_FreeSurface((SDL_Surface *)res->resData); } -static BOOL engineResImageProbe(DMResource *res, const char *fext) +static bool engineResImageProbe(DMResource *res, const char *fext) { (void) res; return fext != NULL && (strcasecmp(fext, ".jpg") == 0 || strcasecmp(fext, ".png") == 0); @@ -137,7 +137,7 @@ #ifdef JSS_SUP_XM static int engineResXMModuleLoad(DMResource *res) { - return jssLoadXM(res, (JSSModule **) &(res->resData), FALSE); + return jssLoadXM(res, (JSSModule **) &(res->resData), false); } static void engineResXMModuleFree(DMResource *res) @@ -145,7 +145,7 @@ jssFreeModule((JSSModule *) res->resData); } -static BOOL engineResXMModuleProbe(DMResource *res, const char *fext) +static bool engineResXMModuleProbe(DMResource *res, const char *fext) { (void) res; return fext != NULL && strcasecmp(fext, ".xm") == 0; @@ -156,7 +156,7 @@ #ifdef JSS_SUP_JSSMOD static int engineResJSSModuleLoad(DMResource *res) { - return jssLoadJSSMOD(res, (JSSModule **) &(res->resData), FALSE); + return jssLoadJSSMOD(res, (JSSModule **) &(res->resData), false); } static void engineResJSSModuleFree(DMResource *res) @@ -164,7 +164,7 @@ jssFreeModule((JSSModule *) res->resData); } -static BOOL engineResJSSModuleProbe(DMResource *res, const char *fext) +static bool engineResJSSModuleProbe(DMResource *res, const char *fext) { (void) res; return fext != NULL && @@ -223,7 +223,7 @@ dmMsg(2, "rdataSize=%" DM_PRIu_SIZE_T " bytes?\n", res->resSize); - BOOL eof = FALSE; + bool eof = false; int left = res->resSize; char *ptr = res->resData; int current_section; @@ -231,7 +231,7 @@ { int ret = ov_read(&vf, ptr, left > 4096 ? 4096 : left, ¤t_section); if (ret == 0) - eof = TRUE; + eof = true; else if (ret < 0) { @@ -254,7 +254,7 @@ dmFree(res->resData); } -static BOOL engineResVorbisProbe(DMResource *res, const char *fext) +static bool engineResVorbisProbe(DMResource *res, const char *fext) { (void) res; return fext != NULL && (strcasecmp(fext, ".ogg") == 0); @@ -354,7 +354,7 @@ #ifdef DM_USE_JSS -void engineGetJSSInfo(DMEngineData *eng, BOOL *playing, int *order, JSSPattern **pat, int *npattern, int *row) +void engineGetJSSInfo(DMEngineData *eng, bool *playing, int *order, JSSPattern **pat, int *npattern, int *row) { JSS_LOCK(eng->jssPlr); @@ -467,7 +467,7 @@ #ifdef DM_USE_TREMOR case DM_ASETUP_TREMOR: if (engine->audioPos + len >= engine->audioRes->resSize) - engine->exitFlag = TRUE; + engine->exitFlag = true; else { memcpy(stream, (Uint8 *) engine->audioRes->resData + engine->audioPos, len); @@ -541,7 +541,7 @@ engine->audioSimDelay = 1000 / 45; engine->audioSimBufSize = (engine->optAfmt.freq / 45) * engine->audioSampleSize; engine->audioSimBuf = dmMalloc(engine->audioSimBufSize); - engine->audioSimDone = FALSE; + engine->audioSimDone = false; engine->audioSimThread = SDL_CreateThread(engineAudioThreadFunc, "DMLib Audio Simulation Thread", engine); if (engine->audioSimThread == NULL) return DMERR_INIT_FAIL; diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmengine.h --- a/src/dmengine.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmengine.h Thu Dec 08 15:59:22 2022 +0200 @@ -158,7 +158,7 @@ typedef struct { - BOOL enabled; + bool enabled; DMTimelinePoints points; } DMTimelineCurve; @@ -177,7 +177,7 @@ int index; // Track index int layer; // Render order / layer char *name; // Name of the timeline track - BOOL enabled; // Enabled? + bool enabled; // Enabled? int nevents, nallocated; // Number of events DMTimelineEvent **events; // Events @@ -244,7 +244,7 @@ startTimeAudio, offsetTime, pauseTime; - BOOL pauseFlag, paused, exitFlag; + bool pauseFlag, paused, exitFlag; // Rendering SDL_Window *window; @@ -261,7 +261,7 @@ int optVidWidth, optVidHeight, optVidDepth, optVFlags, optVidAspect, optVidSetup; - BOOL optVidNative; + bool optVidNative; int optResFlags; char *optPackFilename; @@ -281,7 +281,7 @@ SDL_Thread *audioSimThread; Uint8 * audioSimBuf; size_t audioSimBufSize; - BOOL audioSimDone; + bool audioSimDone; int audioSimDelay; #ifdef DM_USE_JSS diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmfile.c --- a/src/dmfile.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmfile.c Thu Dec 08 15:59:22 2022 +0200 @@ -7,13 +7,13 @@ #include "dmfile.h" -BOOL dm_fread_str(FILE *f, void *buf, const size_t len) +bool dm_fread_str(FILE *f, void *buf, const size_t len) { return fread(buf, len, 1, f) == 1; } -BOOL dm_fread_byte(FILE *f, Uint8 *val) +bool dm_fread_byte(FILE *f, Uint8 *val) { int tmp = fgetc(f); *val = tmp; @@ -22,12 +22,12 @@ #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ -BOOL dm_fread_ ## xname (FILE *f, xtype *v) { \ +bool dm_fread_ ## xname (FILE *f, xtype *v) { \ xtype result; \ if (fread(&result, sizeof( xtype ), 1, f) != 1) \ - return FALSE; \ + return false; \ *v = DM_ ## xmacro ## _TO_NATIVE (result); \ - return TRUE; \ + return true; \ } #include "dmfiletmpl.h" @@ -35,20 +35,20 @@ #undef DM_DEFINE_FFUNC -BOOL dm_fwrite_str(FILE *f, const void *buf, const size_t len) +bool dm_fwrite_str(FILE *f, const void *buf, const size_t len) { return fwrite(buf, len, 1, f) == 1; } -BOOL dm_fwrite_byte(FILE *f, const Uint8 val) +bool dm_fwrite_byte(FILE *f, const Uint8 val) { return fputc(val, f) == val; } #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ -BOOL dm_fwrite_ ## xname (FILE *f, const xtype v) { \ +bool dm_fwrite_ ## xname (FILE *f, const xtype v) { \ xtype result = DM_NATIVE_TO_ ## xmacro (v); \ return fwrite(&result, sizeof( xtype ), 1, f) == 1; \ } diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmfile.h --- a/src/dmfile.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmfile.h Thu Dec 08 15:59:22 2022 +0200 @@ -17,18 +17,18 @@ /* Plain file endianess functions */ #define DM_DEFINE_FFUNC(xname, xtype, z) \ -BOOL dm_fread_ ## xname (FILE *f, xtype *v); \ -BOOL dm_fwrite_ ## xname (FILE *f, const xtype v); +bool dm_fread_ ## xname (FILE *f, xtype *v); \ +bool dm_fwrite_ ## xname (FILE *f, const xtype v); #include "dmfiletmpl.h" #undef DM_DEFINE_FFUNC -BOOL dm_fread_str(FILE *f, void *, const size_t); -BOOL dm_fwrite_str(FILE *f, const void *, const size_t); +bool dm_fread_str(FILE *f, void *, const size_t); +bool dm_fwrite_str(FILE *f, const void *, const size_t); -BOOL dm_fread_byte(FILE *f, Uint8 *); -BOOL dm_fwrite_byte(FILE *f, const Uint8); +bool dm_fread_byte(FILE *f, Uint8 *); +bool dm_fwrite_byte(FILE *f, const Uint8); int dmWriteDataFile(FILE *outFile, const char *filename, const Uint8 *buf, const size_t bufSize); diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmgrowbuf.c --- a/src/dmgrowbuf.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmgrowbuf.c Thu Dec 08 15:59:22 2022 +0200 @@ -42,8 +42,8 @@ buf->offs = 0; buf->size = initial; buf->mingrow = mingrow; - buf->backwards = FALSE; - buf->is_const = FALSE; + buf->backwards = false; + buf->is_const = false; // Allocate the data if ((buf->data = dmMalloc0(initial)) == NULL) @@ -100,7 +100,7 @@ memset(dst->data + src->size, 0, enlarge); // And reset some struct information - dst->is_const = FALSE; + dst->is_const = false; return dst; } @@ -116,7 +116,7 @@ dst, src, src->data, src->size, src->len, src->offs); memcpy(dst, src, sizeof(DMGrowBuf)); - dst->is_const = TRUE; + dst->is_const = true; return dst; } @@ -132,7 +132,7 @@ dst->data = data; dst->len = dst->size = len; - dst->is_const = TRUE; + dst->is_const = true; return dst; } @@ -173,7 +173,7 @@ } -static BOOL dmGrowBufRealloc(DMGrowBuf *buf, const size_t nsize, const BOOL clear) +static bool dmGrowBufRealloc(DMGrowBuf *buf, const size_t nsize, const bool clear) { DM_DBG("dmGrowBufRealloc(%p):\n" " size=%" DM_PRIu_SIZE_T ", nsize=%" DM_PRIu_SIZE_T @@ -181,14 +181,14 @@ buf, buf->size, nsize, buf->offs); if (buf->is_const) - return FALSE; + return false; // Can't be smaller than current size! if (nsize < buf->size) - return FALSE; + return false; if ((buf->data = dmRealloc(buf->data, nsize)) == NULL) - return FALSE; + return false; // For buffers growing backwards, we must move the // current data to the end of the buffer .. @@ -211,7 +211,7 @@ buf->size = nsize; - return TRUE; + return true; } @@ -220,12 +220,12 @@ // if there is not enough space for at least that amount compared to // current buffer "len". // -BOOL dmGrowBufGrow(DMGrowBuf *buf, const size_t amount) +bool dmGrowBufGrow(DMGrowBuf *buf, const size_t amount) { size_t grow = (amount > buf->mingrow) ? amount : buf->mingrow; if (buf->is_const) - return FALSE; + return false; if (buf->data == NULL || (buf->backwards && amount >= buf->offs) || @@ -234,12 +234,12 @@ DM_DBG("dmGrowBufGrow(%p, amount=%" DM_PRIu_SIZE_T "): grow=%" DM_PRIu_SIZE_T "\n", buf, amount, grow); - if (!dmGrowBufRealloc(buf, buf->size + grow, TRUE)) - return FALSE; + if (!dmGrowBufRealloc(buf, buf->size + grow, true)) + return false; } buf->len += amount; - return TRUE; + return true; } @@ -247,31 +247,31 @@ // Grow the buffer if "nsize" is larger than the current buffer size. // Buffer is enlarged to nsize + mingrow. // -BOOL dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize) +bool dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize) { if (buf->is_const) - return FALSE; + return false; if (buf->data == NULL || nsize > buf->size) { - if (!dmGrowBufRealloc(buf, nsize + buf->mingrow, TRUE)) - return FALSE; + if (!dmGrowBufRealloc(buf, nsize + buf->mingrow, true)) + return false; } if (nsize > buf->len) buf->len = nsize; - return TRUE; + return true; } -BOOL dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len) +bool dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len) { if (data == NULL) - return FALSE; + return false; if (!dmGrowBufGrow(buf, len)) - return FALSE; + return false; if (buf->backwards) { @@ -292,25 +292,25 @@ buf->offs += len; } - return TRUE; + return true; } -BOOL dmGrowBufPutU8(DMGrowBuf *buf, const Uint8 value) +bool dmGrowBufPutU8(DMGrowBuf *buf, const Uint8 value) { if (!dmGrowBufGrow(buf, sizeof(Uint8))) - return FALSE; + return false; if (buf->backwards) buf->data[--buf->offs] = value; else buf->data[buf->offs++] = value; - return TRUE; + return true; } -BOOL dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val) +bool dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val) { if (buf->literal && buf->backwards) { @@ -327,7 +327,7 @@ } -BOOL dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val) +bool dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val) { if (buf->literal && buf->backwards) { @@ -344,7 +344,7 @@ } -BOOL dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val) +bool dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val) { if (buf->literal && buf->backwards) { @@ -365,7 +365,7 @@ } -BOOL dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val) +bool dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val) { if (buf->literal && buf->backwards) { @@ -386,22 +386,22 @@ } -BOOL dmGrowBufGetU8(DMGrowBuf *buf, Uint8 *value) +bool dmGrowBufGetU8(DMGrowBuf *buf, Uint8 *value) { if (buf->backwards) { if (buf->offs > 0) *value = buf->data[--buf->offs]; else - return FALSE; + return false; } else { if (buf->offs < buf->len) *value = buf->data[buf->offs++]; else - return FALSE; + return false; } - return TRUE; + return true; } diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmgrowbuf.h --- a/src/dmgrowbuf.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmgrowbuf.h Thu Dec 08 15:59:22 2022 +0200 @@ -25,10 +25,10 @@ len, // Size requested mingrow; // Minimum amount of bytes the allocation size grows by - BOOL - backwards, // TRUE if the buffer grows backwards (e.g. "offs" moves backwards) - literal, // TRUE if dmGrowBufPut*() functions stores data "literally" in backwards mode - is_const; // TRUE will cause any reallocs etc. modifications to fail + bool + backwards, // true if the buffer grows backwards (e.g. "offs" moves backwards) + literal, // true if dmGrowBufPut*() functions stores data "literally" in backwards mode + is_const; // true will cause any reallocs etc. modifications to fail } DMGrowBuf; @@ -46,17 +46,17 @@ DMGrowBuf * dmGrowBufConstCreateFrom(DMGrowBuf *buf, Uint8 *data, const size_t len); -BOOL dmGrowBufGrow(DMGrowBuf *buf, const size_t amount); -BOOL dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize); +bool dmGrowBufGrow(DMGrowBuf *buf, const size_t amount); +bool dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize); -BOOL dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len); -BOOL dmGrowBufPutU8(DMGrowBuf *buf, const Uint8 value); -BOOL dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val); -BOOL dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val); -BOOL dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val); -BOOL dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val); +bool dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len); +bool dmGrowBufPutU8(DMGrowBuf *buf, const Uint8 value); +bool dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val); +bool dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val); +bool dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val); +bool dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val); -BOOL dmGrowBufGetU8(DMGrowBuf *buf, Uint8 *value); +bool dmGrowBufGetU8(DMGrowBuf *buf, Uint8 *value); #ifdef __cplusplus diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmlib.c --- a/src/dmlib.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmlib.c Thu Dec 08 15:59:22 2022 +0200 @@ -123,34 +123,34 @@ } -BOOL dmGetIntVal(const char *str, unsigned int *value, BOOL *neg) +bool dmGetIntVal(const char *str, unsigned int *value, bool *neg) { int ch; - BOOL hex = FALSE; + bool hex = false; // Is the value negative? if (*str == '-') { if (neg == NULL) - return FALSE; + return false; - *neg = TRUE; + *neg = true; str++; } else if (neg != NULL) - *neg = FALSE; + *neg = false; // Is it hexadecimal? if (*str == '$') { - hex = TRUE; + hex = true; str++; } else if (str[0] == '0' && str[1] == 'x') { - hex = TRUE; + hex = true; str += 2; } @@ -178,7 +178,7 @@ *value |= ch - 'a' + 10; } else - return FALSE; + return false; } } else @@ -191,10 +191,10 @@ *value += ch - '0'; } else - return FALSE; + return false; } } - return TRUE; + return true; } @@ -351,7 +351,7 @@ if (!lock->used) { int res; - lock->used = TRUE; + lock->used = true; lock->id = SDL_ThreadID(); lock->state++; res = SDL_mutexP(mutex->m); diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmlib.h --- a/src/dmlib.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmlib.h Thu Dec 08 15:59:22 2022 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -190,21 +191,6 @@ #define DMRES_RES_FILE "res.txt" // Resource data file -/* Define a boolean type - */ -#if !defined(FALSE) && !defined(TRUE) && !defined(BOOL) -typedef enum { FALSE = 0, TRUE = 1 } BOOL; -#endif - -#ifndef BOOL -# ifdef bool -# define BOOL bool -# else -# define BOOL int -# endif -#endif - - /* Math constants */ #define DM_PI 3.14159265358f @@ -474,7 +460,7 @@ char * dm_strrcasecmp(char *str, const char *needle); -BOOL dmGetIntVal(const char *str, unsigned int *value, BOOL *neg); +bool dmGetIntVal(const char *str, unsigned int *value, bool *neg); /* Mutexes @@ -483,7 +469,7 @@ typedef struct { - BOOL used; + bool used; Uint32 id; int state; } DMMutexLock; diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmpack.c --- a/src/dmpack.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmpack.c Thu Dec 08 15:59:22 2022 +0200 @@ -68,7 +68,7 @@ /* * OPEN a packfile */ -int dmPackOpen(const char *filename, DMPackFile ** ppPack, BOOL readOnly) +int dmPackOpen(const char *filename, DMPackFile ** ppPack, bool readOnly) { unsigned int i; DMPackFile *pack = NULL; diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmpack.h --- a/src/dmpack.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmpack.h Thu Dec 08 15:59:22 2022 +0200 @@ -50,7 +50,7 @@ DMPackEntry * dmPackFind(DMPackEntry *list, const char *filename); -int dmPackOpen(const char *, DMPackFile **, BOOL); +int dmPackOpen(const char *, DMPackFile **, bool); int dmPackClose(DMPackFile *); int dmPackRead(DMPackFile *, const char *, Uint8 **, size_t *); diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmres.c --- a/src/dmres.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmres.c Thu Dec 08 15:59:22 2022 +0200 @@ -252,7 +252,7 @@ } -static BOOL dm_stdio_feof(DMResource *fh) +static bool dm_stdio_feof(DMResource *fh) { return feof(fh->fh); } @@ -375,7 +375,7 @@ int ret = DMERR_OK, zret, cdataLeft; Uint8 * cbuffer = NULL; z_stream zstr; - BOOL zinit = FALSE; + bool zinit = false; // Allocate a structures and buffers if ((cbuffer = dmMalloc(DMRES_TMPBUF_SIZE)) == NULL) @@ -396,7 +396,7 @@ "Could not initialize zlib stream decompression.\n"); goto out; } - zinit = TRUE; + zinit = true; // Uncompress the data while (cdataLeft > 0 && zstr.avail_out > 0 && zret == Z_OK) @@ -451,10 +451,10 @@ zctx.inBufferEnd = inBuf + node->csize; zctx.outBuffer = zctx.outBufferStart = handle->memData; zctx.outBufferEnd = handle->memData + node->size; - zctx.expandable = FALSE; + zctx.expandable = false; // Attempt decompression - if ((ret = dmZLibParseHeader(&zctx, TRUE)) != DMERR_OK) + if ((ret = dmZLibParseHeader(&zctx, true)) != DMERR_OK) goto out; if ((ret = dmZLibInflate(&zctx)) != DMERR_OK) @@ -566,7 +566,7 @@ #endif -static BOOL dm_mem_realloc(DMResource *ctx, const size_t newSize) +static bool dm_mem_realloc(DMResource *ctx, const size_t newSize) { size_t grow; @@ -574,7 +574,7 @@ if (ctx->maxSize > 0 && newSize > ctx->maxSize) { ctx->status = DMERR_BOUNDS; - return FALSE; + return false; } // New size is smaller than old @@ -589,7 +589,7 @@ if (ctx->maxSize > 0 && ctx->memAlloc + grow >= ctx->maxSize) { ctx->status = DMERR_BOUNDS; - return FALSE; + return false; } // Grow the buffer @@ -597,13 +597,13 @@ if ((ctx->memData = dmRealloc(ctx->memData, ctx->memAlloc)) == NULL) { ctx->status = DMERR_MALLOC; - return FALSE; + return false; } out: ctx->memSize = newSize; - return TRUE; + return true; } @@ -669,7 +669,7 @@ } -static BOOL dm_mem_feof(DMResource *ctx) +static bool dm_mem_feof(DMResource *ctx) { return ((size_t) ctx->memOffset) >= ctx->memSize; } @@ -977,7 +977,7 @@ } -BOOL dmfeof(DMResource *fh) +bool dmfeof(DMResource *fh) { return fh->fops->feof(fh); } @@ -1109,7 +1109,7 @@ int dmResourcesInit(DMResourceLib **plib, const char *filename, const char *path, const int flags, int (*classifier)(DMResource *)) { DMResourceLib *lib; - BOOL initialized = FALSE; + bool initialized = false; // Allocate the resource library structure if ((*plib = lib = dmMalloc0(sizeof(DMResourceLib))) == NULL) @@ -1129,7 +1129,7 @@ lib->packFilename = dm_strdup(filename); // Initialize PACK, open as read-only - ret = dmPackOpen(lib->packFilename, &lib->packFile, TRUE); + ret = dmPackOpen(lib->packFilename, &lib->packFile, true); if (ret != DMERR_OK) { if ((flags & DRF_USE_STDIO) == 0) @@ -1163,7 +1163,7 @@ dmResourceInsert(lib, res); } - initialized = TRUE; + initialized = true; } } #else @@ -1177,7 +1177,7 @@ int ret = dmResourcesLoadDirectory(lib, lib->resPath); if (ret != DMERR_OK) return ret; - initialized = TRUE; + initialized = true; } #endif @@ -1243,7 +1243,7 @@ } -int dmResourcesPreload(DMResourceLib *lib, BOOL start, int *loaded, int *total) +int dmResourcesPreload(DMResourceLib *lib, bool start, int *loaded, int *total) { int ret = DMERR_OK; @@ -1320,13 +1320,13 @@ } -BOOL dmf_read_str(DMResource *fh, void *ptr, const size_t len) +bool dmf_read_str(DMResource *fh, void *ptr, const size_t len) { return dmfread(ptr, len, 1, fh) == 1; } -BOOL dmf_read_byte(DMResource *fh, Uint8 *val) +bool dmf_read_byte(DMResource *fh, Uint8 *val) { int tmp = dmfgetc(fh); *val = tmp; @@ -1335,12 +1335,12 @@ #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ -BOOL dmf_read_ ## xname (DMResource *fh, xtype *val) { \ +bool dmf_read_ ## xname (DMResource *fh, xtype *val) { \ xtype result; \ if (dmfread(&result, sizeof( xtype ), 1, fh) != 1) \ - return FALSE; \ + return false; \ *val = DM_ ## xmacro ## _TO_NATIVE (result); \ - return TRUE; \ + return true; \ } #include "dmfiletmpl.h" diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmres.h --- a/src/dmres.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmres.h Thu Dec 08 15:59:22 2022 +0200 @@ -82,7 +82,7 @@ typedef struct DMResourceDataOps { - BOOL (*probe)(DMResource *res, const char *fext); + bool (*probe)(DMResource *res, const char *fext); int (*load)(DMResource *res); void (*free)(DMResource *res); } DMResourceDataOps; @@ -116,7 +116,7 @@ int (*fseek)(DMResource *, const off_t, const int); off_t (*fsize)(DMResource *); off_t (*ftell)(DMResource *); - BOOL (*feof)(DMResource *); + bool (*feof)(DMResource *); int (*fgetc)(DMResource *); int (*fputc)(int, DMResource *); size_t (*fread)(void *, const size_t, const size_t, DMResource *); @@ -130,7 +130,7 @@ int dmResourcesInit(DMResourceLib **lib, const char *filename, const char *path, const int flags, int (*classifier)(DMResource *)); int dmResourcesClose(DMResourceLib *lib); -int dmResourcesPreload(DMResourceLib *lib, BOOL start, int *loaded, int *total); +int dmResourcesPreload(DMResourceLib *lib, bool start, int *loaded, int *total); DMResource * dmResourceNew(DMResourceLib *lib, const char *filename, const size_t size, const int flags); void dmResourceFree(DMResource *node); @@ -159,7 +159,7 @@ int dmfseek(DMResource *fh, const off_t offset, const int whence); off_t dmfsize(DMResource *fh); off_t dmftell(DMResource *fh); -BOOL dmfeof(DMResource *fh); +bool dmfeof(DMResource *fh); int dmfgetc(DMResource *fh); int dmfputc(int val, DMResource *fh); size_t dmfread(void *ptr, const size_t size, const size_t nmemb, DMResource *fh); @@ -171,21 +171,21 @@ DM_ATTR_PRINTF_FMT(2, 3); // Helper functions for endianess based reading etc -BOOL dmf_read_str(DMResource *fh, void *ptr, const size_t len); -BOOL dmf_read_byte(DMResource *fh, Uint8 *val); +bool dmf_read_str(DMResource *fh, void *ptr, const size_t len); +bool dmf_read_byte(DMResource *fh, Uint8 *val); #define DM_DEFINE_FFUNC(xname, xtype, z) \ -BOOL dmf_read_ ## xname (DMResource *fh, xtype *v); +bool dmf_read_ ## xname (DMResource *fh, xtype *v); #include "dmfiletmpl.h" #undef DM_DEFINE_FFUNC -BOOL dmf_write_str(DMResource *fh, const void *data, const size_t len); -BOOL dmf_write_byte(DMResource *fh, const Uint8 val); +bool dmf_write_str(DMResource *fh, const void *data, const size_t len); +bool dmf_write_byte(DMResource *fh, const Uint8 val); #define DM_DEFINE_FFUNC(xname, xtype, z) \ -BOOL dmf_write_ ## xname (DMResource *fh, const xtype v); +bool dmf_write_ ## xname (DMResource *fh, const xtype v); #include "dmfiletmpl.h" diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmresw.c --- a/src/dmresw.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmresw.c Thu Dec 08 15:59:22 2022 +0200 @@ -7,24 +7,24 @@ #include "dmres.h" -BOOL dmf_write_str(DMResource *fh, const void *data, const size_t len) +bool dmf_write_str(DMResource *fh, const void *data, const size_t len) { return dmfwrite(data, len, 1, fh) == 1; } -BOOL dmf_write_byte(DMResource *fh, const Uint8 val) +bool dmf_write_byte(DMResource *fh, const Uint8 val) { return dmfputc(val, fh) == val; } #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ -BOOL dmf_write_ ## xname (DMResource *f, const xtype v) { \ +bool dmf_write_ ## xname (DMResource *f, const xtype v) { \ xtype result = DM_NATIVE_TO_ ## xmacro (v); \ if (dmfwrite(&result, sizeof( xtype ), 1, f) != 1) \ - return FALSE; \ - return TRUE; \ + return false; \ + return true; \ } #include "dmfiletmpl.h" diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmsimple.c --- a/src/dmsimple.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmsimple.c Thu Dec 08 15:59:22 2022 +0200 @@ -25,7 +25,7 @@ static DMVector setupMenuPos, setupMenuDim, setupText1Pos, setupText2Pos, setupMenuBarOffs, setupMenuBarDimAdj; -static BOOL setupMenuCenter, setupTextCondensed; +static bool setupMenuCenter, setupTextCondensed; static char setupTextFullscreen[setupTextFieldLen], setupTextWindowed[setupTextFieldLen], @@ -56,7 +56,7 @@ } -static BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +static bool argHandleOpt(const int optN, char *optArg, char *currArg) { (void) optArg; (void) currArg; @@ -74,10 +74,10 @@ default: dmErrorDBGMsg("Unknown option '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -141,7 +141,7 @@ static int engineLoadResources() { int err, loaded = 0, total = 0; - BOOL first = TRUE; + bool first = true; do { @@ -150,7 +150,7 @@ return err; err = dmResourcesPreload(engine.resources, first, &loaded, &total); - first = FALSE; + first = false; } while (err == DMERR_PROGRESS); @@ -158,18 +158,18 @@ } -static BOOL engineGenInitializeVideo(int width, int height, int depth, Uint32 flags) +static bool engineGenInitializeVideo(int width, int height, int depth, Uint32 flags) { dmPrint(1, "Initializing SDL video %d x %d x %dbpp, flags=0x%08x\n", width, height, depth, flags); SDL_SetWindowTitle(engine.window, dmProgDesc); - return TRUE; + return true; } -static BOOL engineInitializeVideo() +static bool engineInitializeVideo() { return engineGenInitializeVideo(engine.optVidWidth, engine.optVidHeight, engine.optVidDepth, engine.optVFlags); @@ -328,7 +328,7 @@ DMResource *file = NULL; SDL_Surface *menuBgImage = NULL, *menuBarImage = NULL; int result, menuState = -1; - BOOL menuFullScreen = TRUE; + bool menuFullScreen = true; // Compute a list of valid modes if (!engineGenInitializeVideo(DM_VSETUP_WIDTH, DM_VSETUP_HEIGHT, engine.optVidDepth, engine.optVFlags)) @@ -508,11 +508,11 @@ break; case SDLK_LEFT: - menuFullScreen = FALSE; + menuFullScreen = false; break; case SDLK_RIGHT: - menuFullScreen = TRUE; + menuFullScreen = true; break; case SDLK_SPACE: @@ -625,7 +625,7 @@ int main(int argc, char *argv[]) { int err; - BOOL initSDL = FALSE; + bool initSDL = false; memset(&engine, 0, sizeof(engine)); @@ -683,7 +683,7 @@ SDL_GetError()); goto out; } - initSDL = TRUE; + initSDL = true; // Set start time engine.startTimeAudio = -1; @@ -858,7 +858,7 @@ switch (engine.event.key.keysym.sym) { case SDLK_ESCAPE: - engine.exitFlag = TRUE; + engine.exitFlag = true; break; case SDLK_SPACE: @@ -890,7 +890,7 @@ break; case SDL_QUIT: - engine.exitFlag = TRUE; + engine.exitFlag = true; break; } @@ -954,7 +954,7 @@ if (engine.audioSimThread != NULL) { dmMutexLock(engine.audioStreamMutex); - engine.audioSimDone = TRUE; + engine.audioSimDone = true; dmMutexUnlock(engine.audioStreamMutex); SDL_WaitThread(engine.audioSimThread, NULL); } diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmtext.h --- a/src/dmtext.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmtext.h Thu Dec 08 15:59:22 2022 +0200 @@ -64,11 +64,11 @@ void dmDrawBMTextConst(SDL_Surface *screen, const DMBitmapFont *font, - const BOOL condensed, const int mode, int xc, int yc, const char *str); + const bool condensed, const int mode, int xc, int yc, const char *str); void dmDrawBMTextVA(SDL_Surface *screen, const DMBitmapFont *font, - const BOOL condensed, const int mode, const int xc, const int yc, const char *fmt, va_list ap); + const bool condensed, const int mode, const int xc, const int yc, const char *fmt, va_list ap); void dmDrawBMText(SDL_Surface *screen, const DMBitmapFont *font, - const BOOL condensed, const int mode, const int xc, const int yc, const char *fmt, ...) + const bool condensed, const int mode, const int xc, const int yc, const char *fmt, ...) DM_ATTR_PRINTF_FMT(7, 8); diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmtext_bm.c --- a/src/dmtext_bm.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmtext_bm.c Thu Dec 08 15:59:22 2022 +0200 @@ -8,7 +8,7 @@ void dmDrawBMTextConst(SDL_Surface *screen, const DMBitmapFont *font, - const BOOL condensed, const int mode, int xc, int yc, const char *fmt) + const bool condensed, const int mode, int xc, int yc, const char *fmt) { const char *ptr = fmt; DMUnscaledBlitFunc blit = dmGetUnscaledBlitFunc(font->glyphs->format, screen->format, mode); @@ -42,7 +42,7 @@ void dmDrawBMTextVA(SDL_Surface *screen, const DMBitmapFont *font, - const BOOL condensed, const int mode, const int xc, const int yc, + const bool condensed, const int mode, const int xc, const int yc, const char *fmt, va_list ap) { char tmp[512]; @@ -53,7 +53,7 @@ void dmDrawBMText(SDL_Surface *screen, const DMBitmapFont *font, - const BOOL condensed, const int mode, const int xc, const int yc, + const bool condensed, const int mode, const int xc, const int yc, const char *fmt, ...) { va_list ap; @@ -143,7 +143,7 @@ char magic[8]; Uint16 version, nglyphs, maxglyph; Uint8 width, height, bpp; - BOOL tsfont = FALSE; + bool tsfont = false; // Check magic and version if (!dmf_read_str(fp, (Uint8 *) &magic, 6) || @@ -155,7 +155,7 @@ { // Yep, we handle these a bit differently int encoding = dmfgetc(fp); - tsfont = TRUE; + tsfont = true; #ifdef FN_DEBUG fprintf(stderr, "TSFONT v%d.%d (0x%04x), encoding=%d\n", diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmtimeline.c --- a/src/dmtimeline.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmtimeline.c Thu Dec 08 15:59:22 2022 +0200 @@ -7,15 +7,15 @@ #include "dmengine.h" -static BOOL dmLoadFloatValue(DMResource *res, DMFloat *val) +static bool dmLoadFloatValue(DMResource *res, DMFloat *val) { char tmp[DT_FLOAT_STORE_SIZE + 1]; if (!dmf_read_str(res, &tmp, DT_FLOAT_STORE_SIZE)) - return FALSE; + return false; tmp[DT_FLOAT_STORE_SIZE] = 0; *val = atof(tmp); - return TRUE; + return true; } diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmtimelinew.c --- a/src/dmtimelinew.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmtimelinew.c Thu Dec 08 15:59:22 2022 +0200 @@ -7,7 +7,7 @@ #include "dmengine.h" -static BOOL dmSaveFloatValue(DMResource *res, const DMFloat val) +static bool dmSaveFloatValue(DMResource *res, const DMFloat val) { char tmp[DT_FLOAT_STORE_SIZE]; snprintf(tmp, DT_FLOAT_STORE_SIZE, "%f", val); @@ -229,7 +229,7 @@ return DMERR_MALLOC; track->name = dm_strdup(name); - track->enabled = TRUE; + track->enabled = true; if (tl->ntracks + 1 >= tl->nallocated) { diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmzlib.c --- a/src/dmzlib.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmzlib.c Thu Dec 08 15:59:22 2022 +0200 @@ -150,7 +150,7 @@ } } - ctx->initialized = TRUE; + ctx->initialized = true; return DMERR_OK; } @@ -625,7 +625,7 @@ } -int dmZLibParseHeader(DMZLibContext * ctx, BOOL checkPNG) +int dmZLibParseHeader(DMZLibContext * ctx, bool checkPNG) { // See http://tools.ietf.org/html/rfc1950 int cmf = dmZGet8(ctx); // Compression method and flags diff -r ef6c826c5b7a -r 9807ae37ad69 src/dmzlib.h --- a/src/dmzlib.h Thu Dec 08 15:56:36 2022 +0200 +++ b/src/dmzlib.h Thu Dec 08 15:59:22 2022 +0200 @@ -24,7 +24,7 @@ typedef struct { - BOOL initialized; + bool initialized; Uint16 fast[DM_ZLIB_HFAST_SIZE]; Uint16 firstCode[16]; @@ -45,7 +45,7 @@ Uint32 codeBuffer; Uint8 *outBuffer, *outBufferStart, *outBufferEnd; - BOOL expandable; + bool expandable; DMZHuffmanContext zlength, zdistance; } DMZLibContext; @@ -56,7 +56,7 @@ int dmZLibInitInflate(DMZLibContext *ctx); void dmZLibCloseInflate(DMZLibContext *ctx); -int dmZLibParseHeader(DMZLibContext * ctx, BOOL checkPNG); +int dmZLibParseHeader(DMZLibContext * ctx, bool checkPNG); int dmZLibInflate(DMZLibContext * ctx); diff -r ef6c826c5b7a -r 9807ae37ad69 src/stb_image.c --- a/src/stb_image.c Thu Dec 08 15:56:36 2022 +0200 +++ b/src/stb_image.c Thu Dec 08 15:59:22 2022 +0200 @@ -3688,7 +3688,7 @@ Uint8 *inBuf, size_t inLen, Uint8 **outBuf, size_t *outLen, size_t initialSize, - BOOL parseHeader) + bool parseHeader) { DMZLibContext ctx; int ret; @@ -3708,9 +3708,9 @@ ctx.inBuffer = ctx.inBufferStart = inBuf; ctx.inBufferEnd = inBuf + inLen; ctx.outBufferEnd = ctx.outBufferStart + initialSize; - ctx.expandable = TRUE; - - if (parseHeader && (ret = dmZLibParseHeader(&ctx, TRUE)) != DMERR_OK) + ctx.expandable = true; + + if (parseHeader && (ret = dmZLibParseHeader(&ctx, true)) != DMERR_OK) goto err; if ((ret = dmZLibInflate(&ctx)) != DMERR_OK) diff -r ef6c826c5b7a -r 9807ae37ad69 tests/blittest.c --- a/tests/blittest.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tests/blittest.c Thu Dec 08 15:59:22 2022 +0200 @@ -8,7 +8,7 @@ #define DM_COLORS (256) char *optFontFile = "font.ttf"; -BOOL optBenchmark = FALSE; +bool optBenchmark = false; int optVFlags = SDL_SWSURFACE | SDL_HWPALETTE; int optScrWidth = 640, optScrHeight = 480, optFontSize = 20, optScrDepth = 32; int optBenchmarkLen = 20; @@ -33,7 +33,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { case 0: @@ -62,7 +62,7 @@ if (w < 320 || h < 200 || w > 3200 || h > 3200) { dmErrorMsg("Invalid width or height: %d x %d\n", w, h); - return FALSE; + return false; } optScrWidth = w; optScrHeight = h; @@ -70,21 +70,21 @@ else { dmErrorMsg("Invalid size argument '%s'.\n", optArg); - return FALSE; + return false; } } break; case 7: - optBenchmark = TRUE; + optBenchmark = true; break; default: dmErrorMsg("Unknown option '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -110,13 +110,13 @@ r->x, r->y, r->w, r->h); } -BOOL DM_InitializeVideo(SDL_Surface **screen) +bool DM_InitializeVideo(SDL_Surface **screen) { *screen = SDL_SetVideoMode(optScrWidth, optScrHeight, optScrDepth, optVFlags | SDL_RESIZABLE); if (*screen == NULL) { dmErrorMsg("Can't SDL_SetVideoMode(): %s\n", SDL_GetError()); - return FALSE; + return false; } #if 0 @@ -131,7 +131,7 @@ DM_PrintRect(stderr, &((*screen)->clip_rect)); #endif - return TRUE; + return true; } void DM_Random(SDL_Surface *screen, int q) @@ -184,7 +184,7 @@ DMVector vr, vl, va; DMFloat vrayLen, vfactor; int vlen; - BOOL wasHit; + bool wasHit; // Perform shadow occlusion via simplistic raytracing vr.x = i; @@ -203,7 +203,7 @@ dm_vector_copy(&vr, light); vlen = 0; - wasHit = FALSE; + wasHit = false; do { float h; @@ -216,7 +216,7 @@ // Check for hits if (h > vr.z) - wasHit = TRUE; + wasHit = true; else { // Move forwards @@ -286,7 +286,7 @@ SDL_Color fontcol={255,155,155,0}; SDL_Event event; int mouseX, mouseY; - BOOL initSDL = FALSE, initTTF = FALSE, exitFlag, showMap = FALSE; + bool initSDL = false, initTTF = false, exitFlag, showMap = false; dmInitProg("blittest", "dmlib blittest", "0.2", NULL, NULL); if (!dmArgsProcess(argc, argv, optList, optListN, @@ -298,7 +298,7 @@ dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError()); goto error_exit; } - initSDL = TRUE; + initSDL = true; if (TTF_Init() < 0) @@ -306,7 +306,7 @@ dmErrorMsg("Could not initialize FreeType/TTF: %s\n", SDL_GetError()); goto error_exit; } - initTTF = TRUE; + initTTF = true; font = TTF_OpenFont(optFontFile, optFontSize); if (font == NULL) @@ -351,7 +351,7 @@ int numFrames = 0, startTime = SDL_GetTicks(), endTime = 0; - exitFlag = FALSE; + exitFlag = false; if (optBenchmark) dmMsg(0, "Starting benchmark, running for %d seconds.\n", optBenchmarkLen); @@ -367,7 +367,7 @@ case SDL_KEYDOWN: switch (event.key.keysym.sym) { - case SDLK_ESCAPE: exitFlag = TRUE; break; + case SDLK_ESCAPE: exitFlag = true; break; case SDLK_F5: showMap = !showMap; @@ -432,7 +432,7 @@ if (optBenchmark) { if (endTime - startTime > optBenchmarkLen * 1000) - exitFlag = TRUE; + exitFlag = true; } } diff -r ef6c826c5b7a -r 9807ae37ad69 tests/dzlibtest.c --- a/tests/dzlibtest.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tests/dzlibtest.c Thu Dec 08 15:59:22 2022 +0200 @@ -12,8 +12,8 @@ unsigned int optSkip = 0; unsigned int optCompressLevel = Z_BEST_COMPRESSION; -BOOL optCompress = FALSE, - optUseZLIB = FALSE; +bool optCompress = false, + optUseZLIB = false; static const DMOptArg optList[] = @@ -36,7 +36,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { (void) currArg; @@ -52,12 +52,12 @@ break; case 2: - optUseZLIB = TRUE; + optUseZLIB = true; break; case 3: - optUseZLIB = TRUE; - optCompress = TRUE; + optUseZLIB = true; + optCompress = true; break; case 4: @@ -65,7 +65,7 @@ optCompressLevel < 1 || optCompressLevel > 9) { dmErrorMsg("Invalid compression level argument '%s', must be 1 .. 9.\n", optArg); - return FALSE; + return false; } break; @@ -73,19 +73,19 @@ if (!dmGetIntVal(optArg, &optSkip, NULL)) { dmErrorMsg("Invalid skip value '%s'.\n", optArg); - return FALSE; + return false; } break; default: - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleFile(char *currArg) +bool argHandleFile(char *currArg) { if (optInFilename == NULL) optInFilename = currArg; @@ -95,13 +95,13 @@ else { dmErrorMsg("Excess filenames specified.\n"); - return FALSE; + return false; } - return TRUE; + return true; } -int dmTestDMZlib(FILE *inFile, FILE *outFile, size_t *inSize, size_t *outSize, BOOL compress, int level) +int dmTestDMZlib(FILE *inFile, FILE *outFile, size_t *inSize, size_t *outSize, bool compress, int level) { Uint8 *inBuffer = NULL, *outBuffer = NULL; DMZLibContext ctx; @@ -138,10 +138,10 @@ ctx.outBuffer = ctx.outBufferStart = outBuffer; ctx.outBufferEnd = outBuffer + SET_TMPBUF_SIZE; - ctx.expandable = TRUE; + ctx.expandable = true; // Attempt decompression - if ((ret = dmZLibParseHeader(&ctx, TRUE)) != DMERR_OK) + if ((ret = dmZLibParseHeader(&ctx, true)) != DMERR_OK) { dmErrorMsg("Error parsing ZLIB header: %d, %s\n", ret, dmErrorStr(ret)); goto out; @@ -170,10 +170,10 @@ } -int dmTestZlib(FILE *inFile, FILE *outFile, size_t *inSize, size_t *outSize, BOOL compress, int level) +int dmTestZlib(FILE *inFile, FILE *outFile, size_t *inSize, size_t *outSize, bool compress, int level) { Uint8 *inBuffer = NULL, *outBuffer = NULL; - int zret, zinit = FALSE; + int zret, zinit = false; int ret = DMERR_OK; z_stream zstr; @@ -199,7 +199,7 @@ ret = dmError(DMERR_INIT_FAIL, "Zlib init fail.\n"); goto out; } - zinit = TRUE; + zinit = true; // Initialize compression streams zret = Z_OK; diff -r ef6c826c5b7a -r 9807ae37ad69 tests/encbr1test.c --- a/tests/encbr1test.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tests/encbr1test.c Thu Dec 08 15:59:22 2022 +0200 @@ -28,12 +28,12 @@ #endif -BOOL dmIFFEncodeByteRun1LIT(DMResource *fp, +bool dmIFFEncodeByteRun1LIT(DMResource *fp, const Uint8 *buf, const size_t offs, const size_t count) { if (count <= 0) - return TRUE; + return true; #if BR_DEBUG != 0 || defined(BR_WRITE) Uint8 tmp = count - 1; @@ -53,21 +53,21 @@ #ifdef BR_WRITE if (!dmf_write_byte(fp, tmp) || !dmf_write_str(fp, buf + offs, count)) - return FALSE; + return false; #else (void) fp; #endif - return TRUE; + return true; } -BOOL dmIFFEncodeByteRun1RLE(DMResource *fp, +bool dmIFFEncodeByteRun1RLE(DMResource *fp, const Uint8 *buf, const size_t offs, const size_t count) { if (count <= 0) - return TRUE; + return true; #if BR_DEBUG != 0 || defined(BR_WRITE) Uint8 tmp = ((Uint8) count - 2) ^ 0xff; @@ -84,20 +84,20 @@ #ifdef BR_WRITE if (!dmf_write_byte(fp, tmp) || !dmf_write_byte(fp, data)) - return FALSE; + return false; #else (void) fp; #endif - return TRUE; + return true; } -BOOL dmIFFEncodeByteRun1Row(DMResource *fp, const Uint8 *buf, const size_t bufLen) +bool dmIFFEncodeByteRun1Row(DMResource *fp, const Uint8 *buf, const size_t bufLen) { int prev = -1, mode = DMODE_LIT; size_t offs, l_offs, r_offs; - BOOL ret = TRUE; + bool ret = true; #if BR_DEBUG == 1 mcount = 0; @@ -106,7 +106,7 @@ for (offs = l_offs = r_offs = 0; offs < bufLen; offs++) { Uint8 data = buf[offs]; - BOOL flush = FALSE; + bool flush = false; int pmode = mode; if (data == prev) @@ -144,7 +144,7 @@ if ((pmode == DMODE_RLE && offs - r_offs >= 128) || (pmode == DMODE_LIT && offs - l_offs >= 128)) { - flush = TRUE; + flush = true; #if BR_DEBUG == 2 printf(" "); #endif @@ -154,7 +154,7 @@ if (offs == bufLen - 1) { offs++; - flush = TRUE; + flush = true; pmode = mode; #if BR_DEBUG == 2 printf(" "); diff -r ef6c826c5b7a -r 9807ae37ad69 tests/plrtest.c --- a/tests/plrtest.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tests/plrtest.c Thu Dec 08 15:59:22 2022 +0200 @@ -138,10 +138,10 @@ { printf("* Trying XM...\n"); dmfreset(file); - if ((res = jssLoadXM(file, &mod, TRUE)) == DMERR_OK) + if ((res = jssLoadXM(file, &mod, true)) == DMERR_OK) { dmfreset(file); - res = jssLoadXM(file, &mod, FALSE); + res = jssLoadXM(file, &mod, false); } } #endif @@ -150,10 +150,10 @@ { printf("* Trying JSSMOD ...\n"); dmfreset(file); - if ((res = jssLoadJSSMOD(file, &mod, TRUE)) == DMERR_OK) + if ((res = jssLoadJSSMOD(file, &mod, true)) == DMERR_OK) { dmfreset(file); - res = jssLoadJSSMOD(file, &mod, FALSE); + res = jssLoadJSSMOD(file, &mod, false); } } #endif @@ -237,7 +237,7 @@ SDL_LockAudio(); SDL_PauseAudio(0); SDL_UnlockAudio(); - BOOL playing = TRUE; + bool playing = true; while (playing) { JSSPattern *pattern = NULL; diff -r ef6c826c5b7a -r 9807ae37ad69 tools/64vw.c --- a/tools/64vw.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/64vw.c Thu Dec 08 15:59:22 2022 +0200 @@ -20,9 +20,9 @@ int optVFlags = 0; int optScrWidth, optScrHeight; int optForcedFormat = -1; -BOOL optInfoOnly = FALSE, - optProbeOnly = FALSE, - optListOnly = FALSE; +bool optInfoOnly = false, + optProbeOnly = false, + optListOnly = false; size_t noptFilenames1 = 0, noptFilenames2 = 0; char **optFilenames = NULL; const char *optCharROMFilename = NULL; @@ -83,7 +83,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -113,7 +113,7 @@ if (factor < 1 || factor >= 10) { dmErrorMsg("Invalid scale factor %1.0f, see help for valid values.\n", factor); - return FALSE; + return false; } dmSetScaleFactor(factor); @@ -121,7 +121,7 @@ else { dmErrorMsg("Invalid scale factor '%s'.\n", optArg); - return FALSE; + return false; } } break; @@ -142,31 +142,31 @@ if (optForcedFormat < 0) { dmErrorMsg("Invalid image format argument '%s'.\n", optArg); - return FALSE; + return false; } break; case 16: - argShowC64Formats(stdout, FALSE, TRUE); + argShowC64Formats(stdout, false, true); exit(0); break; case 20: // NOTICE! This fallthrough is intentional for -l option! // Take care if reordering the option indices. - optListOnly = TRUE; + optListOnly = true; // Fallthrough case 18: if (dmVerbosity < 1) dmVerbosity = 1; - optInfoOnly = TRUE; + optInfoOnly = true; break; case 22: if (dmVerbosity < 1) dmVerbosity = 1; - optProbeOnly = TRUE; + optProbeOnly = true; break; case 24: @@ -178,31 +178,31 @@ default: dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleFile1(char *filename) +bool argHandleFile1(char *filename) { (void) filename; noptFilenames1++; - return TRUE; + return true; } -BOOL argHandleFile2(char *filename) +bool argHandleFile2(char *filename) { if (noptFilenames2 < noptFilenames1) { optFilenames[noptFilenames2++] = filename; - return TRUE; + return true; } else - return FALSE; + return false; } @@ -220,7 +220,7 @@ dmGrowBufConstCreateFrom(&tmp, dataBuf, dataSize); if (optProbeOnly) - ret = dmC64ProbeBMP(&tmp, fmt) != DM_PROBE_SCORE_FALSE ? DMERR_OK : DMERR_NOT_SUPPORTED; + ret = dmC64ProbeBMP(&tmp, fmt) != DM_PROBE_SCORE_false ? DMERR_OK : DMERR_NOT_SUPPORTED; else ret = dmC64DecodeBMP(cimage, &tmp, -1, -1, fmt, forced); @@ -232,13 +232,13 @@ int dmConvertC64ImageToSDLSurface(DMImage **bimage, SDL_Surface **psurf, DMC64Image *cimage, const DMC64ImageConvSpec *spec) { - BOOL charDataSet = FALSE; + bool charDataSet = false; int res; if (cimage->charData[0].data == NULL) { memcpy(&cimage->charData[0], &setCharROM, sizeof(DMC64MemBlock)); - charDataSet = TRUE; + charDataSet = true; } res = dmC64ConvertBMP2Image(bimage, cimage, spec); @@ -273,7 +273,7 @@ SDL_Texture *texture = NULL; SDL_Surface *surf = NULL; DMImage *bimage = NULL; - BOOL initSDL = FALSE, exitFlag, needRedraw; + bool initSDL = false, exitFlag, needRedraw; size_t currIndex, prevIndex; int res = DMERR_OK; @@ -382,7 +382,7 @@ optSpec.cpal = optC64Palette; - if ((res = dmC64PaletteFromC64Palette(&optSpec.pal, optC64Palette, FALSE)) != DMERR_OK) + if ((res = dmC64PaletteFromC64Palette(&optSpec.pal, optC64Palette, false)) != DMERR_OK) { dmErrorMsg("Could not setup palette: %s\n", dmErrorStr(res)); @@ -411,7 +411,7 @@ dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError()); goto out; } - initSDL = TRUE; + initSDL = true; // Open window if ((window = SDL_CreateWindow(dmProgName, @@ -436,8 +436,8 @@ // Start main loop currIndex = 0; prevIndex = 1; - needRedraw = TRUE; - exitFlag = FALSE; + needRedraw = true; + exitFlag = false; while (!exitFlag) { SDL_Event event; @@ -449,7 +449,7 @@ { case SDLK_ESCAPE: case SDLK_q: - exitFlag = TRUE; + exitFlag = true; break; case SDLK_UP: @@ -501,21 +501,21 @@ break; } - needRedraw = TRUE; + needRedraw = true; break; case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_EXPOSED: - needRedraw = TRUE; + needRedraw = true; break; case SDL_WINDOWEVENT_RESIZED: optScrWidth = event.window.data1; optScrHeight = event.window.data2; - needRedraw = TRUE; + needRedraw = true; break; } break; @@ -608,7 +608,7 @@ SDL_SetWindowTitle(window, title); dmFree(title); - needRedraw = TRUE; + needRedraw = true; prevIndex = currIndex; } @@ -617,7 +617,7 @@ SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer); - needRedraw = FALSE; + needRedraw = false; } SDL_Delay(50); diff -r ef6c826c5b7a -r 9807ae37ad69 tools/data2inc.c --- a/tools/data2inc.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/data2inc.c Thu Dec 08 15:59:22 2022 +0200 @@ -48,10 +48,10 @@ const DMOutputFormat *setFormat = NULL; int optIndentation = -1, optLineLen = SET_DEF_LINELEN; -BOOL optHexMode = FALSE, - optQuiet = FALSE, - optExtraData = FALSE, - optFormatting = TRUE; +bool optHexMode = false, + optQuiet = false, + optExtraData = false, + optFormatting = true; static const DMOptArg optList[] = @@ -359,7 +359,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -388,12 +388,12 @@ if (strcasecmp(fmt->name, optArg) == 0) { setFormat = fmt; - return TRUE; + return true; } } dmErrorMsg("Invalid format name '%s'.\n", optArg); - return FALSE; + return false; case 16: optAddLine = optArg; @@ -405,20 +405,20 @@ { dmErrorMsg("Invalid line length / number of items per line '%s'.\n", optArg); - return FALSE; + return false; } break; case 20: - optHexMode = TRUE; + optHexMode = true; break; case 22: - optQuiet = TRUE; + optQuiet = true; break; case 24: - optFormatting = FALSE; + optFormatting = false; break; case 26: @@ -426,19 +426,19 @@ break; case 28: - optExtraData = TRUE; + optExtraData = true; break; 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 == NULL) optInFilename = currArg; @@ -448,7 +448,7 @@ else dmErrorMsg("Source and destination filenames already specified, extraneous argument '%s'.\n", currArg); - return TRUE; + return true; } diff -r ef6c826c5b7a -r 9807ae37ad69 tools/dumpmod.c --- a/tools/dumpmod.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/dumpmod.c Thu Dec 08 15:59:22 2022 +0200 @@ -13,11 +13,11 @@ char *optFilename = NULL; -BOOL optViewPatterns = FALSE, - optViewInstruments = FALSE, - optViewExtInstruments = FALSE, - optViewGeneralInfo = FALSE, - optDump = FALSE; +bool optViewPatterns = false, + optViewInstruments = false, + optViewExtInstruments = false, + optViewGeneralInfo = false, + optDump = false; static const DMOptArg optList[] = @@ -44,7 +44,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { (void) optArg; @@ -65,42 +65,42 @@ break; case 10: - optViewPatterns = TRUE; + optViewPatterns = true; break; case 12: - optViewInstruments = TRUE; + optViewInstruments = true; break; case 14: - optViewExtInstruments = TRUE; + optViewExtInstruments = true; break; case 16: - optViewGeneralInfo = TRUE; + optViewGeneralInfo = true; break; case 18: - optDump = TRUE; + optDump = true; break; case 20: - optViewPatterns = TRUE; - optViewInstruments = TRUE; - optViewGeneralInfo = TRUE; - optViewExtInstruments = TRUE; + optViewPatterns = true; + optViewInstruments = true; + optViewGeneralInfo = true; + optViewExtInstruments = true; break; default: dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleFile(char *currArg) +bool argHandleFile(char *currArg) { // Was not option argument if (!optFilename) @@ -108,10 +108,10 @@ else { dmErrorMsg("Oh noes, we can only hand one file and '%s' looks like a second one!\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -461,10 +461,10 @@ { dmMsg(2, "* Trying XM...\n"); dmfreset(file); - if ((res = jssLoadXM(file, &mod, TRUE)) == DMERR_OK) + if ((res = jssLoadXM(file, &mod, true)) == DMERR_OK) { dmfreset(file); - res = jssLoadXM(file, &mod, FALSE); + res = jssLoadXM(file, &mod, false); } } #endif @@ -473,10 +473,10 @@ { dmMsg(1, "* Trying JSSMOD ...\n"); dmfreset(file); - if ((res = jssLoadJSSMOD(file, &mod, TRUE)) == DMERR_OK) + if ((res = jssLoadJSSMOD(file, &mod, true)) == DMERR_OK) { dmfreset(file); - res = jssLoadJSSMOD(file, &mod, FALSE); + res = jssLoadJSSMOD(file, &mod, false); } } #endif diff -r ef6c826c5b7a -r 9807ae37ad69 tools/fanalyze.c --- a/tools/fanalyze.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/fanalyze.c Thu Dec 08 15:59:22 2022 +0200 @@ -51,7 +51,7 @@ Uint8 *data; size_t size; DMStats stats; - BOOL analyzed; + bool analyzed; size_t index; } DMSourceFile; @@ -100,7 +100,7 @@ int disp; int nvalues; Uint32 values[SET_MAX_GREP_LIST]; - BOOL vwildcards[SET_MAX_GREP_LIST]; + bool vwildcards[SET_MAX_GREP_LIST]; } DMGrepValue; @@ -156,7 +156,7 @@ int nsetGrepValues = 0; DMGrepValue setGrepValues[SET_MAX_GREP_VALUES]; size_t optMinMatchLen = 8; -BOOL optOffsetMode = FALSE; +bool optOffsetMode = false; DMMatchSeq dmSequences[SET_MAX_SEQUENCES]; int ndmSequences = 0; @@ -204,13 +204,13 @@ } -BOOL dmGetData(const int type, const DMSourceFile *file, const size_t offs, Uint32 *mval) +bool dmGetData(const int type, const DMSourceFile *file, const size_t offs, Uint32 *mval) { Uint8 *data = file->data + offs; if (offs + dmGrepTypes[type].bsize >= file->size) { *mval = 0; - return FALSE; + return false; } switch (type) @@ -237,13 +237,13 @@ default: *mval = 0; - return FALSE; + return false; } - return TRUE; + return true; } -void dmPrintGrepValueList(FILE *fh, const DMGrepValue *node, const BOOL match, DMSourceFile *file, const size_t offs) +void dmPrintGrepValueList(FILE *fh, const DMGrepValue *node, const bool match, DMSourceFile *file, const size_t offs) { char mfmt[16]; unsigned int bsize = dmGrepTypes[node->type].bsize; @@ -280,7 +280,7 @@ char *vspec, *vstr, *vsep; DMGrepValue val; int ret = DMERR_OK; - BOOL more; + bool more; memset(&val, 0, sizeof(val)); @@ -306,19 +306,19 @@ // Parse spec if any if (vspec != NULL) { - BOOL vendianess = TRUE; + bool vendianess = true; char *vtmp = vspec; // Get endianess specifier, if any if (strncasecmp(vtmp, "le", 2) == 0) { - vendianess = TRUE; + vendianess = true; vtmp += 2; } else if (strncasecmp(vtmp, "be", 2) == 0) { - vendianess = FALSE; + vendianess = false; vtmp += 2; } @@ -384,14 +384,14 @@ if ((vsep = strchr(vtmp, ',')) != NULL) { *vsep = 0; - more = TRUE; + more = true; } else - more = FALSE; + more = false; if (vtmp[0] == '#' || vtmp[0] == '?') { - val.vwildcards[val.nvalues] = TRUE; + val.vwildcards[val.nvalues] = true; if (mode == FA_OFFSET) { ret = dmError(DMERR_INVALID_ARGS, @@ -471,7 +471,7 @@ printf("Grep %s: ", dmGrepTypes[val.type].desc); - dmPrintGrepValueList(stdout, node, FALSE, NULL, 0); + dmPrintGrepValueList(stdout, node, false, NULL, 0); printf("\n"); } } @@ -489,7 +489,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -523,24 +523,24 @@ { dmErrorMsg("Invalid minimum match length '%s'.\n", optArg); - return FALSE; + return false; } - return TRUE; + return true; case 18: - optOffsetMode = TRUE; + optOffsetMode = true; break; default: dmErrorMsg("Unknown argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleNonOpt(char *currArg) +bool argHandleNonOpt(char *currArg) { if (nsrcFiles < SET_MAX_FILES) { @@ -548,13 +548,13 @@ file->filename = currArg; file->index = nsrcFiles; nsrcFiles++; - return TRUE; + return true; } else { dmErrorMsg("Maximum number of input files exceeded (%d).\n", SET_MAX_FILES); - return TRUE; + return true; } } @@ -591,7 +591,7 @@ } -BOOL dmAddMatchSequence(Uint8 *data, const size_t len, DMSourceFile *file, size_t offs) +bool dmAddMatchSequence(Uint8 *data, const size_t len, DMSourceFile *file, size_t offs) { DMMatchSeq *seq = NULL; @@ -613,7 +613,7 @@ if (ndmSequences + 1 >= SET_MAX_SEQUENCES) { dmErrorMsg("Too many matching sequences found.\n"); - return FALSE; + return false; } seq = &dmSequences[ndmSequences++]; @@ -626,7 +626,7 @@ DMMatchPlace *place = &seq->places[n]; if (place->file == file && place->offs + seq->len == offs + len) - return TRUE; + return true; } } @@ -640,10 +640,10 @@ place->file = file; place->offs = offs; - return TRUE; + return true; } else - return FALSE; + return false; } @@ -660,7 +660,7 @@ { DMCompElem *compBuf = NULL; size_t compBufSize = 0, totalSize = 0, fileFlagsSize; - BOOL *fileFlags = NULL; + bool *fileFlags = NULL; int res; memset(&dmSequences, 0, sizeof(dmSequences)); @@ -686,7 +686,7 @@ } // Allocate file flags - fileFlagsSize = sizeof(BOOL) * nsrcFiles; + fileFlagsSize = sizeof(bool) * nsrcFiles; if ((fileFlags = dmMalloc(fileFlagsSize)) == NULL) { dmErrorMsg("Could not allocate %" DM_PRIu_SIZE_T " bytes of memory for file flag array.\n", @@ -730,7 +730,7 @@ { DMGrepValue *node = &setGrepValues[n]; const DMGrepType *def = &dmGrepTypes[node->type]; - BOOL sep = FALSE; + bool sep = false; if (optOffsetMode) { @@ -740,7 +740,7 @@ for (size_t offs = 0; offs + (def->bsize * node->nvalues) < file->size; offs++) { - BOOL match = TRUE; + bool match = true; for (int n = 0; n < node->nvalues; n++) if (!node->vwildcards[n]) { @@ -749,7 +749,7 @@ if (mval != node->values[n]) { - match = FALSE; + match = false; break; } } @@ -759,7 +759,7 @@ if (optOffsetMode) { printf("%s0x%" DM_PRIx_SIZE_T, sep ? "," : "", offs); - sep = TRUE; + sep = true; } else printf("%08" DM_PRIx_SIZE_T, offs); @@ -769,7 +769,7 @@ if (dmVerbosity >= 1) { printf(" : "); - dmPrintGrepValueList(stdout, node, TRUE, file, offs); + dmPrintGrepValueList(stdout, node, true, file, offs); } printf("\n"); } @@ -902,7 +902,7 @@ for (size_t offs = 0, n = 0; offs < compBufSize; offs++) { DMCompElem *el = &compBuf[offs]; - BOOL var = el->variants > 1; + bool var = el->variants > 1; if (n == 0) printf("%08" DM_PRIx_SIZE_T " | ", offs); @@ -985,7 +985,7 @@ // // Attempt to find matching sequences of N+ // - BOOL slow = FALSE; + bool slow = false; int ss = 0; printf("Attempting to find matching sequences of %" DM_PRIu_SIZE_T " bytes or more.\n", optMinMatchLen); @@ -995,7 +995,7 @@ dmPrint(0, "WARNING! Total data size is large, and the matching \"algorithm\"\n" "used is horribly inefficient. This will be quite slow ...\n"); - slow = TRUE; + slow = true; } for (int nfile1 = 0; nfile1 < nsrcFiles; nfile1++) @@ -1042,7 +1042,7 @@ moffs1++; } } - file1->analyzed = TRUE; + file1->analyzed = true; } done: @@ -1071,7 +1071,7 @@ DMMatchPlace *place = &seq->places[nplace]; if (!fileFlags[place->file->index]) { - fileFlags[place->file->index] = TRUE; + fileFlags[place->file->index] = true; seq->nfiles++; } } diff -r ef6c826c5b7a -r 9807ae37ad69 tools/fontconv.c --- a/tools/fontconv.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/fontconv.c Thu Dec 08 15:59:22 2022 +0200 @@ -52,7 +52,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -85,7 +85,7 @@ optArg); dmFree(tmpStr); - return FALSE; + return false; } dmFree(tmpStr); @@ -97,7 +97,7 @@ dmErrorMsg("Invalid font size value ('%s')\n", optArg); - return FALSE; + return false; } fontH = fontW; } @@ -108,7 +108,7 @@ dmErrorMsg("Invalid font dimensions, must be %d < W %d, %d < H < %d.\n", DMFONT_MIN_WIDTH , DMFONT_MAX_WIDTH, DMFONT_MIN_HEIGHT , DMFONT_MAX_HEIGHT); - return FALSE; + return false; } optSplitWidth = fontW; optSplitHeight = fontH; @@ -127,7 +127,7 @@ { dmErrorMsg("Invalid RGB hex representation '%s'.\n", optArg); - return FALSE; + return false; } optColor.r = colR; @@ -142,26 +142,26 @@ { dmErrorMsg("Invalid argument for -b option, '%s'.\n", optArg); - return FALSE; + return false; } if (optBPP != 8 && optBPP != 32) { dmErrorMsg("Invalid bit depth %d, must be 8 or 32.\n", optBPP); - return FALSE; + return false; } break; 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 == NULL) optInFilename = currArg; @@ -171,10 +171,10 @@ else { dmErrorMsg("Too many filename arguments, '%s'\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -286,7 +286,7 @@ SDL_Surface *fontbmap = NULL; int res = DMERR_OK; #ifdef DM_GFX_TTF_TEXT - BOOL initTTF = FALSE; + bool initTTF = false; TTF_Font *ttf = NULL; #endif @@ -312,7 +312,7 @@ dmErrorMsg("Could not initialize FreeType/TTF: %s\n", SDL_GetError()); goto out; } - initTTF = TRUE; + initTTF = true; #endif // Open the source file diff -r ef6c826c5b7a -r 9807ae37ad69 tools/gfxconv.c --- 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 [*] or or :[*].\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)); diff -r ef6c826c5b7a -r 9807ae37ad69 tools/lib64fmts.c --- 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 diff -r ef6c826c5b7a -r 9807ae37ad69 tools/lib64gfx.c --- 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; } diff -r ef6c826c5b7a -r 9807ae37ad69 tools/lib64gfx.h --- a/tools/lib64gfx.h Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/lib64gfx.h Thu Dec 08 15:59:22 2022 +0200 @@ -192,7 +192,7 @@ /* // XXX These are not actually used yet (if ever) int dither; // Dither mode (D64_DITH_*) - BOOL aspect; // Render using pixel aspectX/aspectY, FALSE = par=1:1 + bool aspect; // Render using pixel aspectX/aspectY, false = par=1:1 */ } DMC64ImageConvSpec; @@ -390,10 +390,10 @@ // int dmC64ProbeBMP(const DMGrowBuf *buf, const DMC64ImageFormat **fmt); -int dmC64PaletteFromC64Palette(DMPalette **ppal, const DMC64Palette *cpal, const BOOL mixed); -int dmC64SetImagePalette(DMImage *img, const DMC64ImageConvSpec *spec, const BOOL mixed); +int dmC64PaletteFromC64Palette(DMPalette **ppal, const DMC64Palette *cpal, const bool mixed); +int dmC64SetImagePalette(DMImage *img, const DMC64ImageConvSpec *spec, const bool mixed); -BOOL dmCompareAddr16(const DMGrowBuf *buf, const size_t offs, const Uint16 addr); +bool dmCompareAddr16(const DMGrowBuf *buf, const size_t offs, const Uint16 addr); int dmC64MemBlockAlloc(DMC64MemBlock *blk, const size_t size); int dmC64MemBlockCopy(DMC64MemBlock *dst, const DMC64MemBlock *src); @@ -407,7 +407,7 @@ // Encoding and decoding of formats and images 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); const char *dmC64GetOpSubjectName(const int subject); @@ -420,7 +420,7 @@ int dmC64DecodeGenericBMP(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt); -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); int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec); int dmC64ConvertImage2BMP(DMC64Image **pdst, const DMImage *src, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec); diff -r ef6c826c5b7a -r 9807ae37ad69 tools/lib64util.c --- a/tools/lib64util.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/lib64util.c Thu Dec 08 15:59:22 2022 +0200 @@ -90,7 +90,7 @@ const int ndmC64DefaultPalettes = sizeof(dmC64DefaultPalettes) / sizeof(dmC64DefaultPalettes[0]); -char * dmC64GetImageTypeString(char *buf, const size_t len, const int type, const BOOL lng) +char * dmC64GetImageTypeString(char *buf, const size_t len, const int type, const bool lng) { static const char *fmtModesShort[] = { "*", "HiR", "MC", "ECM" }; static const char *fmtModesLong[] = { "*", "Hires", "Multi-color", "Extended Color Mode" }; @@ -142,7 +142,7 @@ if (img != NULL) { - dmC64GetImageTypeString(typeStr, sizeof(typeStr), img->extraInfo[D64_EI_MODE], TRUE); + dmC64GetImageTypeString(typeStr, sizeof(typeStr), img->extraInfo[D64_EI_MODE], true); dmC64ImageDumpLine(fh, indent, "Type", "%s", typeStr); @@ -209,7 +209,7 @@ else if (fmt != NULL) { - dmC64GetImageTypeString(typeStr, sizeof(typeStr), fmt->format->mode, TRUE); + dmC64GetImageTypeString(typeStr, sizeof(typeStr), fmt->format->mode, true); dmC64ImageDumpLine(fh, indent, "Type", "%s", typeStr); @@ -225,7 +225,7 @@ } -void argShowC64Formats(FILE *fh, const BOOL rw, const BOOL verbose) +void argShowC64Formats(FILE *fh, const bool rw, const bool verbose) { fprintf(fh, "Available C64 bitmap formats (-f ):\n" @@ -255,7 +255,7 @@ fprintf(fh, "| %-15s ", - dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->mode, FALSE) + dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->mode, false) ); if (verbose) @@ -333,13 +333,13 @@ } -BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile) +bool argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile) { if (strcasecmp(optArg, "help") == 0 || strcasecmp(optArg, "list") == 0) { argShowC64PaletteHelp(stdout); - return FALSE; + return false; } for (int n = 0; n < ndmC64DefaultPalettes; n++) @@ -348,12 +348,12 @@ if (strcasecmp(pal->name, optArg) == 0) { *ppal = pal; - return TRUE; + return true; } } *palFile = optArg; - return TRUE; + return true; } diff -r ef6c826c5b7a -r 9807ae37ad69 tools/lib64util.h --- a/tools/lib64util.h Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/lib64util.h Thu Dec 08 15:59:22 2022 +0200 @@ -27,12 +27,12 @@ // // Functions // -char * dmC64GetImageTypeString(char *buf, const size_t len, const int type, const BOOL lng); +char * dmC64GetImageTypeString(char *buf, const size_t len, const int type, const bool lng); void dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt, const char *indent); void argShowC64PaletteHelp(FILE *fh); -void argShowC64Formats(FILE *fh, const BOOL rw, const BOOL verbose); -BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile); +void argShowC64Formats(FILE *fh, const bool rw, const bool verbose); +bool argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile); int dmHandleExternalPalette(const char *filename, DMPalette **ppal); diff -r ef6c826c5b7a -r 9807ae37ad69 tools/libgfx.c --- a/tools/libgfx.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/libgfx.c Thu Dec 08 15:59:22 2022 +0200 @@ -326,7 +326,7 @@ buf[0x300] == 0) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -395,7 +395,7 @@ if (len == 0x300) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -881,7 +881,7 @@ // Force non-planar etc memcpy(&tmpSpec, spec, sizeof(DMImageWriteSpec)); - tmpSpec.planar = FALSE; + tmpSpec.planar = false; switch (tmpSpec.pixfmt) { @@ -920,26 +920,26 @@ // Read a PPM/PGM/PNM header line, skipping comments -static BOOL dmReadPPMHeader(DMResource *fp, char *buf, const size_t bufLen) +static bool dmReadPPMHeader(DMResource *fp, char *buf, const size_t bufLen) { - BOOL end = FALSE, comment = FALSE; + bool end = false, comment = false; size_t offs = 0; do { int ch = dmfgetc(fp); if (ch == EOF) - return FALSE; + return false; else if (ch == '#') - comment = TRUE; + comment = true; else if (ch == '\n') { if (!comment) - end = TRUE; + end = true; else - comment = FALSE; + comment = false; } else if (!comment) @@ -950,7 +950,7 @@ } while (!end); buf[offs] = 0; - return TRUE; + return true; } @@ -1033,7 +1033,7 @@ (buf[1] == '5' || buf[1] == '6')) return DM_PROBE_SCORE_MAX; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1051,7 +1051,7 @@ return DM_PROBE_SCORE_GOOD; } - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1436,7 +1436,7 @@ buf[65] >= 1 && buf[65] <= 4) return DM_PROBE_SCORE_GOOD; - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -1447,9 +1447,9 @@ return (soffs < len) ? row[soffs] : 0; } -static BOOL dmPCXFlush(DMPCXData *pcx) +static bool dmPCXFlush(DMPCXData *pcx) { - BOOL ret = TRUE; + bool ret = true; if (pcx->bufOffs > 0) ret = dmf_write_str(pcx->fp, pcx->buf, pcx->bufOffs); @@ -1457,12 +1457,12 @@ return ret; } -static inline BOOL dmPCXPutByte(DMPCXData *pcx, const Uint8 val) +static inline bool dmPCXPutByte(DMPCXData *pcx, const Uint8 val) { if (pcx->bufOffs < pcx->bufLen) { pcx->buf[pcx->bufOffs++] = val; - return TRUE; + return true; } else return dmPCXFlush(pcx); @@ -1537,7 +1537,7 @@ // Always force planar for PCX memcpy(&spec, pspec, sizeof(DMImageWriteSpec)); - spec.planar = TRUE; + spec.planar = true; // XXX: 24bit PCX does not work yet .. if ((img->pixfmt != DM_PIXFMT_PALETTE && img->pixfmt != DM_PIXFMT_GRAYSCALE) || @@ -1671,7 +1671,7 @@ } -static BOOL dmPCXDecodeRLERow(DMResource *fp, Uint8 *buf, const size_t bufLen) +static bool dmPCXDecodeRLERow(DMResource *fp, Uint8 *buf, const size_t bufLen) { size_t offs = 0; do @@ -1680,11 +1680,11 @@ Uint8 data; if (!dmf_read_byte(fp, &data)) - return FALSE; + return false; if ((data & 0xC0) == 0xC0) { - BOOL skip = FALSE; + bool skip = false; count = data & 0x3F; if (count == 0) { @@ -1692,24 +1692,24 @@ { case DM_ERRMODE_RECOV_1: // Use as literal - skip = TRUE; + skip = true; count = 1; break; case DM_ERRMODE_RECOV_2: // Ignore completely - skip = TRUE; + skip = true; break; case DM_ERRMODE_FAIL: default: // Error out on "invalid" data - return FALSE; + return false; } } if (!skip && !dmf_read_byte(fp, &data)) - return FALSE; + return false; } else count = 1; @@ -1719,11 +1719,11 @@ // Check for remaining output count, error out if we wish to if (count > 0 && dmGFXErrorMode == DM_ERRMODE_FAIL) - return FALSE; + return false; } while (offs < bufLen); - return TRUE; + return true; } @@ -1733,7 +1733,7 @@ DMPCXData pcx; DMPCXHeader hdr; int res = 0; - BOOL isPaletted; + bool isPaletted; pcx.buf = NULL; // Read PCX header @@ -1914,16 +1914,16 @@ { int ncolors; Uint8 tmpb; - BOOL read; + bool read; if (!dmf_read_byte(fp, &tmpb) || tmpb != 0x0C) { - read = FALSE; + read = false; ncolors = PCX_PAL_COLORS; } else { - read = TRUE; + read = true; ncolors = 256; } @@ -2040,7 +2040,7 @@ return DM_PROBE_SCORE_GOOD; } - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -2121,7 +2121,7 @@ static int dmCheckIFFChunk(DMIFFChunk *dest, const DMIFFChunk *chunk, - const BOOL multi, const Uint32 minSize) + const bool multi, const Uint32 minSize) { if (dest->count > 0 && !multi) { @@ -2143,7 +2143,7 @@ } -BOOL dmIFFDecodeByteRun1Row(DMResource *fp, Uint8 *buf, const size_t bufLen) +bool dmIFFDecodeByteRun1Row(DMResource *fp, Uint8 *buf, const size_t bufLen) { size_t offs = 0; do @@ -2151,19 +2151,19 @@ Uint8 data, ucount; if (!dmf_read_byte(fp, &ucount)) - return FALSE; + return false; if (ucount == 0x80) { if (!dmf_read_byte(fp, &data)) - return FALSE; + return false; } else if (ucount & 0x80) { Uint8 count = (ucount ^ 0xff) + 2; if (!dmf_read_byte(fp, &data)) - return FALSE; + return false; while (count-- && offs < bufLen) buf[offs++] = data; @@ -2174,18 +2174,18 @@ while (count-- && offs < bufLen) { if (!dmf_read_byte(fp, &data)) - return FALSE; + return false; buf[offs++] = data; } } } while (offs < bufLen); - return TRUE; + return true; } -static BOOL dmIFFReadOneRow(DMResource *fp, DMIFF *iff, Uint8 *buf, const size_t bufLen) +static bool dmIFFReadOneRow(DMResource *fp, DMIFF *iff, Uint8 *buf, const size_t bufLen) { if (iff->bmhd.compression == IFF_COMP_BYTERUN1) return dmIFFDecodeByteRun1Row(fp, buf, bufLen); @@ -2323,7 +2323,7 @@ { DMIFFChunk chunk; DMIFF iff; - BOOL parsed = FALSE; + bool parsed = false; int res = DMERR_OK; memset(&iff, 0, sizeof(iff)); @@ -2364,7 +2364,7 @@ { case IFF_ID_BMHD: // Check for multiple occurences of BMHD - if ((res = dmCheckIFFChunk(&iff.chBMHD, &chunk, FALSE, sizeof(iff.bmhd))) != DMERR_OK) + if ((res = dmCheckIFFChunk(&iff.chBMHD, &chunk, false, sizeof(iff.bmhd))) != DMERR_OK) return res; // Read BMHD data @@ -2416,7 +2416,7 @@ case IFF_ID_CMAP: // Check for multiple occurences of CMAP - if ((res = dmCheckIFFChunk(&iff.chCMAP, &chunk, FALSE, 3)) != DMERR_OK) + if ((res = dmCheckIFFChunk(&iff.chCMAP, &chunk, false, 3)) != DMERR_OK) return res; // Check for sanity @@ -2451,13 +2451,13 @@ } if (iff.chBMHD.count && iff.chBODY.count) - parsed = TRUE; + parsed = true; break; case IFF_ID_BODY: case IFF_ID_ABIT: // Check for multiple occurences of BODY - if ((res = dmCheckIFFChunk(&iff.chBODY, &chunk, FALSE, 1)) != DMERR_OK) + if ((res = dmCheckIFFChunk(&iff.chBODY, &chunk, false, 1)) != DMERR_OK) return res; // Check for sanity @@ -2497,7 +2497,7 @@ return res; if (iff.chCMAP.count) - parsed = TRUE; + parsed = true; break; case IFF_ID_CAMG: @@ -2641,12 +2641,12 @@ }; -static BOOL dmIFFEncodeByteRun1LIT(DMResource *fp, +static bool dmIFFEncodeByteRun1LIT(DMResource *fp, const Uint8 *buf, const size_t offs, const size_t count) { if (count <= 0) - return TRUE; + return true; Uint8 tmp = count - 1; @@ -2656,12 +2656,12 @@ } -static BOOL dmIFFEncodeByteRun1RLE(DMResource *fp, +static bool dmIFFEncodeByteRun1RLE(DMResource *fp, const Uint8 *buf, const size_t offs, const size_t count) { if (count <= 0) - return TRUE; + return true; Uint8 tmp = ((Uint8) count - 2) ^ 0xff, @@ -2673,16 +2673,16 @@ } -BOOL dmIFFEncodeByteRun1Row(DMResource *fp, const Uint8 *buf, const size_t bufLen) +bool dmIFFEncodeByteRun1Row(DMResource *fp, const Uint8 *buf, const size_t bufLen) { int prev = -1, mode = DMODE_LIT; size_t offs, l_offs, r_offs; - BOOL ret = TRUE; + bool ret = true; for (offs = l_offs = r_offs = 0; offs < bufLen; offs++) { Uint8 data = buf[offs]; - BOOL flush = FALSE; + bool flush = false; int pmode = mode; if (data == prev) @@ -2717,7 +2717,7 @@ if (offs == bufLen - 1) { offs++; - flush = TRUE; + flush = true; pmode = mode; } @@ -2743,7 +2743,7 @@ } -static BOOL dmIFFWriteOneRow(DMResource *fp, DMIFF *iff, const Uint8 *buf, const size_t bufLen) +static bool dmIFFWriteOneRow(DMResource *fp, DMIFF *iff, const Uint8 *buf, const size_t bufLen) { if (iff->bmhd.compression == IFF_COMP_BYTERUN1) return dmIFFEncodeByteRun1Row(fp, buf, bufLen); @@ -3055,7 +3055,7 @@ int dmImageProbeGeneric(const Uint8 *buf, const size_t len, const DMImageFormat **pfmt, int *index) { - int scoreMax = DM_PROBE_SCORE_FALSE, scoreIndex = -1; + int scoreMax = DM_PROBE_SCORE_false, scoreIndex = -1; for (int i = 0; i < ndmImageFormatList; i++) { @@ -3078,7 +3078,7 @@ return scoreMax; } else - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } @@ -3104,7 +3104,7 @@ int dmPaletteProbeGeneric(const Uint8 *buf, const size_t len, const DMPaletteFormat **pfmt, int *index) { - int scoreMax = DM_PROBE_SCORE_FALSE, scoreIndex = -1; + int scoreMax = DM_PROBE_SCORE_false, scoreIndex = -1; for (int i = 0; i < ndmPaletteFormatList; i++) { @@ -3127,5 +3127,5 @@ return scoreMax; } else - return DM_PROBE_SCORE_FALSE; + return DM_PROBE_SCORE_false; } diff -r ef6c826c5b7a -r 9807ae37ad69 tools/libgfx.h --- a/tools/libgfx.h Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/libgfx.h Thu Dec 08 15:59:22 2022 +0200 @@ -64,7 +64,7 @@ // Probe scores enum { - DM_PROBE_SCORE_FALSE = 0, + DM_PROBE_SCORE_false = 0, DM_PROBE_SCORE_MAYBE = 250, DM_PROBE_SCORE_AVG = 500, DM_PROBE_SCORE_GOOD = 750, @@ -101,7 +101,7 @@ float aspect; // aspect ratio (vert / horiz), <= 0 if not set - BOOL constpal; // is the palette a const? + bool constpal; // is the palette a const? DMPalette *pal; // pointer to palette struct, NULL if no palette size_t size; @@ -117,7 +117,7 @@ int nplanes, bpp; // number of bitplanes to use, bits per PLANE to use int mask; // masking - BOOL planar; // use planar format if the format supports it + bool planar; // use planar format if the format supports it int compression; // Use compression/compression level (0 = none, 9 = max) // (not all formats support any, or more than on/off compression) } DMImageWriteSpec; diff -r ef6c826c5b7a -r 9807ae37ad69 tools/mod2wav.c --- a/tools/mod2wav.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/mod2wav.c Thu Dec 08 15:59:22 2022 +0200 @@ -58,7 +58,7 @@ optOutFreq = 44100, optMuteOChannels = -1, optStartOrder = -1; -BOOL optUsePlayTime = FALSE; +bool optUsePlayTime = false; size_t optPlayTime; @@ -89,7 +89,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { (void) optArg; @@ -139,19 +139,19 @@ case 24: optPlayTime = atoi(optArg); - optUsePlayTime = TRUE; + optUsePlayTime = true; break; 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 == NULL) optInFilename = currArg; @@ -161,14 +161,14 @@ else { dmErrorMsg("Too many filename arguments (only source and dest needed) '%s'\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL dmWriteWAVChunk(FILE * f, DMWaveChunk *ch) +bool dmWriteWAVChunk(FILE * f, DMWaveChunk *ch) { return dm_fwrite_str(f, ch->chunkID, 4) && dm_fwrite_le32(f, ch->chunkSize); } @@ -267,10 +267,10 @@ { dmMsg(2, "* Trying XM...\n"); dmfreset(inFile); - if ((res = jssLoadXM(inFile, &mod, TRUE)) == DMERR_OK) + if ((res = jssLoadXM(inFile, &mod, true)) == DMERR_OK) { dmfreset(inFile); - res = jssLoadXM(inFile, &mod, FALSE); + res = jssLoadXM(inFile, &mod, false); } } #endif @@ -279,10 +279,10 @@ { dmMsg(1, "* Trying JSSMOD ...\n"); dmfreset(inFile); - if ((res = jssLoadJSSMOD(inFile, &mod, TRUE)) == DMERR_OK) + if ((res = jssLoadJSSMOD(inFile, &mod, true)) == DMERR_OK) { dmfreset(inFile); - res = jssLoadJSSMOD(inFile, &mod, FALSE); + res = jssLoadJSSMOD(inFile, &mod, false); } } #endif @@ -361,9 +361,9 @@ if (optMuteOChannels > 0 && optMuteOChannels <= mod->nchannels) { for (int i = 0; i < mod->nchannels; i++) - jvmMute(dev, i, TRUE); + jvmMute(dev, i, true); - jvmMute(dev, optMuteOChannels - 1, FALSE); + jvmMute(dev, optMuteOChannels - 1, false); } // Open output file diff -r ef6c826c5b7a -r 9807ae37ad69 tools/objlink.c --- a/tools/objlink.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/objlink.c Thu Dec 08 15:59:22 2022 +0200 @@ -156,9 +156,9 @@ char *optDestName = NULL; char *optLinkFileName = NULL; int optLinkFileFormat = FMT_GENERIC; -BOOL optDescribe = FALSE, - optAllowOverlap = FALSE, - optCropOutput = FALSE; +bool optDescribe = false, + optAllowOverlap = false, + optCropOutput = false; unsigned int optCropStart, optCropEnd; unsigned int optInitValue = 0; int optInitValueType = 1; @@ -270,11 +270,11 @@ } -BOOL dmParseSection(const char *arg, unsigned int *sectStart, unsigned int *sectEnd, char **sectName, BOOL canHasName) +bool dmParseSection(const char *arg, unsigned int *sectStart, unsigned int *sectEnd, char **sectName, bool canHasName) { char sectMode, *sep, *str, *namesep; unsigned int tmpi; - BOOL res = FALSE; + bool res = false; // Define reserved section // Create a copy of the argument @@ -347,7 +347,7 @@ *sectEnd = tmpi; } - res = TRUE; + res = true; out: dmFree(str); @@ -355,10 +355,10 @@ } -BOOL dmParseInputFile(char *arg, const int type1, const int type2, const char *desc, BOOL requireAddr) +bool dmParseInputFile(char *arg, const int type1, const int type2, const char *desc, bool requireAddr) { unsigned int tmpi = 0; - BOOL hasAddr = FALSE; + bool hasAddr = false; char *sep; if ((sep = strrchr(arg, ':')) != NULL) @@ -368,26 +368,26 @@ { dmErrorMsg("Invalid %s address '%s' specified for '%s'.\n", desc, sep + 1, arg); - return FALSE; + return false; } - hasAddr = TRUE; + hasAddr = true; } else if (requireAddr) { dmErrorMsg("No %s loading address specified for '%s'.\n", desc, arg); - return FALSE; + return false; } srcFiles[nsrcFiles].filename = arg; srcFiles[nsrcFiles].type = hasAddr ? type1 : type2; srcFiles[nsrcFiles].addr = tmpi; nsrcFiles++; - return TRUE; + return true; } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) @@ -408,22 +408,22 @@ case 10: // Add RAW - if (!dmParseInputFile(optArg, STYPE_RAW, STYPE_RAW, "RAW", TRUE)) - return FALSE; + if (!dmParseInputFile(optArg, STYPE_RAW, STYPE_RAW, "RAW", true)) + return false; break; case 12: // Add PRG - if (!dmParseInputFile(optArg, STYPE_PRGA, STYPE_PRG, "PRG", FALSE)) - return FALSE; + if (!dmParseInputFile(optArg, STYPE_PRGA, STYPE_PRG, "PRG", false)) + return false; break; case 14: { char *sectName = "Clear"; unsigned int sectStart, sectEnd, sectLen; - if (!dmParseSection(optArg, §Start, §End, §Name, TRUE)) - return FALSE; + if (!dmParseSection(optArg, §Start, §End, §Name, true)) + return false; // Allocate memory block sectLen = sectEnd - sectStart + 1; @@ -431,7 +431,7 @@ sectStart, sectEnd, sectLen, sectLen, sectName); if (dmReserveMemBlock(sectStart, sectEnd, sectName, MTYPE_RES) != DMERR_OK) - return FALSE; + return false; } break; @@ -442,7 +442,7 @@ case 18: // Allow overlapping segments - optAllowOverlap = TRUE; + optAllowOverlap = true; break; case 20: @@ -451,7 +451,7 @@ if (optMemModel < 0 || optMemModel >= nmemoryModels) { dmErrorMsg("Invalid memory model number %i!\n", optMemModel); - return FALSE; + return false; } break; @@ -477,7 +477,7 @@ default: dmErrorMsg("Invalid/unknown linker file format '%s'!\n", optArg); - return FALSE; + return false; } break; @@ -499,13 +499,13 @@ default: dmErrorMsg("Invalid init value type '%c' specified for '%s'.\n", p[1], optArg); - return FALSE; + return false; } } if (!dmGetIntVal(optArg, &tmpi, NULL)) { dmErrorMsg("Invalid initvalue '%s'.\n", optArg); - return FALSE; + return false; } optInitValue = tmpi; } @@ -513,14 +513,14 @@ case 28: // Set describe mode - optDescribe = TRUE; + optDescribe = true; break; case 30: { size_t cropLen; - if (!dmParseSection(optArg, &optCropStart, &optCropEnd, NULL, FALSE)) - return FALSE; + if (!dmParseSection(optArg, &optCropStart, &optCropEnd, NULL, false)) + return false; cropLen = optCropEnd - optCropStart + 1; dmMsg(1, "Cutting output to $%.4x - $%.4x " @@ -528,7 +528,7 @@ optCropStart, optCropEnd, cropLen, cropLen); - optCropOutput = TRUE; + optCropOutput = true; } break; @@ -545,13 +545,13 @@ if (!dmGetIntVal(optArg, &tmpi, NULL)) { dmErrorMsg("Invalid loading address '%s'.\n", optArg); - return FALSE; + return false; } if (tmpi >= 64*1024) { dmErrorMsg("Invalid or insane loading address %d/$%x!\n", tmpi, tmpi); - return FALSE; + return false; } optLoadAddress = tmpi; } @@ -559,14 +559,14 @@ default: dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -int dmLoadPRG(const char *filename, const BOOL forceAddr, const int destAddr) +int dmLoadPRG(const char *filename, const bool forceAddr, const int destAddr) { FILE *fh; int dataSize, loadAddr, endAddr, res = DMERR_OK; @@ -843,7 +843,7 @@ int main(int argc, char *argv[]) { FILE *outFile = NULL; - BOOL hasOverlaps; + bool hasOverlaps; int res = DMERR_OK, startAddr, endAddr, dataSize, totalSize; dmInitProg("objlink", "Simple file-linker", "0.83", NULL, NULL); @@ -914,11 +914,11 @@ break; case STYPE_PRG: - dmLoadPRG(srcFiles[i].filename, FALSE, 0); + dmLoadPRG(srcFiles[i].filename, false, 0); break; case STYPE_PRGA: - dmLoadPRG(srcFiles[i].filename, TRUE, srcFiles[i].addr); + dmLoadPRG(srcFiles[i].filename, true, srcFiles[i].addr); break; } @@ -938,7 +938,7 @@ qsort(memBlocks, nmemBlocks, sizeof(DMMemBlock), dmCompareMemBlock); // Check for overlapping conflicts - hasOverlaps = FALSE; + hasOverlaps = false; for (int bk1 = 0; bk1 < nmemBlocks; bk1++) for (int bk2 = 0; bk2 < nmemBlocks; bk2++) if (bk1 != bk2) @@ -949,7 +949,7 @@ DMMemBlock *mb1 = &memBlocks[bk1], *mb2 = &memBlocks[bk2]; - BOOL found = FALSE; + bool found = false; if (mb1->type != MTYPE_RES) continue; @@ -958,7 +958,7 @@ { if (olp1->overlaps[no] == bk2) { - found = TRUE; + found = true; break; } } @@ -977,7 +977,7 @@ (res = dmAddOverlap(olp2, bk1)) != DMERR_OK) goto out; - hasOverlaps = TRUE; + hasOverlaps = true; } } diff -r ef6c826c5b7a -r 9807ae37ad69 tools/packed.c --- a/tools/packed.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/packed.c Thu Dec 08 15:59:22 2022 +0200 @@ -95,7 +95,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -118,7 +118,7 @@ if (optCompressLevel < 0 || optCompressLevel > 9) { dmErrorMsg("Invalid compression level argument '%s', must be 0 .. 9.\n", optArg); - return FALSE; + return false; } break; @@ -131,20 +131,20 @@ { dmErrorMsg("Maximum number of exclusion patterns (%d) exceeded!\n", SET_MAX_FILES); - return FALSE; + return false; } break; default: dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleNonOpt(char *arg) +bool argHandleNonOpt(char *arg) { if (optCommand == CMD_NONE) { @@ -162,7 +162,7 @@ if (optCommand == CMD_NONE) { dmErrorMsg("Invalid command '%s'.\n", arg); - return FALSE; + return false; } } else @@ -179,9 +179,9 @@ { dmErrorMsg("Maximum number of input files (%d) exceeded!\n", SET_MAX_FILES); - return FALSE; + return false; } - return TRUE; + return true; } @@ -287,7 +287,7 @@ DMPackEntry rentry, *pentry; FILE *inFile = NULL; int ret = DMERR_OK; - BOOL zinit = FALSE; + bool zinit = false; z_stream zstr; *ppEntry = NULL; @@ -334,7 +334,7 @@ ret = DMERR_COMPRESSION; goto out; } - zinit = TRUE; + zinit = true; zret = Z_OK; while (!feof(inFile) && zret == Z_OK) @@ -407,14 +407,14 @@ } -int dmPackExtractFile(DMPackFile *pack, DMPackEntry * entry, const BOOL decompress) +int dmPackExtractFile(DMPackFile *pack, DMPackEntry * entry, const bool decompress) { z_stream zstr; FILE *outFile = NULL; Uint8 *inBuffer = NULL, *outBuffer = NULL; size_t remaining; int zret, ret = DMERR_OK; - BOOL zinit = FALSE; + bool zinit = false; if (pack == NULL) return DMERR_NULLPTR; @@ -448,7 +448,7 @@ ret = DMERR_COMPRESSION; goto out; } - zinit = TRUE; + zinit = true; } remaining = entry->csize; @@ -512,36 +512,36 @@ * wildcards ? and *. "?" matches any character and "*" matches * any number of characters. */ -BOOL dmStrMatch(const char *str, const char *pattern) +bool dmStrMatch(const char *str, const char *pattern) { - BOOL matched = TRUE, any = FALSE, end = FALSE; + bool matched = true, any = false, end = false; const char *tmp = NULL; // Check given pattern and string if (str == NULL || pattern == NULL) - return FALSE; + return false; // Start comparision do { - matched = FALSE; + matched = false; switch (*pattern) { case '?': // Any single character matches if (*str) { - matched = TRUE; + matched = true; pattern++; str++; } break; case '*': - matched = TRUE; + matched = true; pattern++; if (!*pattern) - end = TRUE; - any = TRUE; + end = true; + any = true; tmp = pattern; break; @@ -551,7 +551,7 @@ if (*str) str++; else - end = TRUE; + end = true; } else { @@ -559,14 +559,14 @@ { if (tmp) { - any = TRUE; + any = true; pattern = tmp; } else - matched = FALSE; + matched = false; } else - end = TRUE; + end = true; } break; default: @@ -574,14 +574,14 @@ { if (*pattern == *str) { - any = FALSE; - matched = TRUE; + any = false; + matched = true; } else { if (*str) { - matched = TRUE; + matched = true; str++; } } @@ -590,7 +590,7 @@ { if (*pattern == *str) { - matched = TRUE; + matched = true; if (*pattern) pattern++; if (*str) @@ -600,15 +600,15 @@ { if (tmp) { - matched = TRUE; - any = TRUE; + matched = true; + any = true; pattern = tmp; } } } if (!*str && !*pattern) - end = TRUE; + end = true; break; } // switch @@ -619,14 +619,14 @@ } -BOOL dmMatchList(char **list, const size_t nlist, const char *str) +bool dmMatchList(char **list, const size_t nlist, const char *str) { for (size_t i = 0; i < nlist; i++) { if (dmStrMatch(str, list[i])) - return TRUE; + return true; } - return FALSE; + return false; } @@ -672,7 +672,7 @@ case CMD_ADD: dmMsg(1, "Opening existing PACK\n"); - res = dmPackOpen(optPackFilename, &pack, FALSE); + res = dmPackOpen(optPackFilename, &pack, false); break; } @@ -710,7 +710,7 @@ case CMD_LIST: // List files in PACK - if ((res = dmPackOpen(optPackFilename, &pack, TRUE)) != DMERR_OK) + if ((res = dmPackOpen(optPackFilename, &pack, true)) != DMERR_OK) { dmErrorMsg("Could not open PACK file: %s\n", dmErrorStr(res)); @@ -734,14 +734,14 @@ // Print all the matching entries for (entry = pack->entries; entry != NULL; entry = entry->next) { - BOOL match; + bool match; if (nsrcFilenames > 0) // Check for matches in specified filenames/patterns match = dmMatchList(srcFilenames, nsrcFilenames, entry->filename); else // No filenames specified, everything shown - match = TRUE; + match = true; if (match && !dmMatchList(excFilenames, nexcFilenames, entry->filename)) { @@ -772,7 +772,7 @@ case CMD_EXTRACT: // Extract files from PACK - if ((res = dmPackOpen(optPackFilename, &pack, TRUE)) != DMERR_OK) + if ((res = dmPackOpen(optPackFilename, &pack, true)) != DMERR_OK) { dmErrorMsg("Could not open PACK file: %s\n", dmErrorStr(res)); @@ -781,7 +781,7 @@ for (entry = pack->entries; entry != NULL; entry = entry->next) { - BOOL match; + bool match; // Check for matches if (nsrcFilenames > 0) diff -r ef6c826c5b7a -r 9807ae37ad69 tools/ppl.c --- a/tools/ppl.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/ppl.c Thu Dec 08 15:59:22 2022 +0200 @@ -23,7 +23,7 @@ struct { - BOOL exitFlag; + bool exitFlag; SDL_Window *window; SDL_Renderer *renderer; @@ -34,7 +34,7 @@ int optScrWidth, optScrHeight, optVFlags, optScrDepth; int actChannel; - BOOL pauseFlag; + bool pauseFlag; JSSModule *mod; JSSMixer *dev; @@ -61,8 +61,8 @@ optOutFreq = 48000, optMuteOChannels = -1, optStartOrder = 0; -BOOL optUsePlayTime = FALSE, - optUseGUI = TRUE; +bool optUsePlayTime = false, + optUseGUI = true; size_t optPlayTime; @@ -97,7 +97,7 @@ } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -120,7 +120,7 @@ break; case 12: - optUseGUI = FALSE; + optUseGUI = false; break; case 14: @@ -131,7 +131,7 @@ if (w < 320 || h < 200 || w > 3200 || h > 3200) { dmErrorMsg("Invalid width or height: %d x %d\n", w, h); - return FALSE; + return false; } eng.optScrWidth = w; eng.optScrHeight = h; @@ -139,7 +139,7 @@ else { dmErrorMsg("Invalid size argument '%s'.\n", optArg); - return FALSE; + return false; } } break; @@ -174,29 +174,29 @@ case 32: optPlayTime = atoi(optArg); - optUsePlayTime = TRUE; + optUsePlayTime = true; break; 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 (!optFilename) optFilename = currArg; else { dmErrorMsg("Too many filename arguments '%s'\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -206,7 +206,7 @@ } -BOOL dmInitializeVideo() +bool dmInitializeVideo() { SDL_DestroyTexture(eng.texture); SDL_FreeSurface(eng.screen); @@ -216,7 +216,7 @@ eng.optScrWidth, eng.optScrHeight)) == NULL) { dmErrorMsg("Could not create SDL texture.\n"); - return FALSE; + return false; } if ((eng.screen = SDL_CreateRGBSurfaceWithFormat(0, @@ -224,7 +224,7 @@ 32, SDL_PIXELFORMAT_RGBA32)) == NULL) { dmErrorMsg("Could not create SDL surface.\n"); - return FALSE; + return false; } col.black = dmCol(0 , 0 , 0); @@ -239,7 +239,7 @@ col.scope = dmCol(0 , 0.8, 0); col.red = dmCol(1 , 0 , 0); - return TRUE; + return true; } @@ -539,7 +539,7 @@ } -void dmMuteChannels(BOOL mute) +void dmMuteChannels(bool mute) { for (int i = 0; i < eng.mod->nchannels; i++) jvmMute(eng.dev, i, mute); @@ -548,10 +548,10 @@ int main(int argc, char *argv[]) { - BOOL initSDL = FALSE, audioInit = FALSE; + bool initSDL = false, audioInit = false; DMResource *file = NULL; int res = DMERR_OK; - BOOL muteState = FALSE; + bool muteState = false; memset(&eng, 0, sizeof(eng)); @@ -592,10 +592,10 @@ { dmMsg(2, "* Trying XM...\n"); dmfreset(file); - if ((res = jssLoadXM(file, &eng.mod, TRUE)) == DMERR_OK) + if ((res = jssLoadXM(file, &eng.mod, true)) == DMERR_OK) { dmfreset(file); - res = jssLoadXM(file, &eng.mod, FALSE); + res = jssLoadXM(file, &eng.mod, false); } } #endif @@ -604,10 +604,10 @@ { dmMsg(1, "* Trying JSSMOD ...\n"); dmfreset(file); - if ((res = jssLoadJSSMOD(file, &eng.mod, TRUE)) == DMERR_OK) + if ((res = jssLoadJSSMOD(file, &eng.mod, true)) == DMERR_OK) { dmfreset(file); - res = jssLoadJSSMOD(file, &eng.mod, FALSE); + res = jssLoadJSSMOD(file, &eng.mod, false); } } #endif @@ -646,7 +646,7 @@ SDL_GetError()); goto out; } - initSDL = TRUE; + initSDL = true; // Initialize mixing device @@ -688,7 +688,7 @@ SDL_GetError()); goto out; } - audioInit = TRUE; + audioInit = true; // Initialize player if ((eng.plr = jmpInit(eng.dev)) == NULL) @@ -705,10 +705,10 @@ if (optMuteOChannels >= 0 && optMuteOChannels < eng.mod->nchannels) { - dmMuteChannels(TRUE); - jvmMute(eng.dev, optMuteOChannels, FALSE); + dmMuteChannels(true); + jvmMute(eng.dev, optMuteOChannels, false); eng.actChannel = optMuteOChannels; - muteState = TRUE; + muteState = true; } if (optUseGUI) @@ -782,8 +782,8 @@ while (!eng.exitFlag) { currTick = SDL_GetTicks(); - BOOL needUpdate = (currTick - prevTick > 500), - needRender = FALSE; + bool needUpdate = (currTick - prevTick > 500), + needRender = false; while (SDL_PollEvent(&eng.event)) switch (eng.event.type) @@ -793,7 +793,7 @@ { case SDLK_ESCAPE: case SDLK_q: - eng.exitFlag = TRUE; + eng.exitFlag = true; break; case SDLK_SPACE: @@ -805,7 +805,7 @@ if (eng.actChannel > 0) { eng.actChannel--; - needUpdate = TRUE; + needUpdate = true; } break; @@ -813,7 +813,7 @@ if (eng.actChannel < eng.mod->nchannels - 1) { eng.actChannel++; - needUpdate = TRUE; + needUpdate = true; } break; @@ -826,13 +826,13 @@ else if (eng.event.key.keysym.mod & KMOD_CTRL) { - dmMuteChannels(FALSE); + dmMuteChannels(false); } else { jvmMute(eng.dev, eng.actChannel, !jvmGetMute(eng.dev, eng.actChannel)); } - needUpdate = TRUE; + needUpdate = true; break; case SDLK_PAGEUP: @@ -841,7 +841,7 @@ jmpChangeOrder(eng.plr, dmClamp(eng.plr->order - 1, 0, eng.mod->norders)); JSS_UNLOCK(eng.plr); JSS_UNLOCK(eng.dev); - needUpdate = TRUE; + needUpdate = true; break; case SDLK_PAGEDOWN: @@ -850,14 +850,14 @@ jmpChangeOrder(eng.plr, dmClamp(eng.plr->order + 1, 0, eng.mod->norders)); JSS_UNLOCK(eng.plr); JSS_UNLOCK(eng.dev); - needUpdate = TRUE; + needUpdate = true; break; case SDLK_f: eng.optVFlags ^= SDL_WINDOW_FULLSCREEN_DESKTOP; if (SDL_SetWindowFullscreen(eng.window, eng.optVFlags) != 0) goto out; - needUpdate = TRUE; + needUpdate = true; break; default: @@ -870,7 +870,7 @@ switch (eng.event.window.event) { case SDL_WINDOWEVENT_EXPOSED: - needUpdate = TRUE; + needUpdate = true; break; case SDL_WINDOWEVENT_RESIZED: @@ -879,20 +879,20 @@ if (!dmInitializeVideo()) goto out; - needUpdate = TRUE; + needUpdate = true; break; } break; case SDL_QUIT: - eng.exitFlag = TRUE; + eng.exitFlag = true; break; } // Check for end of song JSS_LOCK(eng.plr); if (!eng.plr->isPlaying) - eng.exitFlag = TRUE; + eng.exitFlag = true; JSS_UNLOCK(eng.plr); if (optUseGUI) @@ -906,7 +906,7 @@ if (currRow != prevRow || needUpdate) { prevRow = currRow; - needUpdate = TRUE; + needUpdate = true; } // Draw frame @@ -935,7 +935,7 @@ eng.plr->order + 1, eng.mod->norders, eng.plr->npattern, eng.mod->npatterns); JSS_UNLOCK(eng.plr); - needRender = TRUE; + needRender = true; } if (needUpdate || currTick - prevTick >= (eng.pauseFlag ? 100 : 20)) @@ -944,7 +944,7 @@ dmDisplayChannels(eng.screen, 5, eng.screen->h * 0.8 + 5, eng.screen->w - 5, eng.screen->h - 5, eng.dev); JSS_UNLOCK(eng.dev); - needRender = TRUE; + needRender = true; } if (needUpdate) @@ -957,7 +957,7 @@ SDL_LockTexture(eng.texture, NULL, &dst.pixels, &dst.pitch); if (dst.pitch != eng.screen->pitch) - eng.exitFlag = TRUE; + eng.exitFlag = true; else memcpy(dst.pixels, eng.screen->pixels, eng.screen->h * dst.pitch); diff -r ef6c826c5b7a -r 9807ae37ad69 tools/xm2jss.c --- a/tools/xm2jss.c Thu Dec 08 15:56:36 2022 +0200 +++ b/tools/xm2jss.c Thu Dec 08 15:59:22 2022 +0200 @@ -23,11 +23,11 @@ char *optInFilename = NULL, *optOutFilename = NULL; -BOOL optIgnoreErrors = FALSE, - optStripExtInstr = FALSE, - optStripInstr = FALSE, - optStripSamples = FALSE, - optOptimize = FALSE; +bool optIgnoreErrors = false, + optStripExtInstr = false, + optStripInstr = false, + optStripSamples = false, + optOptimize = false; int optPatternMode = PATMODE_COMP_HORIZ, optSampMode16 = jsampDelta, @@ -86,7 +86,7 @@ ); } -BOOL argHandleOpt(const int optN, char *optArg, char *currArg) +bool argHandleOpt(const int optN, char *optArg, char *currArg) { switch (optN) { @@ -105,7 +105,7 @@ break; case 10: - optIgnoreErrors = TRUE; + optIgnoreErrors = true; break; case 12: @@ -113,29 +113,29 @@ if (optPatternMode <= 0 || optPatternMode >= PATMODE_LAST) { dmErrorMsg("Unknown pattern conversion mode %d\n", optPatternMode); - return FALSE; + return false; } break; - case 14: optStripExtInstr = TRUE; break; - case 16: optStripInstr = TRUE; break; - case 18: optStripSamples = TRUE; break; + case 14: optStripExtInstr = true; break; + case 16: optStripInstr = true; break; + case 18: optStripSamples = true; break; case 20: optSampMode8 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break; case 22: optSampMode16 = atoi(optArg) & JM_SAMPLE_MODE_MASK; break; - case 24: optOptimize = TRUE; break; + case 24: optOptimize = true; break; default: dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL argHandleFile(char *currArg) +bool argHandleFile(char *currArg) { // Was not option argument if (!optInFilename) @@ -146,10 +146,10 @@ else { dmErrorMsg("Too many filename arguments specified, '%s'.\n", currArg); - return FALSE; + return false; } - return TRUE; + return true; } @@ -165,15 +165,15 @@ /* These functions and the macro mess are meant to make the * conversion routines themselves clearer and simpler. */ -BOOL jsPutByte(Uint8 *patBuf, size_t patBufSize, size_t *npatBuf, Uint8 val) +bool jsPutByte(Uint8 *patBuf, size_t patBufSize, size_t *npatBuf, Uint8 val) { if (*npatBuf >= patBufSize) - return FALSE; + return false; else { patBuf[*npatBuf] = val; (*npatBuf)++; - return TRUE; + return true; } } @@ -510,9 +510,9 @@ #undef JSFOREACHNOTE2 -static BOOL jssMODWriteEnvelope(DMResource *outFile, const JSSEnvelope *env, const char *name, const int ninst) +static bool jssMODWriteEnvelope(DMResource *outFile, const JSSEnvelope *env, const char *name, const int ninst) { - BOOL ok = + bool ok = dmf_write_byte(outFile, env->flags) && dmf_write_byte(outFile, env->npoints) && dmf_write_byte(outFile, env->sustain) && @@ -745,7 +745,7 @@ } // Misc data - BOOL ok = + bool ok = dmf_write_byte(outFile, einst->nsamples) && dmf_write_byte(outFile, einst->vibratoType) && dmf_write_le16(outFile, einst->vibratoSweep) && @@ -863,11 +863,11 @@ /* Scan given pattern for used instruments and channels. * Also checks if the pattern is empty. */ -BOOL jssScanPattern(const JSSModule *module, const JSSPattern *pattern, - const int npattern, BOOL *usedExtInstruments, BOOL *usedChannels) +bool jssScanPattern(const JSSModule *module, const JSSPattern *pattern, + const int npattern, bool *usedExtInstruments, bool *usedChannels) { JSSNote *n = pattern->data; - BOOL empty = TRUE; + bool empty = true; // Check all notes in this pattern for (int row = 0; row < pattern->nrows; row++) @@ -879,7 +879,7 @@ { // Is it valid? if (n->instrument >= 0 && n->instrument < module->nextInstruments) - usedExtInstruments[n->instrument] = TRUE; + usedExtInstruments[n->instrument] = true; else { dmMsg(2, "Pattern 0x%x, row=0x%x, chn=%d has invalid instrument 0x%x\n", @@ -895,9 +895,9 @@ n->param != jsetNotSet) { if (usedChannels != NULL) - usedChannels[channel] = TRUE; + usedChannels[channel] = true; - empty = FALSE; + empty = false; } } @@ -907,7 +907,7 @@ /* Check if two given patterns are dupes */ -BOOL jssComparePattern(const JSSPattern *pat1, const JSSPattern *pat2) +bool jssComparePattern(const JSSPattern *pat1, const JSSPattern *pat2) { return pat1->nrows == pat2->nrows && @@ -927,7 +927,7 @@ */ JSSModule *jssOptimizeModule(JSSModule *src) { - BOOL usedPatterns[jsetMaxPatterns + 1], + bool usedPatterns[jsetMaxPatterns + 1], usedInstruments[jsetMaxInstruments + 1], usedExtInstruments[jsetMaxInstruments + 1]; int mapExtInstruments[jsetMaxInstruments + 1], @@ -962,15 +962,15 @@ // Initialize values for (int i = 0; i <= jsetMaxInstruments; i++) { - usedExtInstruments[i] = FALSE; - usedInstruments[i] = FALSE; + usedExtInstruments[i] = false; + usedInstruments[i] = false; mapExtInstruments[i] = jsetNotSet; mapInstruments[i] = jsetNotSet; } for (int i = 0; i <= jsetMaxPatterns; i++) { - usedPatterns[i] = FALSE; + usedPatterns[i] = false; mapPatterns[i] = jsetNotSet; dupPatterns[i] = jsetNotSet; } @@ -989,16 +989,16 @@ if (pattern != NULL) { // Scan for used instruments etc - BOOL empty = jssScanPattern(src, pattern, npat, usedExtInstruments, NULL); + bool empty = jssScanPattern(src, pattern, npat, usedExtInstruments, NULL); // Empty patterns with known number of rows are "removed" if (empty && pattern->nrows == jsetDefaultRows) { src->orderList[norder] = jsetNotSet; - usedPatterns[npat] = FALSE; + usedPatterns[npat] = false; } else - usedPatterns[npat] = TRUE; + usedPatterns[npat] = true; } else { @@ -1035,7 +1035,7 @@ int q = eip->sNumForNotes[note]; if (q >= 0 && q < src->ninstruments) { - usedInstruments[q] = TRUE; + usedInstruments[q] = true; } else { @@ -1331,7 +1331,7 @@ // Read file dmMsg(1, "Reading XM-format file ...\n"); - res = jssLoadXM(inFile, &src, FALSE); + res = jssLoadXM(inFile, &src, false); dmf_close(inFile); if (res != 0) { @@ -1346,8 +1346,8 @@ } // Check stripping settings - if (optStripExtInstr) optStripInstr = TRUE; - if (optStripInstr) optStripSamples = TRUE; + if (optStripExtInstr) optStripInstr = true; + if (optStripInstr) optStripSamples = true; // Remove samples if (optStripSamples)