Skip to content

Commit 84f902f

Browse files
authored
[GEN][ZH] Fix compiler warnings for signed/unsigned mismatch of loop indices (#804)
1 parent ce9d3d7 commit 84f902f

File tree

79 files changed

+149
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+149
-149
lines changed

Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ void PointGroupClass::RenderVolumeParticle(RenderInfoClass &rinfo, unsigned int
16951695

16961696

16971697
//// VOLUME_PARTICLE LOOP ///////////////
1698-
for ( int t = 0; t < depth; ++t )
1698+
for ( unsigned int t = 0; t < depth; ++t )
16991699
{
17001700

17011701

Generals/Code/GameEngine/Source/Common/PartitionSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void PartitionSolver::solve(void)
7777

7878
Int minSizeForAllData = 0;
7979
Int slotsAllotted = 0;
80-
Int i, j;
80+
size_t i, j;
8181

8282
// first, determine whether there is an actual solution, or we're going to have to fudge it.
8383
for (i = 0; i < m_data.size(); ++i) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void ProductionPrerequisite::init()
8080
//=============================================================================
8181
void ProductionPrerequisite::resolveNames()
8282
{
83-
for (Int i = 0; i < m_prereqUnits.size(); i++)
83+
for (size_t i = 0; i < m_prereqUnits.size(); i++)
8484
{
8585

8686
//
@@ -118,7 +118,7 @@ Int ProductionPrerequisite::calcNumPrereqUnitsOwned(const Player *player, Int co
118118
Int ProductionPrerequisite::getAllPossibleBuildFacilityTemplates(const ThingTemplate* tmpls[], Int maxtmpls) const
119119
{
120120
Int count = 0;
121-
for (int i = 0; i < m_prereqUnits.size(); i++)
121+
for (size_t i = 0; i < m_prereqUnits.size(); i++)
122122
{
123123
if (i > 0 && !(m_prereqUnits[i].flags & UNIT_OR_WITH_PREV))
124124
break;
@@ -213,7 +213,7 @@ void ProductionPrerequisite::addUnitPrereq( AsciiString unit, Bool orUnitWithPre
213213
void ProductionPrerequisite::addUnitPrereq( const std::vector<AsciiString>& units )
214214
{
215215
Bool orWithPrevious = false;
216-
for (int i = 0; i < units.size(); ++i)
216+
for (size_t i = 0; i < units.size(); ++i)
217217
{
218218
addUnitPrereq(units[i], orWithPrevious);
219219
orWithPrevious = true;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ SpecialPowerStore::~SpecialPowerStore( void )
225225
{
226226

227227
// delete all templates
228-
for( Int i = 0; i < m_specialPowerTemplates.size(); ++i )
228+
for( size_t i = 0; i < m_specialPowerTemplates.size(); ++i )
229229
deleteInstance(m_specialPowerTemplates[ i ]);
230230

231231
// erase the list
@@ -242,7 +242,7 @@ SpecialPowerTemplate* SpecialPowerStore::findSpecialPowerTemplatePrivate( AsciiS
242242
{
243243

244244
// search the template list for matching name
245-
for( Int i = 0; i < m_specialPowerTemplates.size(); ++i )
245+
for( size_t i = 0; i < m_specialPowerTemplates.size(); ++i )
246246
if( m_specialPowerTemplates[ i ]->getName() == name )
247247
return m_specialPowerTemplates[ i ];
248248

@@ -257,7 +257,7 @@ const SpecialPowerTemplate *SpecialPowerStore::findSpecialPowerTemplateByID( Uns
257257
{
258258

259259
// search the template list for matching name
260-
for( Int i = 0; i < m_specialPowerTemplates.size(); ++i )
260+
for( size_t i = 0; i < m_specialPowerTemplates.size(); ++i )
261261
if( m_specialPowerTemplates[ i ]->getID() == id )
262262
return m_specialPowerTemplates[ i ];
263263

Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static void findHighFileNumber( AsciiString filename, void *userData )
413413

414414
// strip off the extension at the end of the filename
415415
AsciiString nameOnly = filename;
416-
for( Int count = 0; count < strlen( SAVE_GAME_EXTENSION ); count++ )
416+
for( size_t count = 0; count < strlen( SAVE_GAME_EXTENSION ); count++ )
417417
nameOnly.removeLastChar();
418418

419419
// convert filename (which is only numbers) to a number

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3309,7 +3309,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)
33093309
//button specifying a vector of sciences in the command button.
33103310
Int bestIndex = -1;
33113311
ScienceType science;
3312-
for( Int scienceIndex = 0; scienceIndex < commandButton->getScienceVec().size(); ++scienceIndex )
3312+
for( size_t scienceIndex = 0; scienceIndex < commandButton->getScienceVec().size(); ++scienceIndex )
33133313
{
33143314
science = commandButton->getScienceVec()[ scienceIndex ];
33153315

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void ControlBar::populateCommand( Object *obj )
364364
//button specifying a vector of sciences in the command button.
365365
Int bestIndex = -1;
366366
ScienceType science;
367-
for( Int scienceIndex = 0; scienceIndex < commandButton->getScienceVec().size(); ++scienceIndex )
367+
for( size_t scienceIndex = 0; scienceIndex < commandButton->getScienceVec().size(); ++scienceIndex )
368368
{
369369
science = commandButton->getScienceVec()[ scienceIndex ];
370370

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control,
699699

700700
ScienceType st = SCIENCE_INVALID;
701701
Player *player = ThePlayerList->getLocalPlayer();
702-
for(Int i = 0; i < commandButton->getScienceVec().size(); ++i)
702+
for(size_t i = 0; i < commandButton->getScienceVec().size(); ++i)
703703
{
704704
st = commandButton->getScienceVec()[ i ];
705705
if(!player->hasScience(st) && TheScienceStore->playerHasPrereqsForScience(player, st) && TheScienceStore->getSciencePurchaseCost(st) <= player->getSciencePurchasePoints())

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
266266
ScienceType st = SCIENCE_INVALID;
267267
if(commandButton->getScienceVec().size() > 1)
268268
{
269-
for(Int j = 0; j < commandButton->getScienceVec().size(); ++j)
269+
for(size_t j = 0; j < commandButton->getScienceVec().size(); ++j)
270270
{
271271
st = commandButton->getScienceVec()[ j ];
272272

Generals/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ GameClient::~GameClient()
213213
TheVideoPlayer = NULL;
214214

215215
// destroy all translators
216-
for( Int i = 0; i < m_numTranslators; i++ )
216+
for( UnsignedInt i = 0; i < m_numTranslators; i++ )
217217
TheMessageStream->removeTranslator( m_translators[ i ] );
218218
m_numTranslators = 0;
219219
m_commandTranslator = NULL;
@@ -1079,7 +1079,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay )
10791079

10801080
GlobalMemoryStatus(&before);
10811081
extern std::vector<AsciiString> debrisModelNamesGlobalHack;
1082-
Int i=0;
1082+
size_t i=0;
10831083
for (; i<debrisModelNamesGlobalHack.size(); ++i)
10841084
{
10851085
TheDisplay->preloadModelAssets(debrisModelNamesGlobalHack[i]);

0 commit comments

Comments
 (0)