Skip to content

Commit 9fc8f4c

Browse files
committed
refactor: fix remaining size() comparisons found with manual search
1 parent 4711dab commit 9fc8f4c

File tree

16 files changed

+24
-24
lines changed

16 files changed

+24
-24
lines changed

Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ void LadderList::checkLadder( AsciiString fname, Int index )
505505

506506
if (li->validMaps.empty())
507507
{
508-
DEBUG_LOG(("Bailing because of li->validMaps.size() == 0"));
508+
DEBUG_LOG(("Bailing because of li->validMaps.empty()"));
509509
delete li;
510510
return;
511511
}

Core/Libraries/Source/WWVegas/WWLib/notifier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ template<typename Event> class Observer
8888
//! Stop observing event
8989
void StopObserving()
9090
{
91-
while (mNotifiers.size() > 0)
91+
while (!mNotifiers.empty())
9292
{
9393
Notifier<Event>* notifier = mNotifiers.back();
9494
assert(notifier && "ERROR: NULL pointer in collection.");

Generals/Code/GameEngine/Source/Common/RTS/Player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Player::Player( Int playerIndex )
352352
void Player::init(const PlayerTemplate* pt)
353353
{
354354

355-
DEBUG_ASSERTCRASH(m_playerTeamPrototypes.size() == 0, ("Player::m_playerTeamPrototypes is not empty at game start!"));
355+
DEBUG_ASSERTCRASH(m_playerTeamPrototypes.empty(), ("Player::m_playerTeamPrototypes is not empty at game start!"));
356356
m_skillPointsModifier = 1.0f;
357357
m_attackedFrame = 0;
358358

Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ void BridgeBehavior::xfer( Xfer *xfer )
14511451
{
14521452

14531453
// read all object IDs
1454-
DEBUG_ASSERTCRASH( m_scaffoldObjectIDList.size() == 0,
1454+
DEBUG_ASSERTCRASH( m_scaffoldObjectIDList.empty(),
14551455
("BridgeBehavior::xfer - scaffold object list should be empty") );
14561456
for( Int i = 0; i < scaffoldObjectCount; ++i )
14571457
{

Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ struct ModelConditionInfo
245245
void loadAnimations() const;
246246
void preloadAssets( TimeOfDay timeOfDay, Real scale ); ///< preload any assets for time of day
247247

248-
Int getConditionsYesCount() const { DEBUG_ASSERTCRASH(m_conditionsYesVec.size() > 0, ("empty m_conditionsYesVec.size(), see srj")); return m_conditionsYesVec.size(); }
249-
const ModelConditionFlags& getNthConditionsYes(Int i) const { return m_conditionsYesVec[i]; }
248+
inline Int getConditionsYesCount() const { DEBUG_ASSERTCRASH(!m_conditionsYesVec.empty(), ("empty m_conditionsYesVec.size(), see srj")); return m_conditionsYesVec.size(); }
249+
inline const ModelConditionFlags& getNthConditionsYes(Int i) const { return m_conditionsYesVec[i]; }
250250
#if defined(RTS_DEBUG)
251251
inline AsciiString getDescription() const { return m_description; }
252252
#endif

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void
16011601
throw INI_INVALID_DATA;
16021602
}
16031603

1604-
DEBUG_ASSERTCRASH(info.m_conditionsYesVec.size() == 0, ("*** ASSET ERROR: nonempty m_conditionsYesVec.size(), see srj"));
1604+
DEBUG_ASSERTCRASH(info.m_conditionsYesVec.empty(), ("*** ASSET ERROR: nonempty m_conditionsYesVec.size(), see srj"));
16051605
info.m_conditionsYesVec.clear();
16061606
info.m_conditionsYesVec.push_back(conditionsYes);
16071607
}

Generals/Code/Tools/WorldBuilder/src/ObjectOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ BOOL ObjectOptions::OnInitDialog()
283283
FilenameList filenameList;
284284
TheFileSystem->getFileListInDirectory(TEST_W3D_DIR_PATH, "*.w3d", filenameList, FALSE);
285285

286-
if (filenameList.size() > 0) {
286+
if (!filenameList.empty()) {
287287
FilenameList::iterator it = filenameList.begin();
288288
do {
289289
AsciiString filename = *it;

Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ BOOL RoadOptions::OnInitDialog()
247247
FilenameList filenameList;
248248
TheFileSystem->getFileListInDirectory(ROAD_DIRECTORY, "*.tga", filenameList, FALSE);
249249

250-
if (filenameList.size() > 0) {
250+
if (!filenameList.empty()) {
251251
FilenameList::iterator it = filenameList.begin();
252252
do {
253253
AsciiString filename = *it;

Generals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class CachedMFCFileOutputStream : public OutputStream
194194
return(numBytes);
195195
};
196196
virtual void flush(void) {
197-
while (m_cachedChunks.size() != 0)//!m_cachedChunks.empty())
197+
while (!m_cachedChunks.empty())//!m_cachedChunks.empty())
198198
{
199199
CachedChunk c = m_cachedChunks.front();
200200
m_cachedChunks.pop_front();
@@ -232,7 +232,7 @@ class CompressedCachedMFCFileOutputStream : public OutputStream
232232
return;
233233
UnsignedByte *srcBuffer = NEW UnsignedByte[m_totalBytes];
234234
UnsignedByte *insertPos = srcBuffer;
235-
while (m_cachedChunks.size() != 0)
235+
while (!m_cachedChunks.empty())
236236
{
237237
CachedChunk c = m_cachedChunks.front();
238238
m_cachedChunks.pop_front();
@@ -1474,7 +1474,7 @@ Bool CWorldBuilderDoc::getAllIndexesInRect(const Coord3D* bl, const Coord3D* br,
14741474
FindIndexNearest(this, &center, &ndx, PREFER_BOTTOM);
14751475
AddUniqueAndNeighbors(this, bl, br, tl, tr, ndx, allIndices);
14761476

1477-
return (allIndices->size() > 0);
1477+
return (!allIndices->empty());
14781478
}
14791479

14801480

@@ -2245,7 +2245,7 @@ void CWorldBuilderDoc::OnDumpDocToText(void)
22452245

22462246
fprintf(theLogFile, "Total Map Objects (with ThingTemplates): %d\n", totalObjectCount);
22472247

2248-
while (mapOfTemplates.size() > 0) {
2248+
while (!mapOfTemplates.empty()) {
22492249
std::map<AsciiString, Int>::iterator storedIt = mapOfTemplates.begin();
22502250

22512251
for (it = mapOfTemplates.begin(); it != mapOfTemplates.end(); ++it) {

GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ Player::Player( Int playerIndex )
352352
void Player::init(const PlayerTemplate* pt)
353353
{
354354

355-
DEBUG_ASSERTCRASH(m_playerTeamPrototypes.size() == 0, ("Player::m_playerTeamPrototypes is not empty at game start!"));
355+
DEBUG_ASSERTCRASH(m_playerTeamPrototypes.empty(), ("Player::m_playerTeamPrototypes is not empty at game start!"));
356356
m_skillPointsModifier = 1.0f;
357357
m_attackedFrame = 0;
358358

0 commit comments

Comments
 (0)