Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ void AudioEventRTS::generateFilename( void )
adjustForLocalization(m_filenameToLoad);
return;
} else {
if (m_eventInfo->m_sounds.size() == 0) {
if (m_eventInfo->m_sounds.empty()) {
m_filenameToLoad = AsciiString::TheEmptyString;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/Common/System/GameMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Core/GameEngine/Source/Common/System/Xfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void Xfer::xferSTLObjectIDVector( std::vector<ObjectID> *objectIDVectorData )
{

// sanity, the list should be empty before we transfer more data into it
if( objectIDVectorData->size() != 0 )
if( !objectIDVectorData->empty() )
{

DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object vector should be empty before loading" ));
Expand Down Expand Up @@ -462,7 +462,7 @@ void Xfer::xferSTLObjectIDList( std::list< ObjectID > *objectIDListData )
{

// sanity, the list should be empty before we transfer more data into it
if( objectIDListData->size() != 0 )
if( !objectIDListData->empty() )
{

DEBUG_CRASH(( "Xfer::xferSTLObjectIDList - object list should be empty before loading" ));
Expand Down Expand Up @@ -528,7 +528,7 @@ void Xfer::xferSTLIntList( std::list< Int > *intListData )
{

// sanity, the list should be empty before we transfer more data into it
if( intListData->size() != 0 )
if( !intListData->empty() )
{

DEBUG_CRASH(( "Xfer::xferSTLIntList - int list should be empty before loading" ));
Expand Down
6 changes: 3 additions & 3 deletions Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static LadderInfo *parseLadder(AsciiString raw)
// end of a ladder
if (lad->playersPerTeam >= 1 && lad->playersPerTeam <= MAX_SLOTS/2)
{
if (lad->validFactions.size() == 0)
if (lad->validFactions.empty())
{
DEBUG_LOG(("No factions specified. Using all."));
lad->validFactions.clear();
Expand All @@ -190,7 +190,7 @@ static LadderInfo *parseLadder(AsciiString raw)
}
}

if (lad->validMaps.size() == 0)
if (lad->validMaps.empty())
{
DEBUG_LOG(("No maps specified. Using all."));
std::list<AsciiString> qmMaps = TheGameSpyConfig->getQMMaps();
Expand Down Expand Up @@ -503,7 +503,7 @@ void LadderList::checkLadder( AsciiString fname, Int index )
return;
}

if (li->validMaps.size() == 0)
if (li->validMaps.empty())
{
DEBUG_LOG(("Bailing because of li->validMaps.size() == 0"));
delete li;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static void startOnline( void )
noPatchBeforeOnlineCallback);
return;
}
if (queuedDownloads.size())
if (!queuedDownloads.empty())
{
if (!hasWriteAccess())
{
Expand Down
4 changes: 2 additions & 2 deletions Core/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -378,7 +378,7 @@ void GameSpyInfo::joinBestGroupRoom( void )
return;
}

if (m_groupRooms.size())
if (!m_groupRooms.empty())
{
int minID = -1;
int minPlayers = 1000;
Expand Down
14 changes: 7 additions & 7 deletions Core/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1663,7 +1663,7 @@ void PeerThreadClass::Thread_Function()
m_playerFactions[i] = 0;
m_playerColors[i] = 0;
}
if (incomingRequest.password.length() > 0)
if (!incomingRequest.password.empty())
m_hasPassword = true;
else
m_hasPassword = false;
Expand Down Expand Up @@ -1714,7 +1714,7 @@ void PeerThreadClass::Thread_Function()

case PeerRequest::PEERREQUEST_UTMPLAYER:
{
if (incomingRequest.nick.length() > 0)
if (!incomingRequest.nick.empty())
{
peerUTMPlayer( peer, incomingRequest.nick.c_str(), incomingRequest.id.c_str(), incomingRequest.options.c_str(), PEERFalse );
}
Expand Down Expand Up @@ -1842,7 +1842,7 @@ void PeerThreadClass::handleQMMatch(PEER peer, Int mapIndex, Int seed,
Int i=0;
for (; i<MAX_SLOTS; ++i)
{
if (playerName[i] && stricmp(playerName[i], m_loginName.c_str()))
if (playerName[i] && stricmp(playerName[i], m_loginName.c_str()) != 0)
{
peerMessagePlayer( peer, playerName[i], "We're matched!", NormalMessage );
}
Expand Down Expand Up @@ -2705,7 +2705,7 @@ void playerLeftCallback(PEER peer, RoomType roomType, const char * nick, const c

if (t->getQMStatus() != 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;
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ static void debugDumpPlayerStats( const PSPlayerStats& stats )
DEBUG_LOG(("gamesAsRandom: %d", stats.gamesAsRandom));
}

if (stats.options.length())
if (!stats.options.empty())
{
DEBUG_LOG(("Options: %s", stats.options.c_str()));
}

if (stats.systemSpec.length())
if (!stats.systemSpec.empty())
{
DEBUG_LOG(("systemSpec: %s", stats.systemSpec.c_str()));
}
Expand Down Expand Up @@ -184,7 +184,7 @@ static void debugDumpPlayerStats( const PSPlayerStats& stats )
DEBUG_LOG(("lastLadderPort: %d", stats.lastLadderPort));
}

if (stats.lastLadderHost.length())
if (!stats.lastLadderHost.empty())
{
DEBUG_LOG(("lastLadderHost: %s", stats.lastLadderHost.c_str()));
}
Expand Down Expand Up @@ -246,12 +246,12 @@ void PSPlayerStats::incorporate( const PSPlayerStats& other )
gamesAsRandom = other.gamesAsRandom;
}

if (other.options.length())
if (!other.options.empty())
{
options = other.options;
}

if (other.systemSpec.length())
if (!other.systemSpec.empty())
{
systemSpec = other.systemSpec;
}
Expand Down Expand Up @@ -325,7 +325,7 @@ void PSPlayerStats::incorporate( const PSPlayerStats& other )
{
lastLadderPort = other.lastLadderPort;
}
if (other.lastLadderHost.length())
if (!other.lastLadderHost.empty())
{
lastLadderHost = other.lastLadderHost;
}
Expand Down Expand Up @@ -971,7 +971,7 @@ void PSThreadClass::Thread_Function()
addedInDesyncs4 + req.addDesync, addedInDiscons4 + req.addDiscon));
}
pref.write();
if (req.password.size() == 0)
if (req.password.empty())
return;
}
if (!req.player.id)
Expand Down Expand Up @@ -1370,13 +1370,13 @@ std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats s
s.append(kvbuf);
}

if (stats.options.length())
if (!stats.options.empty())
{
snprintf(kvbuf, 256, "\\options\\%s", stats.options.c_str());
s.append(kvbuf);
}

if (stats.systemSpec.length())
if (!stats.systemSpec.empty())
{
snprintf(kvbuf, 256, "\\systemSpec\\%s", stats.systemSpec.c_str());
s.append(kvbuf);
Expand Down Expand Up @@ -1472,7 +1472,7 @@ std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats s
sprintf(kvbuf, "\\ladderPort\\%d", stats.lastLadderPort);
s.append(kvbuf);
}
if (stats.lastLadderHost.length())
if (!stats.lastLadderHost.empty())
{
snprintf(kvbuf, 256, "\\ladderHost\\%s", stats.lastLadderHost.c_str());
s.append(kvbuf);
Expand Down
8 changes: 4 additions & 4 deletions Core/GameEngine/Source/GameNetwork/NAT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<node number>
// a probe has been sent at us, if we are waiting because of a netgear or something, we
// should start sending our own probes.
Expand All @@ -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<node number>
// 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.
Expand All @@ -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<node number>
// 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.
Expand All @@ -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<node number> <port number> <internal IP>
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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.
Expand Down Expand Up @@ -323,7 +323,7 @@ Bool StdLocalFileSystem::createDirectory(AsciiString directory)
std::replace(fixedDirectory.begin(), fixedDirectory.end(), '\\', '/');
#endif

if ((fixedDirectory.length() > 0) && (fixedDirectory.length() < _MAX_DIR)) {
if ((!fixedDirectory.empty()) && (fixedDirectory.length() < _MAX_DIR)) {
// Convert to host path
std::filesystem::path path(std::move(fixedDirectory));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWDownload/Download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions Core/Libraries/Source/WWVegas/WWLib/argv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ 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];
}
}
} else {
// 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];
}
}
Expand All @@ -120,15 +120,15 @@ 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];
}
}
} else {
// 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];
}
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWLib/ini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading