Skip to content

Commit 24f057a

Browse files
authored
[GEN][ZH] Correct the most egregious signed / unsigned mismatch warnings (#643)
1 parent e8a6839 commit 24f057a

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

Generals/Code/GameEngine/Include/Common/ThingTemplate.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ class ModuleInfo
289289
#if defined(_DEBUG) || defined(_INTERNAL)
290290
Bool containsPartialName(const char* n) const
291291
{
292-
for (int i = 0; i < m_info.size(); i++)
292+
for (size_t i = 0; i < m_info.size(); i++)
293293
if (strstr(m_info[i].first.str(), n) != NULL)
294294
return true;
295295
return false;
296296
}
297297
#endif
298298

299-
AsciiString getNthName(Int i) const
299+
AsciiString getNthName(size_t i) const
300300
{
301301
if (i >= 0 && i < m_info.size())
302302
{
@@ -305,7 +305,7 @@ class ModuleInfo
305305
return AsciiString::TheEmptyString;
306306
}
307307

308-
AsciiString getNthTag(Int i) const
308+
AsciiString getNthTag(size_t i) const
309309
{
310310
if (i >= 0 && i < m_info.size())
311311
{
@@ -314,7 +314,7 @@ class ModuleInfo
314314
return AsciiString::TheEmptyString;
315315
}
316316

317-
const ModuleData* getNthData(Int i) const
317+
const ModuleData* getNthData(size_t i) const
318318
{
319319
if (i >= 0 && i < m_info.size())
320320
{
@@ -333,7 +333,7 @@ class ModuleInfo
333333

334334
void setCopiedFromDefault(Bool v)
335335
{
336-
for (int i = 0; i < m_info.size(); i++)
336+
for (size_t i = 0; i < m_info.size(); i++)
337337
m_info[i].copiedFromDefault = v;
338338
}
339339

Generals/Code/GameEngine/Include/GameLogic/ObjectTypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ class ObjectTypes : public MemoryPoolObject,
7575
Bool isInSet(const ThingTemplate* objectType) const;
7676

7777
// Is the set empty?
78-
UnsignedInt getListSize(void) const { return m_objectTypes.size(); }
78+
size_t getListSize(void) const { return m_objectTypes.size(); }
7979

8080
// I'd like to loop through, please.
81-
AsciiString getNthInList( Int index ) const { return (index < getListSize()) ? m_objectTypes[index] : AsciiString::TheEmptyString; }
81+
AsciiString getNthInList( size_t index ) const { return (index < getListSize()) ? m_objectTypes[index] : AsciiString::TheEmptyString; }
8282

8383
// Prep two arrays for usage with Player::countObjectsByThingTemplate
8484
Int prepForPlayerCounting( std::vector<const ThingTemplate *>& templates, std::vector<Int>& counts);

GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ class ModuleInfo
289289
#if defined(_DEBUG) || defined(_INTERNAL)
290290
Bool containsPartialName(const char* n) const
291291
{
292-
for (int i = 0; i < m_info.size(); i++)
292+
for (size_t i = 0; i < m_info.size(); i++)
293293
if (strstr(m_info[i].first.str(), n) != NULL)
294294
return true;
295295
return false;
296296
}
297297
#endif
298298

299-
AsciiString getNthName(Int i) const
299+
AsciiString getNthName(size_t i) const
300300
{
301301
if (i >= 0 && i < m_info.size())
302302
{
@@ -305,7 +305,7 @@ class ModuleInfo
305305
return AsciiString::TheEmptyString;
306306
}
307307

308-
AsciiString getNthTag(Int i) const
308+
AsciiString getNthTag(size_t i) const
309309
{
310310
if (i >= 0 && i < m_info.size())
311311
{
@@ -314,7 +314,7 @@ class ModuleInfo
314314
return AsciiString::TheEmptyString;
315315
}
316316

317-
const ModuleData* getNthData(Int i) const
317+
const ModuleData* getNthData(size_t i) const
318318
{
319319
if (i >= 0 && i < m_info.size())
320320
{
@@ -333,7 +333,7 @@ class ModuleInfo
333333

334334
void setCopiedFromDefault(Bool v)
335335
{
336-
for (int i = 0; i < m_info.size(); i++)
336+
for (size_t i = 0; i < m_info.size(); i++)
337337
m_info[i].copiedFromDefault = v;
338338
}
339339

GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ inline Drawable* GameClient::findDrawableByID( const DrawableID id )
249249
//
250250
// return (*it).second;
251251

252-
if( (Int)id < m_drawableVector.size() )
253-
return m_drawableVector[(Int)id];
252+
if( (size_t)id < m_drawableVector.size() )
253+
return m_drawableVector[(size_t)id];
254254

255255
return NULL;
256256
}

GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ inline Object* GameLogic::findObjectByID( ObjectID id )
417417
// return NULL;
418418
//
419419
// return (*it).second;
420-
if( (Int)id < m_objVector.size() )
421-
return m_objVector[(Int)id];
420+
if( (size_t)id < m_objVector.size() )
421+
return m_objVector[(size_t)id];
422422

423423
return NULL;
424424
}

GeneralsMD/Code/GameEngine/Include/GameLogic/ObjectTypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ class ObjectTypes : public MemoryPoolObject,
7575
Bool isInSet(const ThingTemplate* objectType) const;
7676

7777
// Is the set empty?
78-
UnsignedInt getListSize(void) const { return m_objectTypes.size(); }
78+
size_t getListSize(void) const { return m_objectTypes.size(); }
7979

8080
// I'd like to loop through, please.
81-
AsciiString getNthInList( Int index ) const { return (index < getListSize()) ? m_objectTypes[index] : AsciiString::TheEmptyString; }
81+
AsciiString getNthInList( size_t index ) const { return (index < getListSize()) ? m_objectTypes[index] : AsciiString::TheEmptyString; }
8282

8383
// Prep two arrays for usage with Player::countObjectsByThingTemplate
8484
Int prepForPlayerCounting( std::vector<const ThingTemplate *>& templates, std::vector<Int>& counts);

0 commit comments

Comments
 (0)