diff --git a/source/common/cutscenes/movieplayer.cpp b/source/common/cutscenes/movieplayer.cpp index a13d0c91e..d808fd60b 100644 --- a/source/common/cutscenes/movieplayer.cpp +++ b/source/common/cutscenes/movieplayer.cpp @@ -687,7 +687,7 @@ MoviePlayer* OpenMovie(const char* filename, TArray& ans, const int* framet { size_t nLen = strlen(filename); // Strip the drive letter and retry. - if (nLen >= 3 && isalpha(filename[0]) && filename[1] == ':' && filename[2] == '/') + if (nLen >= 3 && isalpha((uint8_t)filename[0]) && filename[1] == ':' && filename[2] == '/') { filename += 3; fr = fileSystem.OpenFileReader(filename); diff --git a/source/common/utility/cmdlib.cpp b/source/common/utility/cmdlib.cpp index 0dd6f7750..02ab18959 100644 --- a/source/common/utility/cmdlib.cpp +++ b/source/common/utility/cmdlib.cpp @@ -986,7 +986,7 @@ bool IsAbsPath(const char *name) if (IsSeperator(name[0])) return true; #ifdef _WIN32 /* [A-Za-z]: (for Windows) */ - if (isalpha(name[0]) && name[1] == ':') return true; + if (isalpha((uint8_t)name[0]) && name[1] == ':') return true; #endif /* _WIN32 */ return 0; } diff --git a/source/core/ct_chat.cpp b/source/core/ct_chat.cpp index bbdeb8909..714022fa5 100644 --- a/source/core/ct_chat.cpp +++ b/source/core/ct_chat.cpp @@ -379,7 +379,7 @@ static bool DoSubstitution (FString &out, const char *in) out.AppendCStrPart(a, b - a); a = ++b; - while (*b && isalpha(*b)) + while (*b && isalpha((uint8_t) * b)) { ++b; } diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 169c3c2d9..c09da94bf 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -233,7 +233,7 @@ TArray CollectSearchPaths() if (nice.Len() > 0) { #ifdef _WIN32 - if (isalpha(nice[0] && nice[1] == ':' && nice[2] != '/')) continue; // ignore drive relative paths because they are meaningless. + if (isalpha((uint8_t)nice[0] && nice[1] == ':' && nice[2] != '/')) continue; // ignore drive relative paths because they are meaningless. #endif // A path ending with "/*" means to add all subdirectories. if (nice[nice.Len()-2] == '/' && nice[nice.Len()-1] == '*') diff --git a/source/games/blood/src/barf.cpp b/source/games/blood/src/barf.cpp index 634cf80e3..1a34f244c 100644 --- a/source/games/blood/src/barf.cpp +++ b/source/games/blood/src/barf.cpp @@ -59,7 +59,7 @@ struct define_t define_t gCmdDefines[kMaxCmdLineDefines]; -void addMemoryResource(char* fileName, char flags, int ID); +void addMemoryResource(const char* fileName, int flags, int ID); struct tag_t { const char* _value; @@ -320,7 +320,7 @@ void RFS::ScriptError(const char* message) char* p = _pStartLine; while (*p != '\n') { - if (isprint(*p)) + if (isprint((uint8_t) *p)) msg.Push(*p); else msg.Push(' '); @@ -354,7 +354,7 @@ uint8_t RFS::GetNextTag() // skip any space characters do { Increment(); - } while (isspace(_curChar)); + } while (isspace((uint8_t)_curChar)); if (_curChar == '\0') { return kTagEnd; @@ -409,12 +409,12 @@ uint8_t RFS::GetNextTag() isNegative = true; - if (!isdigit(_curChar)) { + if (!isdigit((uint8_t)_curChar)) { UnsetMark(); } } - if (isdigit(_curChar)) + if (isdigit((uint8_t)_curChar)) { // left path if (_curChar == '0') @@ -428,14 +428,14 @@ uint8_t RFS::GetNextTag() while (1) { Increment(); - if (!isxdigit(_curChar)) { // isxdigit() checks for a hex value + if (!isxdigit((uint8_t)_curChar)) { // isxdigit() checks for a hex value break; } // hex version of atoi? scriptValue *= 16; - if (!isdigit(_curChar)) { - scriptValue += toupper(_curChar) - 55; + if (!isdigit((uint8_t)_curChar)) { + scriptValue += toupper((uint8_t)_curChar) - 55; } else { scriptValue += _curChar - '0'; @@ -518,7 +518,7 @@ uint8_t RFS::GetNextTag() i = 0; - while (isalnum(_curChar)) + while (isalnum((uint8_t)_curChar)) { scriptBuffer[i] = _curChar; SetMark(); @@ -987,7 +987,7 @@ void ParseScript(int lumpnum) // //--------------------------------------------------------------------------- -void addMemoryResource(char* filePath, char flags, int ID) +void addMemoryResource(const char* filePath, int flags, int ID) { char zDirectory[BMAX_PATH]; char zFilename[BMAX_PATH]; diff --git a/source/games/blood/src/inifile.cpp b/source/games/blood/src/inifile.cpp index e2ee8d533..1cc2f6d7c 100644 --- a/source/games/blood/src/inifile.cpp +++ b/source/games/blood/src/inifile.cpp @@ -116,7 +116,7 @@ void IniFile::LoadRes(void *res) char *pBuffer = buffer; // remove whitespace from buffer - while (isspace(*pBuffer)) { + while (isspace((uint8_t)*pBuffer)) { pBuffer++; } @@ -239,7 +239,7 @@ bool IniFile::FindKey(const char *key) assert(pEqual != NULL); // remove whitespace - while (isspace(*(pEqual - 1))) { + while (isspace((uint8_t) *(pEqual - 1))) { pEqual--; } @@ -251,7 +251,7 @@ bool IniFile::FindKey(const char *key) // strings match *pEqual = c; _13 = ++pEqualStart; - while (isspace(*_13)) { + while (isspace((uint8_t)*_13)) { _13++; } diff --git a/source/games/blood/src/levels.cpp b/source/games/blood/src/levels.cpp index 0c11d1517..6a4957b7e 100644 --- a/source/games/blood/src/levels.cpp +++ b/source/games/blood/src/levels.cpp @@ -156,7 +156,7 @@ static FString cleanPath(const char* pth) FString path = pth; FixPathSeperator(path); if (fileSystem.FileExists(path)) return path; - if (path.Len() > 3 && path[1] == ':' && isalpha(path[0]) && path[2] == '/') + if (path.Len() > 3 && path[1] == ':' && isalpha((uint8_t)path[0]) && path[2] == '/') { path = path.Mid(3); if (fileSystem.FileExists(path)) return path; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index ea8af77c6..a8db79160 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -6682,7 +6682,7 @@ void useIncDecGen(DBloodActor* sourceactor, int objType, sectortype* destSect, w // //--------------------------------------------------------------------------- -void sprite2sectorSlope(DBloodActor* actor, sectortype* pSector, char rel, bool forcez) +void sprite2sectorSlope(DBloodActor* actor, sectortype* pSector, int rel, bool forcez) { int slope = 0, z = 0; switch (rel) { diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 7acc20ea4..f30cc1017 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -839,7 +839,7 @@ void PathSound(sectortype* pSector, int nSound) // //--------------------------------------------------------------------------- -void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, char bAllWalls) +void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, bool bAllWalls) { int x, y; XSECTOR* pXSector = &pSector->xs(); @@ -1450,13 +1450,13 @@ int StepRotateBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) { vbp = pXSector->data + marker0->int_ang(); int nWave = pXSector->busyWaveA; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->int_pos().X, marker0->int_pos().Y, marker0->int_pos().X, marker0->int_pos().Y, pXSector->data, marker0->int_pos().X, marker0->int_pos().Y, vbp, 1); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->int_pos().X, marker0->int_pos().Y, marker0->int_pos().X, marker0->int_pos().Y, pXSector->data, marker0->int_pos().X, marker0->int_pos().Y, vbp, true); } else { vbp = pXSector->data - marker0->int_ang(); int nWave = pXSector->busyWaveB; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->int_pos().X, marker0->int_pos().Y, marker0->int_pos().X, marker0->int_pos().Y, vbp, marker0->int_pos().X, marker0->int_pos().Y, pXSector->data, 1); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->int_pos().X, marker0->int_pos().Y, marker0->int_pos().X, marker0->int_pos().Y, vbp, marker0->int_pos().X, marker0->int_pos().Y, pXSector->data, true); } pXSector->busy = a2; if (pXSector->command == kCmdLink && pXSector->txID) @@ -1510,7 +1510,7 @@ int PathBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) if (!basepath || !marker0 || !marker1) return 0; int nWave = marker0->xspr.wave; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), basepath->int_pos().X, basepath->int_pos().Y, marker0->int_pos().X, marker0->int_pos().Y, marker0->int_ang(), marker1->int_pos().X, marker1->int_pos().Y, marker1->int_ang(), 1); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), basepath->int_pos().X, basepath->int_pos().Y, marker0->int_pos().X, marker0->int_pos().Y, marker0->int_ang(), marker1->int_pos().X, marker1->int_pos().Y, marker1->int_ang(), true); ZTranslateSector(pSector, pXSector, a2, nWave); pXSector->busy = a2; if ((a2 & 0xffff) == 0) @@ -1555,9 +1555,9 @@ void OperateDoor(sectortype* pSector, EVENT event, BUSYID busyWave) } } else { - char t = !pXSector->state; int nDelta; + int nDelta; - if (t) nDelta = 65536 / ClipLow((pXSector->busyTimeA * 120) / 10, 1); + if (!pXSector->state) nDelta = 65536 / ClipLow((pXSector->busyTimeA * 120) / 10, 1); else nDelta = -65536 / ClipLow((pXSector->busyTimeB * 120) / 10, 1); AddBusy(pSector, busyWave, nDelta); @@ -1623,7 +1623,7 @@ void OperateTeleport(sectortype* pSector) if (actor->spr.statnum == kStatDude) { PLAYER* pPlayer; - char bPlayer = actor->IsPlayerActor(); + bool bPlayer = actor->IsPlayerActor(); if (bPlayer) pPlayer = &gPlayer[actor->spr.type - kDudePlayer1]; else diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 08068e09d..7ab62daa6 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -73,7 +73,7 @@ static int ccmd_spawn(CCmdFuncPtr parm) pal = (uint8_t)atol(parm->parms[1]); set |= 1; [[fallthrough]]; case 1: // tile number - if (isdigit(parm->parms[0][0])) { + if (isdigit((uint8_t)parm->parms[0][0])) { picnum = (unsigned short)atol(parm->parms[0]); } else { diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 307b38831..1c41fe24e 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -407,7 +407,7 @@ bool ConCompiler::ispecial(char c) static bool isaltok(char c) { // isalnum pukes on negative input. - return c > 0 && (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.'); + return c > 0 && (isalnum((uint8_t)c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.'); } //--------------------------------------------------------------------------- @@ -532,7 +532,7 @@ void ConCompiler::getlabel(void) skipcomments(); - while (isalnum(*textptr & 0xff) == 0) + while (isalnum((uint8_t) * textptr & 0xff) == 0) { if (*textptr == 0x0a) line_number++; textptr++; @@ -719,7 +719,7 @@ int ConCompiler::transnum(int type) } } - if (isdigit(*textptr) == 0 && *textptr != '-') + if (isdigit((uint8_t) *textptr) == 0 && *textptr != '-') { ReportError(ERROR_PARMUNDEFINED); errorcount++; @@ -2935,7 +2935,7 @@ int ConCompiler::parsecommand() #if 0 voxel_map[j].name[i] = 0; voxel_map[j].voxnum = -2; // flag to load later - while ((i < 12) && (isalnum(*textptr) || *textptr == '.')) + while ((i < 12) && (isalnum((uint8_t) * textptr) || *textptr == '.')) { voxel_map[j].name[i++] = *textptr++; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index d08586ce5..fcefab2c7 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -4323,7 +4323,7 @@ void getzrangepoint(int x, int y, int z, sectortype* sect, int j, k, l, dax, day, daz, xspan, yspan, xoff, yoff; int x1, y1, x2, y2, x3, y3, x4, y4, cosang, sinang, tilenum; short cstat; - char clipyou; + uint8_t clipyou; if (sect == nullptr) { diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 2013b4147..ebd4c873b 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -15001,7 +15001,6 @@ int InitUzi(PLAYER* pp) int xvect,yvect,zvect; ESpriteFlags cstat = 0; uint8_t pal = 0; - //static char alternate=0; static int uziclock=0; int clockdiff=0; bool FireSnd = false;