From 7f9082b97276736eeb13ed6925c34d4b0650b7ed Mon Sep 17 00:00:00 2001 From: bobtista Date: Sat, 6 Dec 2025 13:56:56 -0500 Subject: [PATCH 1/4] refactor: add explicit comparison to strcmp/stricmp results (bugprone-suspicious-string-compare) --- .../Source/Common/System/GameMemory.cpp | 2 +- .../Source/GameNetwork/GameSpy/PeerDefs.cpp | 2 +- .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 10 +-- Core/GameEngine/Source/GameNetwork/NAT.cpp | 8 +-- .../StdDevice/Common/StdLocalFileSystem.cpp | 4 +- .../Common/Win32LocalFileSystem.cpp | 4 +- .../Source/WWVegas/WWDownload/Download.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/argv.cpp | 10 +-- .../Source/WWVegas/WWLib/cpudetect.cpp | 2 +- Core/Libraries/Source/WWVegas/WWLib/ini.cpp | 2 +- Core/Libraries/Source/debug/debug_cmd.cpp | 48 +++++++------- Core/Libraries/Source/debug/debug_debug.cpp | 12 ++-- Core/Libraries/Source/debug/debug_io_con.cpp | 4 +- Core/Libraries/Source/debug/debug_io_flat.cpp | 24 +++---- Core/Libraries/Source/debug/debug_io_net.cpp | 4 +- Core/Libraries/Source/profile/profile.cpp | 6 +- Core/Libraries/Source/profile/profile_cmd.cpp | 26 ++++---- .../Source/profile/profile_highlevel.cpp | 2 +- .../Source/profile/profile_result.cpp | 6 +- Core/Tools/ImagePacker/Source/ImagePacker.cpp | 40 ++++++------ .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 2 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 20 +++--- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 2 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 4 +- .../GUI/GameWindowManagerScript.cpp | 62 +++++++++---------- .../GameEngine/Source/GameClient/GameText.cpp | 10 +-- .../GameLogic/Object/Update/AIUpdate.cpp | 2 +- .../GameEngine/Source/Common/Recorder.cpp | 2 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 2 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 20 +++--- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 2 +- .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 4 +- .../GUI/GameWindowManagerScript.cpp | 62 +++++++++---------- .../GameEngine/Source/GameClient/GameText.cpp | 10 +-- .../GameLogic/Object/Update/AIUpdate.cpp | 2 +- .../Source/WWVegas/WW3D2/dx8caps.cpp | 18 +++--- 37 files changed, 222 insertions(+), 222 deletions(-) diff --git a/Core/GameEngine/Source/Common/System/GameMemory.cpp b/Core/GameEngine/Source/Common/System/GameMemory.cpp index 78a855c00d..2ede5c780b 100644 --- a/Core/GameEngine/Source/Common/System/GameMemory.cpp +++ b/Core/GameEngine/Source/Common/System/GameMemory.cpp @@ -2681,7 +2681,7 @@ MemoryPool *MemoryPoolFactory::findMemoryPool(const char *poolName) { for (MemoryPool *pool = m_firstPoolInFactory; pool; pool = pool->getNextPoolInList()) { - if (!strcmp(poolName, pool->getPoolName())) + if (strcmp(poolName, pool->getPoolName()) == 0) { DEBUG_ASSERTCRASH(poolName == pool->getPoolName(), ("hmm, ptrs should probably match here")); return pool; diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp index 4e64c1b167..cd67390e83 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp @@ -340,7 +340,7 @@ void GameSpyInfo::addGroupRoom( GameSpyGroupRoom room ) groupLabel.format("GUI:%s", room.m_name.str()); room.m_translatedName = TheGameText->fetch(groupLabel); m_groupRooms[room.m_groupID] = room; - if ( !stricmp("quickmatch", room.m_name.str()) ) + if ( stricmp("quickmatch", room.m_name.str()) == 0 ) { DEBUG_LOG(("Group room %d (%s) is the QuickMatch room", room.m_groupID, room.m_name.str())); TheGameSpyConfig->setQMChannel(room.m_groupID); diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp index 40c5c660e9..e288efeef4 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp @@ -471,7 +471,7 @@ Int PeerThreadClass::findServer( SBServer server ) UnsignedInt oldPrivateIP = SBServerGetPrivateInetAddress(it->second); UnsignedShort oldPrivatePort = SBServerGetPrivateQueryPort(it->second); UnsignedInt oldPublicIP = SBServerGetPublicInetAddress(it->second); - if (!strcmp(oldName, newName) && + if (strcmp(oldName, newName) == 0 && oldPrivateIP == newPrivateIP && oldPublicIP == newPublicIP && oldPrivatePort == newPrivatePort) @@ -1842,7 +1842,7 @@ void PeerThreadClass::handleQMMatch(PEER peer, Int mapIndex, Int seed, Int i=0; for (; igetQMStatus() != QM_IDLE && t->getQMStatus() != QM_STOPPED) { - if (!stricmp(t->getQMBotName().c_str(), nick)) + if (stricmp(t->getQMBotName().c_str(), nick) == 0) { // matchbot left - bail PeerResponse resp; @@ -2845,9 +2845,9 @@ static void listingGamesCallback(PEER peer, PEERBool success, const char * name, DEBUG_LOG(("Game name is '%s'", name)); const char *newname = SBServerGetStringValue(server, "gamename", (char *)name); #if RTS_GENERALS - if (strcmp(newname, "ccgenerals")) + if (strcmp(newname, "ccgenerals") != 0) #elif RTS_ZEROHOUR - if (strcmp(newname, "ccgenzh")) + if (strcmp(newname, "ccgenzh") != 0) #endif name = newname; DEBUG_LOG(("Game name is now '%s'", name)); diff --git a/Core/GameEngine/Source/GameNetwork/NAT.cpp b/Core/GameEngine/Source/GameNetwork/NAT.cpp index 76428c7038..03e5855675 100644 --- a/Core/GameEngine/Source/GameNetwork/NAT.cpp +++ b/Core/GameEngine/Source/GameNetwork/NAT.cpp @@ -1169,7 +1169,7 @@ void NAT::processGlobalMessage(Int slotNum, const char *options) { ++ptr; } DEBUG_LOG(("NAT::processGlobalMessage - got message from slot %d, message is \"%s\"", slotNum, ptr)); - if (!strncmp(ptr, "PROBED", strlen("PROBED"))) { + if (strncmp(ptr, "PROBED", strlen("PROBED")) == 0) { // format: PROBED // a probe has been sent at us, if we are waiting because of a netgear or something, we // should start sending our own probes. @@ -1180,7 +1180,7 @@ void NAT::processGlobalMessage(Int slotNum, const char *options) { } else { DEBUG_LOG(("NAT::processGlobalMessage - probed by node %d, not our target", node)); } - } else if (!strncmp(ptr, "CONNDONE", strlen("CONNDONE"))) { + } else if (strncmp(ptr, "CONNDONE", strlen("CONNDONE")) == 0) { // format: CONNDONE // we should get the node number of the player who's connection is done from the options // and mark that down as part of the connectionStates. @@ -1205,7 +1205,7 @@ void NAT::processGlobalMessage(Int slotNum, const char *options) { } else { DEBUG_LOG(("NAT::processGlobalMessage - got a connection done message that isn't from this round. node: %d sending node: %d", node, sendingNode)); } - } else if (!strncmp(ptr, "CONNFAILED", strlen("CONNFAILED"))) { + } else if (strncmp(ptr, "CONNFAILED", strlen("CONNFAILED")) == 0) { // format: CONNFAILED // we should get the node number of the player who's connection failed from the options // and mark that down as part of the connectionStates. @@ -1214,7 +1214,7 @@ void NAT::processGlobalMessage(Int slotNum, const char *options) { DEBUG_LOG(("NAT::processGlobalMessage - node %d's connection failed, setting connection state to failed", node)); setConnectionState(node, NATCONNECTIONSTATE_FAILED); } - } else if (!strncmp(ptr, "PORT", strlen("PORT"))) { + } else if (strncmp(ptr, "PORT", strlen("PORT")) == 0) { // format: PORT // we should get the node number and the mangled port number of the client we // are supposed to be communicating with and start probing them. No, that was not diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp index b20aa0eda6..c65857047d 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp @@ -241,7 +241,7 @@ void StdLocalFileSystem::getFileListInDirectory(const AsciiString& currentDirect while (!done) { std::string filenameStr = iter->path().filename().string(); if (!iter->is_directory() && iter->path().extension() == searchExt && - (strcmp(filenameStr.c_str(), ".") && strcmp(filenameStr.c_str(), ".."))) { + (strcmp(filenameStr.c_str(), ".") != 0 && strcmp(filenameStr.c_str(), ".."))) { // if we haven't already, add this filename to the list. // a stl set should only allow one copy of each filename AsciiString newFilename = iter->path().string().c_str(); @@ -268,7 +268,7 @@ void StdLocalFileSystem::getFileListInDirectory(const AsciiString& currentDirect while (!done) { std::string filenameStr = iter->path().filename().string(); if(iter->is_directory() && - (strcmp(filenameStr.c_str(), ".") && strcmp(filenameStr.c_str(), ".."))) { + (strcmp(filenameStr.c_str(), ".") != 0 && strcmp(filenameStr.c_str(), ".."))) { AsciiString tempsearchstr(filenameStr.c_str()); // recursively add files in subdirectories if required. diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp index 7b63431cbe..d417d0e731 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp @@ -139,7 +139,7 @@ void Win32LocalFileSystem::getFileListInDirectory(const AsciiString& currentDire while (!done) { if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - (strcmp(findData.cFileName, ".") && strcmp(findData.cFileName, ".."))) { + (strcmp(findData.cFileName, ".") != 0 && strcmp(findData.cFileName, ".."))) { // if we haven't already, add this filename to the list. // a stl set should only allow one copy of each filename AsciiString newFilename; @@ -165,7 +165,7 @@ void Win32LocalFileSystem::getFileListInDirectory(const AsciiString& currentDire while (!done) { if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - (strcmp(findData.cFileName, ".") && strcmp(findData.cFileName, ".."))) { + (strcmp(findData.cFileName, ".") != 0 && strcmp(findData.cFileName, ".."))) { AsciiString tempsearchstr; tempsearchstr.concat(currentDirectory); diff --git a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp index 30cf21c44f..b9d342b10b 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp @@ -47,7 +47,7 @@ HRESULT CDownload::DownloadFile(LPCSTR server, LPCSTR username, LPCSTR password, // If we're still connected, make sure we're on the right server if (m_Status == DOWNLOADSTATUS_FINDINGFILE) { - if ((strcmp(m_Server, server)) || (strcmp(m_Login, username))) + if ((strcmp(m_Server, server) != 0) || (strcmp(m_Login, username))) { // Damn, a server switch. Close conn & fix state m_Ftp->DisconnectFromServer(); diff --git a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp index db7829e5d5..28958b3fbb 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/argv.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/argv.cpp @@ -103,7 +103,7 @@ const char *ArgvClass::Find_Again(const char *arg) if (Is_Exact_Size()) { // Case Sensitive, Exact Size. for (; CurrentPos < Argc; CurrentPos++) { - if (!strcmp(arg, Argv[CurrentPos])) { + if (strcmp(arg, Argv[CurrentPos]) == 0) { return Argv[CurrentPos]; } } @@ -111,7 +111,7 @@ const char *ArgvClass::Find_Again(const char *arg) // Case Sensitive, Match first strlen(arg). int len = strlen(arg); for (; CurrentPos < Argc; CurrentPos++) { - if (!strncmp(arg, Argv[CurrentPos], len)) { + if (strncmp(arg, Argv[CurrentPos], len) == 0) { return Argv[CurrentPos]; } } @@ -120,7 +120,7 @@ const char *ArgvClass::Find_Again(const char *arg) if (Is_Exact_Size()) { // Note case sensitive, Exact Size. for (; CurrentPos < Argc; CurrentPos++) { - if (!stricmp(arg, Argv[CurrentPos])) { + if (stricmp(arg, Argv[CurrentPos]) == 0) { return Argv[CurrentPos]; } } @@ -128,7 +128,7 @@ const char *ArgvClass::Find_Again(const char *arg) // Note case sensitive, Match first strlen(arg). int len = strlen(arg); for (; CurrentPos < Argc; CurrentPos++) { - if (!strnicmp(arg, Argv[CurrentPos], len)) { + if (strnicmp(arg, Argv[CurrentPos], len) == 0) { return Argv[CurrentPos]; } } @@ -201,7 +201,7 @@ int ArgvClass::Init(char *lpCmdLine, const char *fileprefix) bool was_file = false; // See if we are to load a file with parameters in it. - if (fp_cmp_len && !strncmp(fileprefix, ptr, fp_cmp_len)) { + if (fp_cmp_len && strncmp(fileprefix, ptr, fp_cmp_len) == 0) { ptr += fp_cmp_len; if (*ptr) { was_file = Load_File(ptr); diff --git a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp index e08182ff2a..622753fa1a 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp @@ -1113,7 +1113,7 @@ void CPUDetectClass::Init_Compact_Log() Get_OS_Info(os_info,OSVersionPlatformId,OSVersionNumberMajor,OSVersionNumberMinor,OSVersionBuildNumber); COMPACTLOG(("%s\t",os_info.Code)); - if (!stricmp(os_info.SubCode,"UNKNOWN")) { + if (stricmp(os_info.SubCode,"UNKNOWN") == 0) { COMPACTLOG(("%d\t",OSVersionBuildNumber&0xffff)); } else { diff --git a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp index fa264d0782..9a1f3c09fe 100644 --- a/Core/Libraries/Source/WWVegas/WWLib/ini.cpp +++ b/Core/Libraries/Source/WWVegas/WWLib/ini.cpp @@ -1637,7 +1637,7 @@ bool INIClass::Put_String(char const * section, char const * entry, char const * */ INIEntry * entryptr = secptr->Find_Entry(entry); if (entryptr != NULL) { - if (strcmp(entryptr->Entry, entry)) { + if (strcmp(entryptr->Entry, entry) != 0) { DuplicateCRCError("INIClass::Put_String", section, entry); } else { #if 0 diff --git a/Core/Libraries/Source/debug/debug_cmd.cpp b/Core/Libraries/Source/debug/debug_cmd.cpp index 09bc9b67d9..019e2e3f7d 100644 --- a/Core/Libraries/Source/debug/debug_cmd.cpp +++ b/Core/Libraries/Source/debug/debug_cmd.cpp @@ -39,7 +39,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, // just for convenience... bool normalMode=cmdmode==CommandMode::Normal; - if (!strcmp(cmd,"help")) + if (strcmp(cmd,"help") == 0) { if (!normalMode) return true; @@ -50,7 +50,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, " list, io, alwaysflush, timestamp, exit, clear, add, view\n"; return true; } - else if (!strcmp(argv[0],"list")) + else if (strcmp(argv[0],"list") == 0) { dbg << "list (g|l|d|a|c) [ ]\n" "\n" @@ -72,7 +72,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, "e.g. debug.cpp(13).\n"; return true; } - else if (!strcmp(argv[0],"io")) + else if (strcmp(argv[0],"io") == 0) { dbg << "io { }]\n" "\n" @@ -91,33 +91,33 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, "a list of possible I/O classes.\n"; return true; } - else if (!strcmp(argv[0],"alwaysflush")) + else if (strcmp(argv[0],"alwaysflush") == 0) { dbg << "alwaysflush [ (+|-) ]\n\n" "Enables/disables flushing after each new entry in\n" "the log file (default: off).\n"; return true; } - else if (!strcmp(argv[0],"timestamp")) + else if (strcmp(argv[0],"timestamp") == 0) { dbg << "timestamp [ (+|-) ]\n\n" "Enables/disables timestamping each log entry\n" "(default: off).\n"; return true; } - else if (!strcmp(argv[0],"exit")) + else if (strcmp(argv[0],"exit") == 0) { dbg << "exit\n\nExits program immediately.\n"; return true; } - else if (!strcmp(argv[0],"clear")) + else if (strcmp(argv[0],"clear") == 0) { dbg << "clear (l|a|c)\n\n" "Clears the given inclusion/exclusion list\n" "(l=logs, a=asserts/crashes, c=checks).\n"; return true; } - else if (!strcmp(argv[0],"add")) + else if (strcmp(argv[0],"add") == 0) { dbg << "add (l|a|c) (+|-) \n" "\n" @@ -132,7 +132,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, "the last match."; return true; } - else if (!strcmp(argv[0],"view")) + else if (strcmp(argv[0],"view") == 0) { dbg << "view [ (l|a|c) ]\n\n" "Shows the active pattern for the given list\n" @@ -141,7 +141,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, } return false; } - if (!strcmp(cmd,"list")) + if (strcmp(cmd,"list") == 0) { const char *pattern=argn>=2?argv[1]:"*"; @@ -204,10 +204,10 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, return true; } - if (!strcmp(cmd,"io")) + if (strcmp(cmd,"io") == 0) { // cmd: io - if (!argn||!strcmp(argv[0],"?")) + if (!argn||strcmp(argv[0],"?") == 0) { // show active/all I/O classes if (normalMode) @@ -232,7 +232,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, // find I/O class Debug::IOFactoryListEntry *cur=dbg.firstIOFactory; for (;cur;cur=cur->next) - if (!strcmp(argv[0],cur->ioID)) + if (strcmp(argv[0],cur->ioID) == 0) break; if (!cur) { @@ -243,7 +243,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, if (argn>1) { // 'add' command? - if (!strcmp(argv[1],"add")) + if (strcmp(argv[1],"add") == 0) { if (cur->io) { @@ -258,7 +258,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, } } // 'remove' command? - if (!strcmp(argv[1],"remove")) + if (strcmp(argv[1],"remove") == 0) { if (cur->io) { @@ -280,7 +280,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, } return true; } - if (!strcmp(cmd,"alwaysflush")) + if (strcmp(cmd,"alwaysflush") == 0) { if (argn) { @@ -296,7 +296,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, return true; } - if (!strcmp(cmd,"timestamp")) + if (strcmp(cmd,"timestamp") == 0) { if (argn) { @@ -312,14 +312,14 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, return true; } - if (!strcmp(cmd,"exit")) + if (strcmp(cmd,"exit") == 0) { exit(1); return true; } - if (!strcmp(cmd,"clear")|| - !strcmp(cmd,"add")|| - !strcmp(cmd,"view")) + if (strcmp(cmd,"clear") == 0|| + strcmp(cmd,"add") == 0|| + strcmp(cmd,"view") == 0) { unsigned mask=0; if (argn) @@ -338,7 +338,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, mask=0xffffffff; bool modified=false; - if (!strcmp(cmd,"clear")) + if (strcmp(cmd,"clear") == 0) { // remove some (or all) pattern const char *pattern=argn<2?"*":argv[1]; @@ -368,7 +368,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, else dbg.lastPatternEntry=NULL; } - if (!strcmp(cmd,"add")) + if (strcmp(cmd,"add") == 0) { // add a pattern if (argn<3) @@ -379,7 +379,7 @@ bool DebugCmdInterfaceDebug::Execute(class Debug& dbg, const char *cmd, modified=true; } } - if (!strcmp(cmd,"view")) + if (strcmp(cmd,"view") == 0) { // show list of defined patterns for (Debug::PatternListEntry *cur=dbg.firstPatternEntry;cur;cur=cur->next) diff --git a/Core/Libraries/Source/debug/debug_debug.cpp b/Core/Libraries/Source/debug/debug_debug.cpp index 5bc38c7c5b..7704975032 100644 --- a/Core/Libraries/Source/debug/debug_debug.cpp +++ b/Core/Libraries/Source/debug/debug_debug.cpp @@ -526,7 +526,7 @@ Debug& Debug::LogBegin(const char *fileOrGroup) // we're doing all this extra work so that DLOGs can be spread across // multiple calls if (Instance.curType==DebugIOInterface::StringType::Log&& - strcmp(Instance.curSource,Instance.curFrameEntry->fileOrGroup)) + strcmp(Instance.curSource,Instance.curFrameEntry->fileOrGroup) != 0) Instance.FlushOutput(); if (Instance.curType!=DebugIOInterface::StringType::Log) @@ -1227,7 +1227,7 @@ const char *Debug::AddLogGroup(const char *fileOrGroup, const char *descr) KnownLogGroupList *cur=firstLogGroup; for (;cur;cur=cur->next) { - if (!strcmp(cur->nameGroup,fileOrGroup)) + if (strcmp(cur->nameGroup,fileOrGroup) == 0) { // yes, return translated name return cur->nameGroup; @@ -1547,7 +1547,7 @@ void Debug::ExecCommand(const char *cmdstart, const char *cmdend) // command group known? for (CmdInterfaceListEntry *cur=firstCmdGroup;cur;cur=cur->next) - if (!strcmp(curCommandGroup,cur->group)) + if (strcmp(curCommandGroup,cur->group) == 0) break; if (!cur) { @@ -1563,18 +1563,18 @@ void Debug::ExecCommand(const char *cmdstart, const char *cmdend) // search for a matching command handler for (CmdInterfaceListEntry *cur=firstCmdGroup;cur;cur=cur->next) { - if (strcmp(curCommandGroup,cur->group)) + if (strcmp(curCommandGroup,cur->group) != 0) continue; bool doneCommand=cur->cmdif->Execute(*this,p,mode,numParts-1,parts+1); - if (doneCommand&&(strcmp(p,"help")||numParts>1)) + if (doneCommand&&(strcmp(p,"help") != 0||numParts>1)) break; } // display error message if command not found, break away if (!cur&&mode==DebugCmdInterface::CommandMode::Normal) { - if (strcmp(p,"help")) + if (strcmp(p,"help") != 0) operator<<("Unknown command"); else if (numParts>1) operator<<("Unknown command, help not available"); diff --git a/Core/Libraries/Source/debug/debug_io_con.cpp b/Core/Libraries/Source/debug/debug_io_con.cpp index 3319496c0e..0b9c2d605e 100644 --- a/Core/Libraries/Source/debug/debug_io_con.cpp +++ b/Core/Libraries/Source/debug/debug_io_con.cpp @@ -194,13 +194,13 @@ void DebugIOCon::Write(StringType type, const char *src, const char *str) void DebugIOCon::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, unsigned argn, const char * const * argv) { - if (!cmd||!strcmp(cmd,"help")) + if (!cmd||strcmp(cmd,"help") == 0) { dbg << "con I/O help:\n" " add [ [ ] ]\n" " create con I/O (optionally specifying the window size)\n"; } - else if (!strcmp(cmd,"add")) + else if (strcmp(cmd,"add") == 0) { if (argn>0&&m_allocatedConsole) { diff --git a/Core/Libraries/Source/debug/debug_io_flat.cpp b/Core/Libraries/Source/debug/debug_io_flat.cpp index eec7cd31f6..7e7d00ca63 100644 --- a/Core/Libraries/Source/debug/debug_io_flat.cpp +++ b/Core/Libraries/Source/debug/debug_io_flat.cpp @@ -332,14 +332,14 @@ void DebugIOFlat::EmergencyFlush(void) void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, unsigned argn, const char * const * argv) { - if (!cmd||!strcmp(cmd,"help")) + if (!cmd||strcmp(cmd,"help") == 0) { if (!argn) dbg << "flat I/O help:\n" "The following I/O commands are defined:\n" " add, copy, splitadd, splitview, splitremove\n" "Type in debug.io flat help for a detailed command help.\n"; - else if (!strcmp(argv[0],"add")) + else if (strcmp(argv[0],"add") == 0) dbg << "add [ [ ] ]\n\n" "Create flat file I/O (optionally specifying file name and file size).\n" @@ -363,13 +363,13 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, "size memory based ring buffer. This data is flushed out once the \n" "program exits. If no size is given then the size of the log file is not \n" "limited and any log data is written out immediately.\n"; - else if (!strcmp(argv[0],"copy")) + else if (strcmp(argv[0],"copy") == 0) dbg << "copy \n\n" "Copies generated log file(s) into the given directory if the program\n" "exists or crashes. If there is already a log file with the same\n" "name a unique number is appended to the current log files' name.\n"; - else if (!strcmp(argv[0],"splitadd")) + else if (strcmp(argv[0],"splitadd") == 0) dbg << "splitadd [ ]\n\n" "Splits off part of the log data. Multiple splits can be defined. They \n" @@ -402,16 +402,16 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, "\n" "If no size is given then the size of the log file is not limited and \n" "any log data is written out immediately.\n"; - else if (!strcmp(argv[0],"splitview")) + else if (strcmp(argv[0],"splitview") == 0) dbg << "splitview\n\n" "Shows all existing splits in the order they are evaluated."; - else if (!strcmp(argv[0],"splitremove")) + else if (strcmp(argv[0],"splitremove") == 0) dbg << "splitremove \n\n" "Removes all active splits matching the given name pattern."; else dbg << "Unknown flat I/O command"; } - else if (!strcmp(cmd,"add")) + else if (strcmp(cmd,"add") == 0) { // add [ [ ] ] __ASSERT(m_firstStream==NULL); @@ -426,7 +426,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, m_firstStream->stream=OutputStream::Create(fn,argn>1?atoi(argv[1])*1024:0); m_lastStreamPtr=&m_firstStream->next; } - else if (!strcmp(cmd,"copy")) + else if (strcmp(cmd,"copy") == 0) { // copy if (argn) @@ -434,7 +434,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, strlcpy(m_copyDir,argv[0],sizeof(m_copyDir)); } } - else if (!strcmp(cmd,"splitadd")) + else if (strcmp(cmd,"splitadd") == 0) { // splitadd [ ] if (argn>=3) @@ -470,7 +470,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, ExpandMagic(m_baseFilename,cur->name,fn); StreamListEntry *stream=m_firstStream; for (;stream;stream=stream->next) - if (!strcmp(stream->stream->GetFilename(),fn)) + if (strcmp(stream->stream->GetFilename(),fn) == 0) break; if (!stream) { @@ -484,7 +484,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, cur->stream=stream->stream; } } - else if (!strcmp(cmd,"splitview")) + else if (strcmp(cmd,"splitview") == 0) { // splitview for (SplitListEntry *cur=m_firstSplit;cur;cur=cur->next) @@ -507,7 +507,7 @@ void DebugIOFlat::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, dbg << " " << cur->items << " " << cur->name << "\n"; } } - else if (!strcmp(cmd,"splitremove")) + else if (strcmp(cmd,"splitremove") == 0) { // splitremove const char *pattern=argn<1?"*":argv[0]; diff --git a/Core/Libraries/Source/debug/debug_io_net.cpp b/Core/Libraries/Source/debug/debug_io_net.cpp index ebb8bdba6a..52e3166102 100644 --- a/Core/Libraries/Source/debug/debug_io_net.cpp +++ b/Core/Libraries/Source/debug/debug_io_net.cpp @@ -86,13 +86,13 @@ void DebugIONet::EmergencyFlush(void) void DebugIONet::Execute(class Debug& dbg, const char *cmd, bool structuredCmd, unsigned argn, const char * const * argv) { - if (!cmd||!strcmp(cmd,"help")) + if (!cmd||strcmp(cmd,"help") == 0) { dbg << "net I/O help:\n" " add [ ]\n" " create net I/O (optionally specifying the machine to connect to)\n"; } - else if (!strcmp(cmd,"add")) + else if (strcmp(cmd,"add") == 0) { const char *machine=argn?argv[0]:"."; diff --git a/Core/Libraries/Source/profile/profile.cpp b/Core/Libraries/Source/profile/profile.cpp index b7fb9ad86c..66981103b7 100644 --- a/Core/Libraries/Source/profile/profile.cpp +++ b/Core/Libraries/Source/profile/profile.cpp @@ -166,7 +166,7 @@ void Profile::StartRange(const char *range) // known name? unsigned k=0; for (;k\n" "\n" @@ -112,7 +112,7 @@ bool ProfileCmdInterface::Execute(class Debug& dbg, const char *cmd, CommandMode "- for inactive). The final state is always the last match."; return true; } - else if (!strcmp(argv[0],"view")) + else if (strcmp(argv[0],"view") == 0) { dbg << "view\n\n" "Shows the active pattern list.\n"; @@ -122,7 +122,7 @@ bool ProfileCmdInterface::Execute(class Debug& dbg, const char *cmd, CommandMode } // command: result - if (!strcmp(cmd,"result")) + if (strcmp(cmd,"result") == 0) { if (!argn) { @@ -139,7 +139,7 @@ bool ProfileCmdInterface::Execute(class Debug& dbg, const char *cmd, CommandMode { unsigned k=0; for (;knext) diff --git a/Core/Libraries/Source/profile/profile_highlevel.cpp b/Core/Libraries/Source/profile/profile_highlevel.cpp index bc418d6fdd..fa55293e93 100644 --- a/Core/Libraries/Source/profile/profile_highlevel.cpp +++ b/Core/Libraries/Source/profile/profile_highlevel.cpp @@ -324,7 +324,7 @@ bool ProfileHighLevel::FindProfile(const char *name, Id &id) ProfileFastCS::Lock lock(cs); for (ProfileId *cur=ProfileId::GetFirst();cur;cur=cur->GetNext()) - if (!strcmp(name,cur->GetName())) + if (strcmp(name,cur->GetName()) == 0) { id.m_idPtr=cur; return true; diff --git a/Core/Libraries/Source/profile/profile_result.cpp b/Core/Libraries/Source/profile/profile_result.cpp index cec326936a..13d55a679b 100644 --- a/Core/Libraries/Source/profile/profile_result.cpp +++ b/Core/Libraries/Source/profile/profile_result.cpp @@ -196,7 +196,7 @@ void ProfileResultFileDOT::WriteResults(void) if (m_frameName) { for (unsigned k=0;knext) - if (!strcmp(source,cur->source)) + if (strcmp(source,cur->source) == 0) { if (cur->numIdid[cur->numId++]=id; @@ -264,7 +264,7 @@ void ProfileResultFileDOT::WriteResults(void) { const char *s=caller.GetSource(); for (FoldHelper *cur2=fold;cur2;cur2=cur2->next) - if (!strcmp(cur2->source,s)) + if (strcmp(cur2->source,s) == 0) break; if (!cur2||cur2->mark) continue; diff --git a/Core/Tools/ImagePacker/Source/ImagePacker.cpp b/Core/Tools/ImagePacker/Source/ImagePacker.cpp index 4ed5229945..a113f4d7ea 100644 --- a/Core/Tools/ImagePacker/Source/ImagePacker.cpp +++ b/Core/Tools/ImagePacker/Source/ImagePacker.cpp @@ -385,8 +385,8 @@ void ImagePacker::addImagesInDirectory( char *dir ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) { len = strlen( item.cFileName ); @@ -410,8 +410,8 @@ void ImagePacker::addImagesInDirectory( char *dir ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) { len = strlen( item.cFileName ); @@ -473,8 +473,8 @@ Bool ImagePacker::checkOutputDirectory( void ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) fileCount++; // find the rest of the files @@ -483,8 +483,8 @@ Bool ImagePacker::checkOutputDirectory( void ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) fileCount++; } @@ -526,8 +526,8 @@ Bool ImagePacker::checkOutputDirectory( void ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) DeleteFile( item.cFileName ); // find the rest of the files @@ -536,8 +536,8 @@ Bool ImagePacker::checkOutputDirectory( void ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) DeleteFile( item.cFileName ); } @@ -687,8 +687,8 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) { len = strlen( item.cFileName ); @@ -707,8 +707,8 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) // if this is a file count it if( !(item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) { len = strlen( item.cFileName ); @@ -743,8 +743,8 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) // if this is a file count it if( (item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) { sprintf( subDir, "%s%s\\", path, item.cFileName ); @@ -758,8 +758,8 @@ void ImagePacker::addDirectory( char *path, Bool subDirs ) // if this is a file count it if( (item.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - strcmp( item.cFileName, "." ) && - strcmp( item.cFileName, ".." ) ) + strcmp( item.cFileName, "." ) != 0 && + strcmp( item.cFileName, ".." ) != 0 ) { sprintf( subDir, "%s%s\\", path, item.cFileName ); diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 4e0c7aa5ce..32efa15188 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -892,7 +892,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) // Read the GENREP header. char genrep[sizeof(s_genrep) - 1] = {0}; m_file->read( &genrep, sizeof(s_genrep) - 1 ); - if ( strncmp(genrep, s_genrep, sizeof(s_genrep) - 1 ) ) { + if ( strncmp(genrep, s_genrep, sizeof(s_genrep) - 1 ) != 0 ) { DEBUG_LOG(("RecorderClass::readReplayHeader - replay file did not have GENREP at the start.")); m_file->close(); m_file = NULL; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 6da46946c0..afba8a27e0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -508,7 +508,7 @@ void HandleBuddyResponses( void ) break; case BuddyResponse::BUDDYRESPONSE_MESSAGE: { - if ( !wcscmp(resp.arg.message.text, L"I have authorized your request to add me to your list") ) + if ( wcscmp(resp.arg.message.text, L"I have authorized your request to add me to your list") == 0 ) break; if (TheGameSpyInfo->isSavedIgnored(resp.profile)) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index db5ffbd2a2..8c5ec5718c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1779,7 +1779,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) resp.command.c_str(), resp.commandOptions.c_str())); } #endif - if (!strcmp(resp.command.c_str(), "SL")) + if (strcmp(resp.command.c_str(), "SL") == 0) { // slotlist GameSpyStagingRoom *game = TheGameSpyInfo->getCurrentStagingRoom(); @@ -1949,7 +1949,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } } } - else if (!strcmp(resp.command.c_str(), "HWS")) + else if (strcmp(resp.command.c_str(), "HWS") == 0) { // host wants to start GameInfo *game = TheGameSpyInfo->getCurrentStagingRoom(); @@ -1963,13 +1963,13 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } } } - else if (!stricmp(resp.command.c_str(), "NAT")) + else if (stricmp(resp.command.c_str(), "NAT") == 0) { if (TheNAT != NULL) { TheNAT->processGlobalMessage(-1, resp.commandOptions.c_str()); } } - else if (!stricmp(resp.command.c_str(), "Pings")) + else if (stricmp(resp.command.c_str(), "Pings") == 0) { if (!TheGameSpyInfo->amIHost()) { @@ -1996,7 +1996,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) case PeerResponse::PEERRESPONSE_PLAYERUTM: { sawImportantMessage = TRUE; - if (!strcmp(resp.command.c_str(), "STATS")) + if (strcmp(resp.command.c_str(), "STATS") == 0) { PSPlayerStats stats = TheGameSpyPSMessageQueue->parsePlayerKVPairs(resp.commandOptions.c_str()); if (stats.id && (TheGameSpyPSMessageQueue->findPlayerStatsByID(stats.id).id == 0)) @@ -2007,7 +2007,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) if (game) { Int slotNum = game->getSlotNum(resp.nick.c_str()); - if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (!stricmp(resp.command.c_str(), "NAT"))) { + if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT if (TheNAT != NULL) { TheNAT->processGlobalMessage(slotNum, resp.commandOptions.c_str()); @@ -2015,7 +2015,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } if (slotNum == 0 && !TheGameSpyInfo->amIHost()) { - if (!strcmp(resp.command.c_str(), "KICK")) + if (strcmp(resp.command.c_str(), "KICK") == 0) { // oops - we've been kicked. bail. buttonPushed = true; @@ -2041,13 +2041,13 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } else if (slotNum > 0 && TheGameSpyInfo->amIHost()) { - if (!strcmp(resp.command.c_str(), "accept")) + if (strcmp(resp.command.c_str(), "accept") == 0) { game->getSlot(slotNum)->setAccept(); TheGameSpyInfo->setGameOptions(); WOLDisplaySlotList(); } - else if (!strcmp(resp.command.c_str(), "MAP")) + else if (strcmp(resp.command.c_str(), "MAP") == 0) { Bool hasMap = atoi(resp.commandOptions.c_str()); game->getSlot(slotNum)->setMapAvailability(hasMap); @@ -2076,7 +2076,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } WOLDisplaySlotList(); } - else if (!strcmp(resp.command.c_str(), "REQ")) + else if (strcmp(resp.command.c_str(), "REQ") == 0) { AsciiString options = resp.commandOptions.c_str(); options.trim(); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index ee6569ab86..cb9b2057b1 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -1067,7 +1067,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) AsciiString hostName; hostName.translate(room->getConstSlot(0)->getName()); const char *firstPlayer = resp.stagingRoomPlayerNames[i].c_str(); - if (!strcmp(hostName.str(), firstPlayer)) + if (strcmp(hostName.str(), firstPlayer) == 0) { DEBUG_LOG(("Saw host %s == %s in slot %d", hostName.str(), firstPlayer, i)); isHostPresent = TRUE; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 10018d7577..5d8eefe7cb 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -1133,7 +1133,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) { case PeerResponse::PEERRESPONSE_PLAYERUTM: { - if (!stricmp(resp.command.c_str(), "STATS")) + if (stricmp(resp.command.c_str(), "STATS") == 0) { DEBUG_LOG(("Saw STATS from %s, data was '%s'", resp.nick.c_str(), resp.commandOptions.c_str())); AsciiString data = resp.commandOptions.c_str(); @@ -1162,7 +1162,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) } } Int slotNum = TheGameSpyGame->getSlotNum(resp.nick.c_str()); - if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (!stricmp(resp.command.c_str(), "NAT"))) { + if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT sawImportantMessage = TRUE; if (TheNAT != NULL) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index d7c25e469d..ae800d56ce 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -207,7 +207,7 @@ static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, for( i = 0, c = flagList; *c; i++, c++ ) { - if( !stricmp( *c, flagString ) ) + if( stricmp( *c, flagString ) == 0 ) { *bits |= (1 << i); return TRUE; @@ -233,7 +233,7 @@ static void parseBitString( const char *inBuffer, UnsignedInt *bits, ConstCharPt // do not modify the inBuffer argument strlcpy(buffer, inBuffer, ARRAY_SIZE(buffer)); - if( strncmp( buffer, "NULL", 4 ) ) + if( strncmp( buffer, "NULL", 4 ) != 0 ) { for( tok = strtok( buffer, "+" ); tok; tok = strtok( NULL, "+" ) ) { @@ -436,7 +436,7 @@ static Bool parseDefaultColor( Color *color, File *inFile, char *buffer ) // Read the rest of the color definition readUntilSemicolon( inFile, buffer, WIN_BUFFER_LENGTH ); - if (!strcmp( buffer, "TRANSPARENT" )) + if (strcmp( buffer, "TRANSPARENT" ) == 0) { *color = WIN_COLOR_UNDEFINED; @@ -838,7 +838,7 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, // "SCROLLIFATEND" (optional) c = strtok( NULL, seps ); // label - if ( !stricmp(c, "ScrollIfAtEnd") ) + if ( stricmp(c, "ScrollIfAtEnd") == 0 ) { c = strtok( NULL, seps ); // value scanBool( c, listData->scrollIfAtEnd ); @@ -1314,8 +1314,8 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, first = FALSE; c = strtok( NULL, seps ); // value - if( strcmp( c, "NoImage" ) ) - drawData->image = TheMappedImageCollection->findImageByName( c ); + if( strcmp( c, "NoImage" ) != 0 ) + drawData->image = TheMappedImageCollection->findImageByName( AsciiString( c ) ); else drawData->image = NULL; // COLOR: R G B A @@ -1364,46 +1364,46 @@ void *getDataTemplate( char *type ) static ComboBoxData cData; void *data; - if( !strcmp( type, "VERTSLIDER" ) || !strcmp( type, "HORZSLIDER" ) ) + if( strcmp( type, "VERTSLIDER" ) == 0 || strcmp( type, "HORZSLIDER" ) == 0 ) { memset( &sData, 0, sizeof( SliderData ) ); data = &sData; } - else if( !strcmp( type, "SCROLLLISTBOX" ) ) + else if( strcmp( type, "SCROLLLISTBOX" ) == 0 ) { memset( &lData, 0, sizeof( ListboxData ) ); data = &lData; } - else if( !strcmp( type, "TABCONTROL" ) ) + else if( strcmp( type, "TABCONTROL" ) == 0 ) { memset( &tcData, 0, sizeof( TabControlData ) ); data = &tcData; } - else if( !strcmp( type, "ENTRYFIELD" ) ) + else if( strcmp( type, "ENTRYFIELD" ) == 0 ) { memset( &eData, 0, sizeof( EntryData ) ); data = &eData; } - else if( !strcmp( type, "STATICTEXT" ) ) + else if( strcmp( type, "STATICTEXT" ) == 0 ) { memset( &tData, 0, sizeof( TextData ) ); data = &tData; } - else if( !strcmp( type, "RADIOBUTTON" ) ) + else if( strcmp( type, "RADIOBUTTON" ) == 0 ) { memset( &rData, 0, sizeof( RadioButtonData ) ); data = &rData; } - else if( !strcmp( type, "COMBOBOX" ) ) + else if( strcmp( type, "COMBOBOX" ) == 0 ) { memset( &cData, 0, sizeof( ComboBoxData ) ); @@ -1446,7 +1446,7 @@ static Bool parseData( void **data, char *type, char *buffer ) static RadioButtonData rData; static ComboBoxData cData; - if( !strcmp( type, "VERTSLIDER" ) || !strcmp( type, "HORZSLIDER" ) ) + if( strcmp( type, "VERTSLIDER" ) == 0 || strcmp( type, "HORZSLIDER" ) == 0 ) { memset( &sData, 0, sizeof( SliderData ) ); @@ -1460,7 +1460,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &sData; } - else if( !strcmp( type, "SCROLLLISTBOX" ) ) + else if( strcmp( type, "SCROLLLISTBOX" ) == 0 ) { memset( &lData, 0, sizeof( ListboxData ) ); @@ -1489,7 +1489,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &lData; } - else if( !strcmp( type, "ENTRYFIELD" ) ) + else if( strcmp( type, "ENTRYFIELD" ) == 0 ) { memset( &eData, 0, sizeof( EntryData ) ); @@ -1530,7 +1530,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &eData; } - else if( !strcmp( type, "STATICTEXT" ) ) + else if( strcmp( type, "STATICTEXT" ) == 0 ) { c = strtok( buffer, " \t\n\r" ); @@ -1551,7 +1551,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &tData; } - else if( !strcmp( type, "RADIOBUTTON" ) ) + else if( strcmp( type, "RADIOBUTTON" ) == 0 ) { c = strtok( buffer, " \t\n\r" ); @@ -1617,7 +1617,7 @@ static GameWindow *createGadget( char *type, instData->m_owner = parent; - if( !strcmp( type, "PUSHBUTTON" ) ) + if( strcmp( type, "PUSHBUTTON" ) == 0 ) { instData->m_style |= GWS_PUSH_BUTTON; @@ -1627,7 +1627,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "RADIOBUTTON" ) ) + else if( strcmp( type, "RADIOBUTTON" ) == 0 ) { RadioButtonData *rData = (RadioButtonData *)data; char filename[ MAX_WINDOW_NAME_LEN ]; @@ -1653,7 +1653,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "CHECKBOX" ) ) + else if( strcmp( type, "CHECKBOX" ) == 0 ) { instData->m_style |= GWS_CHECK_BOX; @@ -1663,7 +1663,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "TABCONTROL" ) ) + else if( strcmp( type, "TABCONTROL" ) == 0 ) { TabControlData *tcData = (TabControlData *)data; instData->m_style |= GWS_TAB_CONTROL; @@ -1672,7 +1672,7 @@ static GameWindow *createGadget( char *type, instData, tcData, instData->m_font, FALSE ); } - else if( !strcmp( type, "VERTSLIDER" ) ) + else if( strcmp( type, "VERTSLIDER" ) == 0 ) { SliderData *sData = (SliderData *)data; @@ -1704,7 +1704,7 @@ static GameWindow *createGadget( char *type, } } - else if( !strcmp( type, "HORZSLIDER" ) ) + else if( strcmp( type, "HORZSLIDER" ) == 0 ) { SliderData *sData = (SliderData *)data; @@ -1736,7 +1736,7 @@ static GameWindow *createGadget( char *type, } } - else if( !strcmp( type, "SCROLLLISTBOX" ) ) + else if( strcmp( type, "SCROLLLISTBOX" ) == 0 ) { ListboxData *lData = (ListboxData *)data; @@ -1818,7 +1818,7 @@ static GameWindow *createGadget( char *type, } } - else if( !strcmp( type, "COMBOBOX" ) ) + else if( strcmp( type, "COMBOBOX" ) == 0 ) { ComboBoxData *cData = (ComboBoxData *)data; cData->entryData = NEW EntryData; @@ -1966,7 +1966,7 @@ static GameWindow *createGadget( char *type, } } } - else if( !strcmp( type, "ENTRYFIELD" ) ) + else if( strcmp( type, "ENTRYFIELD" ) == 0 ) { EntryData *eData = (EntryData *)data; @@ -1977,7 +1977,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "STATICTEXT" ) ) + else if( strcmp( type, "STATICTEXT" ) == 0 ) { TextData *tData = (TextData *)data; @@ -1989,7 +1989,7 @@ static GameWindow *createGadget( char *type, } - else if( !strcmp( type, "PROGRESSBAR" ) ) + else if( strcmp( type, "PROGRESSBAR" ) == 0 ) { instData->m_style |= GWS_PROGRESS_BAR; @@ -2025,7 +2025,7 @@ static GameWindow *createWindow( char *type, parent = peekWindow(); // If this is a regular window just create it - if( !strcmp( type, "USER" ) ) + if( strcmp( type, "USER" ) == 0 ) { window = TheWindowManager->winCreate( parent, @@ -2042,7 +2042,7 @@ static GameWindow *createWindow( char *type, } } - else if( !strcmp( type, "TABPANE" ) ) + else if( strcmp( type, "TABPANE" ) == 0 ) { window = TheWindowManager->winCreate( parent, diff --git a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp index 8bbc840f2b..80d83c9ba2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GameText.cpp @@ -824,7 +824,7 @@ Bool GameTextManager::getStringCount( const char *filename, Int& textCount ) m_buffer[ len+1] = 0; readToEndOfQuote( file, &m_buffer[1], m_buffer2, m_buffer3, MAX_UITEXT_LENGTH ); } - else if( !stricmp( m_buffer, "END") ) + else if( stricmp( m_buffer, "END") == 0 ) { textCount++; } @@ -1035,7 +1035,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) for ( Int i = 0; i < listCount; i++ ) { - if ( !stricmp ( m_stringInfo[i].label.str(), m_buffer )) + if ( stricmp ( m_stringInfo[i].label.str(), m_buffer ) == 0) { DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer )); } @@ -1086,7 +1086,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) readString = TRUE; } } - else if ( !stricmp ( m_buffer, "END" )) + else if ( stricmp ( m_buffer, "END" ) == 0) { break; } @@ -1166,7 +1166,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) for ( Int i = 0; i < listCount; i++ ) { - if ( !stricmp ( m_mapStringInfo[i].label.str(), m_buffer )) + if ( stricmp ( m_mapStringInfo[i].label.str(), m_buffer ) == 0) { DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer )); } @@ -1221,7 +1221,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) readString = TRUE; } } - else if ( !stricmp ( m_buffer, "END" )) + else if ( stricmp ( m_buffer, "END" ) == 0) { break; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 678d87cfeb..67cedc7f37 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -174,7 +174,7 @@ const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(L self->m_locomotorTemplates[set].clear(); for (const char* locoName = ini->getNextToken(); locoName; locoName = ini->getNextTokenOrNull()) { - if (!*locoName || !stricmp(locoName, "None")) + if (!*locoName || stricmp(locoName, "None") == 0) continue; NameKeyType locoKey = NAMEKEY(locoName); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index a90b4903f7..e5bc9ebbfa 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -894,7 +894,7 @@ Bool RecorderClass::readReplayHeader(ReplayHeader& header) // Read the GENREP header. char genrep[sizeof(s_genrep) - 1] = {0}; m_file->read( &genrep, sizeof(s_genrep) - 1 ); - if ( strncmp(genrep, s_genrep, sizeof(s_genrep) - 1 ) ) { + if ( strncmp(genrep, s_genrep, sizeof(s_genrep) - 1 ) != 0 ) { DEBUG_LOG(("RecorderClass::readReplayHeader - replay file did not have GENREP at the start.")); m_file->close(); m_file = NULL; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 166659a950..e109cfb88e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -508,7 +508,7 @@ void HandleBuddyResponses( void ) break; case BuddyResponse::BUDDYRESPONSE_MESSAGE: { - if ( !wcscmp(resp.arg.message.text, L"I have authorized your request to add me to your list") ) + if ( wcscmp(resp.arg.message.text, L"I have authorized your request to add me to your list") == 0 ) break; if (TheGameSpyInfo->isSavedIgnored(resp.profile)) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index bb36b3501f..c5a6755723 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1957,7 +1957,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) resp.command.c_str(), resp.commandOptions.c_str())); } #endif - if (!strcmp(resp.command.c_str(), "SL")) + if (strcmp(resp.command.c_str(), "SL") == 0) { // slotlist GameSpyStagingRoom *game = TheGameSpyInfo->getCurrentStagingRoom(); @@ -2127,7 +2127,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } } } - else if (!strcmp(resp.command.c_str(), "HWS")) + else if (strcmp(resp.command.c_str(), "HWS") == 0) { // host wants to start GameInfo *game = TheGameSpyInfo->getCurrentStagingRoom(); @@ -2141,13 +2141,13 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } } } - else if (!stricmp(resp.command.c_str(), "NAT")) + else if (stricmp(resp.command.c_str(), "NAT") == 0) { if (TheNAT != NULL) { TheNAT->processGlobalMessage(-1, resp.commandOptions.c_str()); } } - else if (!stricmp(resp.command.c_str(), "Pings")) + else if (stricmp(resp.command.c_str(), "Pings") == 0) { if (!TheGameSpyInfo->amIHost()) { @@ -2174,7 +2174,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) case PeerResponse::PEERRESPONSE_PLAYERUTM: { sawImportantMessage = TRUE; - if (!strcmp(resp.command.c_str(), "STATS")) + if (strcmp(resp.command.c_str(), "STATS") == 0) { PSPlayerStats stats = TheGameSpyPSMessageQueue->parsePlayerKVPairs(resp.commandOptions.c_str()); if (stats.id && (TheGameSpyPSMessageQueue->findPlayerStatsByID(stats.id).id == 0)) @@ -2185,7 +2185,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) if (game) { Int slotNum = game->getSlotNum(resp.nick.c_str()); - if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (!stricmp(resp.command.c_str(), "NAT"))) { + if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT if (TheNAT != NULL) { TheNAT->processGlobalMessage(slotNum, resp.commandOptions.c_str()); @@ -2193,7 +2193,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } if (slotNum == 0 && !TheGameSpyInfo->amIHost()) { - if (!strcmp(resp.command.c_str(), "KICK")) + if (strcmp(resp.command.c_str(), "KICK") == 0) { // oops - we've been kicked. bail. buttonPushed = true; @@ -2219,13 +2219,13 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } else if (slotNum > 0 && TheGameSpyInfo->amIHost()) { - if (!strcmp(resp.command.c_str(), "accept")) + if (strcmp(resp.command.c_str(), "accept") == 0) { game->getSlot(slotNum)->setAccept(); TheGameSpyInfo->setGameOptions(); WOLDisplaySlotList(); } - else if (!strcmp(resp.command.c_str(), "MAP")) + else if (strcmp(resp.command.c_str(), "MAP") == 0) { Bool hasMap = atoi(resp.commandOptions.c_str()); game->getSlot(slotNum)->setMapAvailability(hasMap); @@ -2254,7 +2254,7 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) } WOLDisplaySlotList(); } - else if (!strcmp(resp.command.c_str(), "REQ")) + else if (strcmp(resp.command.c_str(), "REQ") == 0) { AsciiString options = resp.commandOptions.c_str(); options.trim(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index 6ad99be4c4..9f98a002a8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -1085,7 +1085,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) AsciiString hostName; hostName.translate(room->getConstSlot(0)->getName()); const char *firstPlayer = resp.stagingRoomPlayerNames[i].c_str(); - if (!strcmp(hostName.str(), firstPlayer)) + if (strcmp(hostName.str(), firstPlayer) == 0) { DEBUG_LOG(("Saw host %s == %s in slot %d", hostName.str(), firstPlayer, i)); isHostPresent = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 5557eade74..6ebb5c6804 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -1112,7 +1112,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) { case PeerResponse::PEERRESPONSE_PLAYERUTM: { - if (!stricmp(resp.command.c_str(), "STATS")) + if (stricmp(resp.command.c_str(), "STATS") == 0) { DEBUG_LOG(("Saw STATS from %s, data was '%s'", resp.nick.c_str(), resp.commandOptions.c_str())); AsciiString data = resp.commandOptions.c_str(); @@ -1141,7 +1141,7 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) } } Int slotNum = TheGameSpyGame->getSlotNum(resp.nick.c_str()); - if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (!stricmp(resp.command.c_str(), "NAT"))) { + if ((slotNum >= 0) && (slotNum < MAX_SLOTS) && (stricmp(resp.command.c_str(), "NAT") == 0)) { // this is a command for NAT negotiations, pass if off to TheNAT sawImportantMessage = TRUE; if (TheNAT != NULL) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp index f5e2871c92..b416fd0f5b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp @@ -208,7 +208,7 @@ static Bool parseBitFlag( const char *flagString, UnsignedInt *bits, for( i = 0, c = flagList; *c; i++, c++ ) { - if( !stricmp( *c, flagString ) ) + if( stricmp( *c, flagString ) == 0 ) { *bits |= (1 << i); return TRUE; @@ -234,7 +234,7 @@ static void parseBitString( const char *inBuffer, UnsignedInt *bits, ConstCharPt // do not modify the inBuffer argument strlcpy(buffer, inBuffer, ARRAY_SIZE(buffer)); - if( strncmp( buffer, "NULL", 4 ) ) + if( strncmp( buffer, "NULL", 4 ) != 0 ) { for( tok = strtok( buffer, "+" ); tok; tok = strtok( NULL, "+" ) ) { @@ -437,7 +437,7 @@ static Bool parseDefaultColor( Color *color, File *inFile, char *buffer ) // Read the rest of the color definition readUntilSemicolon( inFile, buffer, WIN_BUFFER_LENGTH ); - if (!strcmp( buffer, "TRANSPARENT" )) + if (strcmp( buffer, "TRANSPARENT" ) == 0) { *color = WIN_COLOR_UNDEFINED; @@ -839,7 +839,7 @@ static Bool parseListboxData( const char *token, WinInstanceData *instData, // "SCROLLIFATEND" (optional) c = strtok( NULL, seps ); // label - if ( !stricmp(c, "ScrollIfAtEnd") ) + if ( stricmp(c, "ScrollIfAtEnd") == 0 ) { c = strtok( NULL, seps ); // value scanBool( c, listData->scrollIfAtEnd ); @@ -1322,8 +1322,8 @@ static Bool parseDrawData( const char *token, WinInstanceData *instData, first = FALSE; c = strtok( NULL, seps ); // value - if( strcmp( c, "NoImage" ) ) - drawData->image = TheMappedImageCollection->findImageByName( c ); + if( strcmp( c, "NoImage" ) != 0 ) + drawData->image = TheMappedImageCollection->findImageByName( AsciiString( c ) ); else drawData->image = NULL; // COLOR: R G B A @@ -1372,46 +1372,46 @@ void *getDataTemplate( char *type ) static ComboBoxData cData; void *data; - if( !strcmp( type, "VERTSLIDER" ) || !strcmp( type, "HORZSLIDER" ) ) + if( strcmp( type, "VERTSLIDER" ) == 0 || strcmp( type, "HORZSLIDER" ) == 0 ) { memset( &sData, 0, sizeof( SliderData ) ); data = &sData; } - else if( !strcmp( type, "SCROLLLISTBOX" ) ) + else if( strcmp( type, "SCROLLLISTBOX" ) == 0 ) { memset( &lData, 0, sizeof( ListboxData ) ); data = &lData; } - else if( !strcmp( type, "TABCONTROL" ) ) + else if( strcmp( type, "TABCONTROL" ) == 0 ) { memset( &tcData, 0, sizeof( TabControlData ) ); data = &tcData; } - else if( !strcmp( type, "ENTRYFIELD" ) ) + else if( strcmp( type, "ENTRYFIELD" ) == 0 ) { memset( &eData, 0, sizeof( EntryData ) ); data = &eData; } - else if( !strcmp( type, "STATICTEXT" ) ) + else if( strcmp( type, "STATICTEXT" ) == 0 ) { memset( &tData, 0, sizeof( TextData ) ); data = &tData; } - else if( !strcmp( type, "RADIOBUTTON" ) ) + else if( strcmp( type, "RADIOBUTTON" ) == 0 ) { memset( &rData, 0, sizeof( RadioButtonData ) ); data = &rData; } - else if( !strcmp( type, "COMBOBOX" ) ) + else if( strcmp( type, "COMBOBOX" ) == 0 ) { memset( &cData, 0, sizeof( ComboBoxData ) ); @@ -1454,7 +1454,7 @@ static Bool parseData( void **data, char *type, char *buffer ) static RadioButtonData rData; static ComboBoxData cData; - if( !strcmp( type, "VERTSLIDER" ) || !strcmp( type, "HORZSLIDER" ) ) + if( strcmp( type, "VERTSLIDER" ) == 0 || strcmp( type, "HORZSLIDER" ) == 0 ) { memset( &sData, 0, sizeof( SliderData ) ); @@ -1468,7 +1468,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &sData; } - else if( !strcmp( type, "SCROLLLISTBOX" ) ) + else if( strcmp( type, "SCROLLLISTBOX" ) == 0 ) { memset( &lData, 0, sizeof( ListboxData ) ); @@ -1497,7 +1497,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &lData; } - else if( !strcmp( type, "ENTRYFIELD" ) ) + else if( strcmp( type, "ENTRYFIELD" ) == 0 ) { memset( &eData, 0, sizeof( EntryData ) ); @@ -1538,7 +1538,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &eData; } - else if( !strcmp( type, "STATICTEXT" ) ) + else if( strcmp( type, "STATICTEXT" ) == 0 ) { c = strtok( buffer, " \t\n\r" ); @@ -1559,7 +1559,7 @@ static Bool parseData( void **data, char *type, char *buffer ) *data = &tData; } - else if( !strcmp( type, "RADIOBUTTON" ) ) + else if( strcmp( type, "RADIOBUTTON" ) == 0 ) { c = strtok( buffer, " \t\n\r" ); @@ -1625,7 +1625,7 @@ static GameWindow *createGadget( char *type, instData->m_owner = parent; - if( !strcmp( type, "PUSHBUTTON" ) ) + if( strcmp( type, "PUSHBUTTON" ) == 0 ) { instData->m_style |= GWS_PUSH_BUTTON; @@ -1635,7 +1635,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "RADIOBUTTON" ) ) + else if( strcmp( type, "RADIOBUTTON" ) == 0 ) { RadioButtonData *rData = (RadioButtonData *)data; char filename[ MAX_WINDOW_NAME_LEN ]; @@ -1661,7 +1661,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "CHECKBOX" ) ) + else if( strcmp( type, "CHECKBOX" ) == 0 ) { instData->m_style |= GWS_CHECK_BOX; @@ -1671,7 +1671,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "TABCONTROL" ) ) + else if( strcmp( type, "TABCONTROL" ) == 0 ) { TabControlData *tcData = (TabControlData *)data; instData->m_style |= GWS_TAB_CONTROL; @@ -1680,7 +1680,7 @@ static GameWindow *createGadget( char *type, instData, tcData, instData->m_font, FALSE ); } - else if( !strcmp( type, "VERTSLIDER" ) ) + else if( strcmp( type, "VERTSLIDER" ) == 0 ) { SliderData *sData = (SliderData *)data; @@ -1712,7 +1712,7 @@ static GameWindow *createGadget( char *type, } } - else if( !strcmp( type, "HORZSLIDER" ) ) + else if( strcmp( type, "HORZSLIDER" ) == 0 ) { SliderData *sData = (SliderData *)data; @@ -1744,7 +1744,7 @@ static GameWindow *createGadget( char *type, } } - else if( !strcmp( type, "SCROLLLISTBOX" ) ) + else if( strcmp( type, "SCROLLLISTBOX" ) == 0 ) { ListboxData *lData = (ListboxData *)data; @@ -1826,7 +1826,7 @@ static GameWindow *createGadget( char *type, } } - else if( !strcmp( type, "COMBOBOX" ) ) + else if( strcmp( type, "COMBOBOX" ) == 0 ) { ComboBoxData *cData = (ComboBoxData *)data; cData->entryData = NEW EntryData; @@ -1974,7 +1974,7 @@ static GameWindow *createGadget( char *type, } } } - else if( !strcmp( type, "ENTRYFIELD" ) ) + else if( strcmp( type, "ENTRYFIELD" ) == 0 ) { EntryData *eData = (EntryData *)data; @@ -1985,7 +1985,7 @@ static GameWindow *createGadget( char *type, instData->m_font, FALSE ); } - else if( !strcmp( type, "STATICTEXT" ) ) + else if( strcmp( type, "STATICTEXT" ) == 0 ) { TextData *tData = (TextData *)data; @@ -1997,7 +1997,7 @@ static GameWindow *createGadget( char *type, } - else if( !strcmp( type, "PROGRESSBAR" ) ) + else if( strcmp( type, "PROGRESSBAR" ) == 0 ) { instData->m_style |= GWS_PROGRESS_BAR; @@ -2033,7 +2033,7 @@ static GameWindow *createWindow( char *type, parent = peekWindow(); // If this is a regular window just create it - if( !strcmp( type, "USER" ) ) + if( strcmp( type, "USER" ) == 0 ) { window = TheWindowManager->winCreate( parent, @@ -2050,7 +2050,7 @@ static GameWindow *createWindow( char *type, } } - else if( !strcmp( type, "TABPANE" ) ) + else if( strcmp( type, "TABPANE" ) == 0 ) { window = TheWindowManager->winCreate( parent, diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp index 7492768036..8f0a037f53 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp @@ -825,7 +825,7 @@ Bool GameTextManager::getStringCount( const char *filename, Int& textCount ) m_buffer[ len+1] = 0; readToEndOfQuote( file, &m_buffer[1], m_buffer2, m_buffer3, MAX_UITEXT_LENGTH ); } - else if( !stricmp( m_buffer, "END") ) + else if( stricmp( m_buffer, "END") == 0 ) { textCount++; } @@ -1036,7 +1036,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) for ( Int i = 0; i < listCount; i++ ) { - if ( !stricmp ( m_stringInfo[i].label.str(), m_buffer )) + if ( stricmp ( m_stringInfo[i].label.str(), m_buffer ) == 0) { DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer )); } @@ -1087,7 +1087,7 @@ Bool GameTextManager::parseStringFile( const char *filename ) readString = TRUE; } } - else if ( !stricmp ( m_buffer, "END" )) + else if ( stricmp ( m_buffer, "END" ) == 0) { break; } @@ -1167,7 +1167,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) for ( Int i = 0; i < listCount; i++ ) { - if ( !stricmp ( m_mapStringInfo[i].label.str(), m_buffer )) + if ( stricmp ( m_mapStringInfo[i].label.str(), m_buffer ) == 0) { DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer )); } @@ -1222,7 +1222,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename ) readString = TRUE; } } - else if ( !stricmp ( m_buffer, "END" )) + else if ( stricmp ( m_buffer, "END" ) == 0) { break; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index bfc97640c3..7bc310b7d6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -179,7 +179,7 @@ const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(L self->m_locomotorTemplates[set].clear(); for (const char* locoName = ini->getNextToken(); locoName; locoName = ini->getNextTokenOrNull()) { - if (!*locoName || !stricmp(locoName, "None")) + if (!*locoName || stricmp(locoName, "None") == 0) continue; NameKeyType locoKey = NAMEKEY(locoName); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp index e1bcf0dc23..c63442871a 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8caps.cpp @@ -833,14 +833,14 @@ void DX8Caps::Check_Driver_Version_Status() DriverVersionStatus=DRIVER_STATUS_BAD; break; case VENDOR_NVIDIA: - if (!stricmp(DriverDLL,"nv4.dll")) { + if (stricmp(DriverDLL,"nv4.dll") == 0) { switch (DriverBuildVersion) { case 327: // 5.00.2165.327 DriverVersionStatus=DRIVER_STATUS_BAD; } } - if (!stricmp(DriverDLL,"nv4_disp.dll") || !stricmp(DriverDLL,"nvdd32.dll")) { + if (stricmp(DriverDLL,"nv4_disp.dll") == 0 || stricmp(DriverDLL,"nvdd32.dll") == 0) { switch (DriverBuildVersion) { // 23.11 Is known to be very unstable case 2311: @@ -902,7 +902,7 @@ void DX8Caps::Check_Driver_Version_Status() } } // Elsa OEM drivers? - if (!stricmp(DriverDLL,"egdad.dll")) { + if (stricmp(DriverDLL,"egdad.dll") == 0) { // We know of version 5.9.0.312 (asked MShelling if he the drivers seem ok) switch (DriverBuildVersion) { default: @@ -913,7 +913,7 @@ void DX8Caps::Check_Driver_Version_Status() } // Elsa GLoria - if (!stricmp(DriverDLL,"egliid.dll")) { + if (stricmp(DriverDLL,"egliid.dll") == 0) { switch (DriverBuildVersion) { default: DriverVersionStatus=DRIVER_STATUS_UNKNOWN; @@ -924,12 +924,12 @@ void DX8Caps::Check_Driver_Version_Status() } // ASUS OEM drivers? - if (!stricmp(DriverDLL,"v66_disp.dll")) { + if (stricmp(DriverDLL,"v66_disp.dll") == 0) { // TOMSS1: 5.0.2195.379 } break; case VENDOR_ATI: - if (!stricmp(DriverDLL,"ati2dvag.dll")) { + if (stricmp(DriverDLL,"ati2dvag.dll") == 0) { switch (DriverBuildVersion) { case 3287: DriverVersionStatus=DRIVER_STATUS_UNKNOWN; @@ -948,13 +948,13 @@ void DX8Caps::Check_Driver_Version_Status() break; } } - if (!stricmp(DriverDLL,"atid32ae.dll")) { + if (stricmp(DriverDLL,"atid32ae.dll") == 0) { switch (DriverBuildVersion) { case 1010: DriverVersionStatus=DRIVER_STATUS_OK; } } - if (!stricmp(DriverDLL,"ati3drai.dll")) { + if (stricmp(DriverDLL,"ati3drai.dll") == 0) { switch (DriverBuildVersion) { case 1119: DriverVersionStatus=DRIVER_STATUS_UNKNOWN; @@ -962,7 +962,7 @@ void DX8Caps::Check_Driver_Version_Status() } break; case VENDOR_POWERVR: - if (!stricmp(DriverDLL,"pmx2hal.dll")) { + if (stricmp(DriverDLL,"pmx2hal.dll") == 0) { switch (DriverBuildVersion) { case 3111: // Michael Ruppert - TESTIBM104 default: DriverVersionStatus=DRIVER_STATUS_UNKNOWN; From 526aef993b5b1f96fd8f517fe9a2af9a4cef02fc Mon Sep 17 00:00:00 2001 From: bobtista Date: Tue, 9 Dec 2025 10:35:45 -0500 Subject: [PATCH 2/4] refactor(clang-tidy): fix bugprone-suspicious-string-compare --- .../Source/Win32Device/Common/Win32LocalFileSystem.cpp | 4 ++-- Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp index d417d0e731..84236de436 100644 --- a/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp @@ -139,7 +139,7 @@ void Win32LocalFileSystem::getFileListInDirectory(const AsciiString& currentDire while (!done) { if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - (strcmp(findData.cFileName, ".") != 0 && strcmp(findData.cFileName, ".."))) { + (strcmp(findData.cFileName, ".") != 0 && strcmp(findData.cFileName, "..") != 0)) { // if we haven't already, add this filename to the list. // a stl set should only allow one copy of each filename AsciiString newFilename; @@ -165,7 +165,7 @@ void Win32LocalFileSystem::getFileListInDirectory(const AsciiString& currentDire while (!done) { if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - (strcmp(findData.cFileName, ".") != 0 && strcmp(findData.cFileName, ".."))) { + (strcmp(findData.cFileName, ".") != 0 && strcmp(findData.cFileName, "..") != 0)) { AsciiString tempsearchstr; tempsearchstr.concat(currentDirectory); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index 2afb91369d..15afd75578 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -1342,7 +1342,7 @@ Font3DDataClass * WW3DAssetManager::Get_Font3DData( const char *name ) // loop through and see if the Font3D we are looking for has already been // allocated and thus we can just return it. for ( SLNode *node = Font3DDatas.Head(); node; node = node->Next()) { - if (!stricmp(name, node->Data()->Name)) { + if (stricmp(name, node->Data()->Name) == 0) { node->Data()->Add_Ref(); return node->Data(); } From ea1c3e58b18bc2b916710f89fcff8c7fadea5407 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 13 Dec 2025 18:15:38 -0500 Subject: [PATCH 3/4] refactor(clang-tidy): fix remaining bugprone-suspicious-string-compare instances --- .../Source/WWVegas/WW3D2/texturethumbnail.cpp | 2 +- Core/Tools/Autorun/GameText.cpp | 6 +++--- Core/Tools/Compress/Compress.cpp | 10 +++++----- Core/Tools/W3DView/W3DView.cpp | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp b/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp index 9c7a124863..03c803491a 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/texturethumbnail.cpp @@ -37,7 +37,7 @@ static void Create_Hash_Name(StringClass& name, const StringClass& thumb_name) { name=thumb_name; int len=name.Get_Length(); - WWASSERT(!stricmp(&name[len-4],".tga") || !stricmp(&name[len-4],".dds")); + WWASSERT(stricmp(&name[len-4],".tga") == 0 || stricmp(&name[len-4],".dds") == 0); name[len-4]='\0'; _strlwr(name.Peek_Buffer()); } diff --git a/Core/Tools/Autorun/GameText.cpp b/Core/Tools/Autorun/GameText.cpp index f961646d97..c2f990fc4e 100644 --- a/Core/Tools/Autorun/GameText.cpp +++ b/Core/Tools/Autorun/GameText.cpp @@ -778,7 +778,7 @@ Bool GameTextManager::getStringCount( char *filename ) m_buffer[ len+1] = 0; readToEndOfQuote( &file, &m_buffer[1], m_buffer2, m_buffer3, MAX_UITEXT_LENGTH ); } - else if( !stricmp( m_buffer, "END") ) + else if( stricmp( m_buffer, "END") == 0 ) { m_textCount++; } @@ -974,7 +974,7 @@ Bool GameTextManager::parseStringFile( char *filename ) for ( Int i = 0; i < listCount; i++ ) { - if ( !stricmp ( m_stringInfo[i].label.c_str(), m_buffer )) + if ( stricmp ( m_stringInfo[i].label.c_str(), m_buffer ) == 0 ) { DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer )); } @@ -1025,7 +1025,7 @@ Bool GameTextManager::parseStringFile( char *filename ) readString = TRUE; } } - else if ( !stricmp ( m_buffer, "END" )) + else if ( stricmp ( m_buffer, "END" ) == 0 ) { break; } diff --git a/Core/Tools/Compress/Compress.cpp b/Core/Tools/Compress/Compress.cpp index 323d557d42..66466171cc 100644 --- a/Core/Tools/Compress/Compress.cpp +++ b/Core/Tools/Compress/Compress.cpp @@ -58,13 +58,13 @@ int main(int argc, char **argv) for (int i=1; iActiveRefInfo); if ( ref->File && search_ref->File && - !strcmp(search_ref->File, ref->File) && + strcmp(search_ref->File, ref->File) == 0 && (search_ref->Line == ref->Line) ) { count++; } else if ( (ref->File == NULL) && (search_ref->File == NULL) ) { From 9026f12e83be2cdb77b96b582d6fa1c83c6febb2 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Sat, 13 Dec 2025 18:17:28 -0500 Subject: [PATCH 4/4] refactor(clang-tidy): additional bugprone-suspicious-string-compare fixes --- .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 2 +- .../StdDevice/Common/StdLocalFileSystem.cpp | 4 ++-- .../Source/WWVegas/WWDownload/Download.cpp | 2 +- .../Source/debug/netserv/netserv.cpp | 2 +- Core/Libraries/Source/debug/test2/test2.cpp | 2 +- Core/Tools/Autorun/GETCD.cpp | 4 ++-- Core/Tools/Babylon/Babylon.cpp | 2 +- Core/Tools/Babylon/BabylonDlg.cpp | 20 +++++++++---------- Core/Tools/Babylon/TransDB.cpp | 18 ++++++++--------- Core/Tools/assetcull/assetcull.cpp | 4 ++-- Core/Tools/mangler/wlib/configfile.cpp | 4 ++-- Core/Tools/matchbot/wlib/configfile.cpp | 4 ++-- .../Tools/textureCompress/textureCompress.cpp | 2 +- .../Source/Common/System/Directory.cpp | 2 +- .../GameEngine/Source/GameNetwork/GameSpy.cpp | 6 +++--- .../Tools/WorldBuilder/src/ObjectPreview.cpp | 2 +- .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 6 +++--- .../Source/Common/System/Directory.cpp | 2 +- .../Source/WWVegas/WW3D2/assetmgr.cpp | 2 +- 19 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp index e288efeef4..8be4c993d9 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp @@ -2590,7 +2590,7 @@ static void roomKeyChangedCallback(PEER peer, RoomType roomType, const char *nic } #ifdef DEBUG_LOGGING - if (strcmp(key, "username") && strcmp(key, "b_flags")) + if (strcmp(key, "username") != 0 && strcmp(key, "b_flags") != 0) { DEBUG_LOG(("roomKeyChangedCallback() - %s set %s=%s", nick, key, val)); } diff --git a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp index c65857047d..119cd94a35 100644 --- a/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp +++ b/Core/GameEngineDevice/Source/StdDevice/Common/StdLocalFileSystem.cpp @@ -241,7 +241,7 @@ void StdLocalFileSystem::getFileListInDirectory(const AsciiString& currentDirect while (!done) { std::string filenameStr = iter->path().filename().string(); if (!iter->is_directory() && iter->path().extension() == searchExt && - (strcmp(filenameStr.c_str(), ".") != 0 && strcmp(filenameStr.c_str(), ".."))) { + (strcmp(filenameStr.c_str(), ".") != 0 && strcmp(filenameStr.c_str(), "..") != 0)) { // if we haven't already, add this filename to the list. // a stl set should only allow one copy of each filename AsciiString newFilename = iter->path().string().c_str(); @@ -268,7 +268,7 @@ void StdLocalFileSystem::getFileListInDirectory(const AsciiString& currentDirect while (!done) { std::string filenameStr = iter->path().filename().string(); if(iter->is_directory() && - (strcmp(filenameStr.c_str(), ".") != 0 && strcmp(filenameStr.c_str(), ".."))) { + (strcmp(filenameStr.c_str(), ".") != 0 && strcmp(filenameStr.c_str(), "..") != 0)) { AsciiString tempsearchstr(filenameStr.c_str()); // recursively add files in subdirectories if required. diff --git a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp index b9d342b10b..8f8ab20e21 100644 --- a/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp +++ b/Core/Libraries/Source/WWVegas/WWDownload/Download.cpp @@ -47,7 +47,7 @@ HRESULT CDownload::DownloadFile(LPCSTR server, LPCSTR username, LPCSTR password, // If we're still connected, make sure we're on the right server if (m_Status == DOWNLOADSTATUS_FINDINGFILE) { - if ((strcmp(m_Server, server) != 0) || (strcmp(m_Login, username))) + if ((strcmp(m_Server, server) != 0) || (strcmp(m_Login, username) != 0)) { // Damn, a server switch. Close conn & fix state m_Ftp->DisconnectFromServer(); diff --git a/Core/Libraries/Source/debug/netserv/netserv.cpp b/Core/Libraries/Source/debug/netserv/netserv.cpp index 63c1d806f4..45abd3717c 100644 --- a/Core/Libraries/Source/debug/netserv/netserv.cpp +++ b/Core/Libraries/Source/debug/netserv/netserv.cpp @@ -297,7 +297,7 @@ int CALLBACK WinMain(HINSTANCE,HINSTANCE,LPSTR,int) char *input=InputConsole(); if (input) { - if (!strcmp(input,"quit")) + if (strcmp(input,"quit") == 0) break; } diff --git a/Core/Libraries/Source/debug/test2/test2.cpp b/Core/Libraries/Source/debug/test2/test2.cpp index b8352794da..0980746ec0 100644 --- a/Core/Libraries/Source/debug/test2/test2.cpp +++ b/Core/Libraries/Source/debug/test2/test2.cpp @@ -51,7 +51,7 @@ class TestCmdInterface: public DebugCmdInterface virtual bool Execute(class Debug& dbg, const char *cmd, CommandMode cmdmode, unsigned argn, const char * const * argv) { - if (strcmp(cmd,"box")) + if (strcmp(cmd,"box") != 0) return false; MessageBox(NULL,"Hello world!","Command",MB_OK); diff --git a/Core/Tools/Autorun/GETCD.cpp b/Core/Tools/Autorun/GETCD.cpp index f0d56b1775..fa8df05e26 100644 --- a/Core/Tools/Autorun/GETCD.cpp +++ b/Core/Tools/Autorun/GETCD.cpp @@ -200,7 +200,7 @@ int GetCDClass::Get_CD_Drive_For_This_Volume ( const char *volume_label ) volume_name[11] = '\0'; } - if ( !_stricmp( volume_label, volume_name )) { + if ( _stricmp( volume_label, volume_name ) == 0) { return( cd_drive ); } @@ -385,7 +385,7 @@ bool CD_Volume_Verification ( int cd_drive, char *volume_label, char *volume_to_ strncpy( volume_label, volume_name, 128 ); } - if ( !_stricmp( volume_to_find, volume_name )) { + if ( _stricmp( volume_to_find, volume_name ) == 0) { return TRUE; } diff --git a/Core/Tools/Babylon/Babylon.cpp b/Core/Tools/Babylon/Babylon.cpp index fede71fa44..7354eefcb9 100644 --- a/Core/Tools/Babylon/Babylon.cpp +++ b/Core/Tools/Babylon/Babylon.cpp @@ -220,7 +220,7 @@ BOOL CALLBACK EnumAllWindowsProcExact(HWND hWnd, LPARAM lParam) GetWindowText(hWnd, szText, sizeof(szText)); - if ( !strncmp (szText, szSearchTitle, strlen ( szSearchTitle))) + if ( strncmp (szText, szSearchTitle, strlen ( szSearchTitle)) == 0) { * (BOOL *) lParam = TRUE; FoundWindow = hWnd; diff --git a/Core/Tools/Babylon/BabylonDlg.cpp b/Core/Tools/Babylon/BabylonDlg.cpp index 0b40dbc28b..27706df01f 100644 --- a/Core/Tools/Babylon/BabylonDlg.cpp +++ b/Core/Tools/Babylon/BabylonDlg.cpp @@ -980,27 +980,27 @@ static int parseComment ( FILE *file, char *buffer, INFO *info ) return new_lines; } - if ( !stricmp ( token, "COMMENT" ) ) + if ( stricmp ( token, "COMMENT" ) == 0 ) { new_lines += getString ( file, buffer, info->comment ); } - else if ( !stricmp ( token, "CONTEXT" ) ) + else if ( stricmp ( token, "CONTEXT" ) == 0 ) { new_lines += getString ( file, buffer, info->context ); } - else if ( !stricmp ( token, "SPEAKER" ) ) + else if ( stricmp ( token, "SPEAKER" ) == 0 ) { new_lines += getString ( file, buffer, info->speaker ); } - else if ( !stricmp ( token, "LISTENER" ) ) + else if ( stricmp ( token, "LISTENER" ) == 0 ) { new_lines += getString ( file, buffer, info->listener ); } - else if ( !stricmp ( token, "MAXLEN" ) ) + else if ( stricmp ( token, "MAXLEN" ) == 0 ) { info->maxlen = atoi ( buffer ); } - else if ( !stricmp ( token, "WAVE" ) ) + else if ( stricmp ( token, "WAVE" ) == 0 ) { new_lines += getString ( file, buffer, info->wave ); } @@ -1024,7 +1024,7 @@ static int getLabelCount( char *filename ) if( fscanf( fp, "%s", buffer ) == EOF ) break; - if ( !stricmp( buffer, "END" ) ) + if ( stricmp( buffer, "END" ) == 0 ) { count++; } @@ -1083,7 +1083,7 @@ int CBabylonDlg::LoadStrFile ( TransDB *db, const char *filename, void (*cb) ( v line_number++; removeLeadingAndTrailing ( buffer ); - if ( !stricmp ( buffer, "END" ) ) + if ( stricmp ( buffer, "END" ) == 0 ) { break; } @@ -1607,7 +1607,7 @@ int CBabylonDlg::UpdateLabel( BabylonLabel *source, BabylonLabel *destination, U if ( (stext = (BabylonText *) dtext->Matched ()) ) { // stext is the newer version; - if ( wcscmp ( dtext->Get (), stext->Get ())) + if ( wcscmp ( dtext->Get (), stext->Get ()) != 0) { if ( update ) { @@ -1617,7 +1617,7 @@ int CBabylonDlg::UpdateLabel( BabylonLabel *source, BabylonLabel *destination, U label_modified = TRUE; info.changes ++; } - if ( wcsicmp ( dtext->Wave (), stext->Wave ())) + if ( wcsicmp ( dtext->Wave (), stext->Wave ()) != 0) { if ( update ) { diff --git a/Core/Tools/Babylon/TransDB.cpp b/Core/Tools/Babylon/TransDB.cpp index ac462c927c..5ef14300b9 100644 --- a/Core/Tools/Babylon/TransDB.cpp +++ b/Core/Tools/Babylon/TransDB.cpp @@ -96,7 +96,7 @@ LANGINFO *GetLangInfo ( char *language ) while ( item->langid != LANGID_UNKNOWN ) { - if ( !stricmp ( language, item->name ) ) + if ( stricmp ( language, item->name ) == 0 ) { return item; } @@ -330,7 +330,7 @@ BabylonText* TransDB::FindSubText ( OLECHAR *pattern, int item ) while ( text ) { - if ( !wcsnicmp ( text->Get (), pattern, 15 )) + if ( wcsnicmp ( text->Get (), pattern, 15 ) == 0) { if ( !item ) { @@ -692,7 +692,7 @@ BabylonText* BabylonLabel::FindText ( OLECHAR *find_text ) while ( txt ) { - if ( !wcscmp ( txt->Get(), find_text )) + if ( wcscmp ( txt->Get(), find_text ) == 0) { return txt; } @@ -836,25 +836,25 @@ void BabylonLabel::AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes txt = NextText ( sh ); } - if ( strcmp ( CommentSB(), "" ) ) + if ( strcmp ( CommentSB(), "" ) != 0 ) { sprintf ( buffer, "COMMENT : %s", CommentSB() ); tc->InsertItem ( buffer, litem ); } - if ( strcmp ( ContextSB(), "" ) ) + if ( strcmp ( ContextSB(), "" ) != 0 ) { sprintf ( buffer, "CONTEXT : %s", ContextSB() ); tc->InsertItem ( buffer, litem ); } - if ( strcmp ( SpeakerSB(), "" ) ) + if ( strcmp ( SpeakerSB(), "" ) != 0 ) { sprintf ( buffer, "SPEAKER : %s", SpeakerSB() ); tc->InsertItem ( buffer, litem ); } - if ( strcmp ( ListenerSB(), "" ) ) + if ( strcmp ( ListenerSB(), "" ) != 0 ) { sprintf ( buffer, "LISTENER: %s", ListenerSB() ); tc->InsertItem ( buffer, litem ); @@ -1341,7 +1341,7 @@ void BabylonText::AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes tc->InsertItem ( buffer, item ); } - if ( strcmp ( WaveSB(), "" ) ) + if ( strcmp ( WaveSB(), "" ) != 0 ) { sprintf ( buffer, "WAVE : %s", WaveSB() ); tc->InsertItem ( buffer, item ); @@ -1411,7 +1411,7 @@ void Translation::AddToTree ( CTreeCtrl *tc, HTREEITEM parent, int changes item = tc->InsertItem ( buffer, parent ); - if ( strcmp ( CommentSB(), "" ) ) + if ( strcmp ( CommentSB(), "" ) != 0 ) { sprintf ( buffer, "COMMENT: %s", CommentSB() ); tc->InsertItem ( buffer, item ); diff --git a/Core/Tools/assetcull/assetcull.cpp b/Core/Tools/assetcull/assetcull.cpp index dc55dcdd36..4535a6f9c3 100644 --- a/Core/Tools/assetcull/assetcull.cpp +++ b/Core/Tools/assetcull/assetcull.cpp @@ -69,7 +69,7 @@ static bool filesEqual(const char *fn1, const char *fn2) if (fread(buf1,cur,1,f1)!=1|| fread(buf2,cur,1,f2)!=1) break; - if (memcmp(buf1,buf2,cur)) + if (memcmp(buf1,buf2,cur) != 0) break; k+=cur; } @@ -105,7 +105,7 @@ static int recursiveCull(FILE *batchFile, { if (fd.attrib&_A_SUBDIR) { - if (strcmp(fd.name,".")&& + if (strcmp(fd.name,".") != 0&& strcmp(fd.name,"..")) subdir.push_back(fd.name); } diff --git a/Core/Tools/mangler/wlib/configfile.cpp b/Core/Tools/mangler/wlib/configfile.cpp index bed6c86446..b8d465b750 100644 --- a/Core/Tools/mangler/wlib/configfile.cpp +++ b/Core/Tools/mangler/wlib/configfile.cpp @@ -340,7 +340,7 @@ bit8 ConfigFile::setString(IN Wstring &_key, IN Wstring &value, IN char *section for (i=0; igetSlotNum(nick); if (slotNum == 0 && !TheGameSpyGame->amIHost()) { - if (!strcmp(command, "SL")) + if (strcmp(command, "SL") == 0) { AsciiString options = parameters; options.trim(); ParseAsciiStringToGameInfo(TheGameSpyGame, options.str()); WOLDisplaySlotList(); } - else if (!strcmp(command, "HWS")) // HostWantsStart + else if (strcmp(command, "HWS") == 0) // HostWantsStart { Int slotNum = TheGameSpyGame->getLocalSlotNum(); GameSlot *slot = TheGameSpyGame->getSlot(slotNum); @@ -675,7 +675,7 @@ static void PlayerUTMCallback(PEER peer, const char * nick, Int slotNum = TheGameSpyGame->getSlotNum(nick); if (slotNum != 0 && TheGameSpyGame->amIHost()) { - if (!strcmp(command, "REQ")) + if (strcmp(command, "REQ") == 0) { AsciiString options = parameters; options.trim(); diff --git a/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp b/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp index 0e3cc1618f..6ed63b1bb4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/ObjectPreview.cpp @@ -197,7 +197,7 @@ static UnsignedByte * generatePreview( const ThingTemplate *tt ) } // set render object, or create if we need to if( modelName.isEmpty() == FALSE && - strncmp( modelName.str(), "No ", 3 ) ) + strncmp( modelName.str(), "No ", 3 ) != 0 ) { WW3DAssetManager *pMgr = W3DAssetManager::Get_Instance(); model = pMgr->Create_Render_Obj(modelName.str()); diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index ee07f29dfb..52cfb0e994 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -1004,7 +1004,7 @@ void WbView3d::updateFenceListObjects(MapObject *pObject) AsciiString modelName = getModelNameAndScale(pMapObj, &scale, BODY_PRISTINE); // set render object, or create if we need to if( renderObj == NULL && modelName.isEmpty() == FALSE && - strncmp( modelName.str(), "No ", 3 ) ) + strncmp( modelName.str(), "No ", 3 ) != 0 ) { renderObj = m_assetManager->Create_Render_Obj( modelName.str(), scale, 0); @@ -1130,7 +1130,7 @@ void WbView3d::invalBuildListItemInView(BuildListInfo *pBuildToInval) } // set render object, or create if we need to if( renderObj == NULL && modelName.isEmpty() == FALSE && - strncmp( modelName.str(), "No ", 3 ) ) + strncmp( modelName.str(), "No ", 3 ) != 0 ) { renderObj = m_assetManager->Create_Render_Obj( modelName.str(), scale, playerColor); @@ -1395,7 +1395,7 @@ void WbView3d::invalObjectInView(MapObject *pMapObjIn) AsciiString modelName = getModelNameAndScale(pMapObj, &scale, curDamageState); // set render object, or create if we need to if( renderObj == NULL && modelName.isEmpty() == FALSE && - strncmp( modelName.str(), "No ", 3 ) ) + strncmp( modelName.str(), "No ", 3 ) != 0 ) { if (!getShowModels()) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Directory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Directory.cpp index 23a78434a6..c2d526c649 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Directory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Directory.cpp @@ -97,7 +97,7 @@ Directory::Directory( const AsciiString& dirPath ) : m_dirPath(dirPath) // if this is a subdirectory keep the name around till the end if( BitIsSet( item.dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY ) ) { - if ( strcmp( item.cFileName, "." ) && strcmp( item.cFileName, ".." ) ) + if ( strcmp( item.cFileName, "." ) != 0 && strcmp( item.cFileName, ".." ) != 0 ) { info.set(item); m_subdirs.insert( info ); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp index 597db9f6bc..56b257de89 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp @@ -1347,7 +1347,7 @@ Font3DDataClass * WW3DAssetManager::Get_Font3DData( const char *name ) // loop through and see if the Font3D we are looking for has already been // allocated and thus we can just return it. for ( SLNode *node = Font3DDatas.Head(); node; node = node->Next()) { - if (!stricmp(name, node->Data()->Name)) { + if (stricmp(name, node->Data()->Name) == 0) { node->Data()->Add_Ref(); return node->Data(); }