Windows: Fixed all signed/unsigned mismatches

This commit is contained in:
Walter Julius Hennecke 2012-12-31 13:37:16 +01:00
parent 1b1550fff8
commit 1cb7700134
15 changed files with 40 additions and 62 deletions

View File

@ -443,7 +443,7 @@ void HTMLDocFileOutput::OutputEvent(Event *ev)
if ( text )
{
char new_doc[1024];
int old_index;
unsigned old_index;
int new_index = 0;
for ( old_index = 0 ; old_index < strlen ( text ) ; old_index++ )
@ -701,7 +701,7 @@ void ToolDocFileOutput::OutputEvent(Event *ev)
{
int numargs;
const char *text;
int i;
unsigned i;
fprintf(fileptr, "\n");
fprintf(fileptr, "\t%s\n", ev->getName() );

View File

@ -863,11 +863,11 @@ Class * Archiver::ReadObject( void )
if ( !fileerror )
{
endpos = readfile.Pos();
if ( ( endpos - objstart ) > size )
if ( ( endpos - objstart ) > (long)size )
{
FileError( "Object read past end of object's data" );
}
else if ( ( endpos - objstart ) < size )
else if ( ( endpos - objstart ) < (long)size )
{
FileError( "Object didn't read entire data from file" );
}
@ -945,11 +945,11 @@ void Archiver::ArchiveObject( Class *obj )
if ( !fileerror )
{
endpos = readfile.Pos();
if ( ( endpos - objstart ) > size )
if ( ( endpos - objstart ) > (long)size )
{
FileError( "Object read past end of object's data" );
}
else if ( ( endpos - objstart ) < size )
else if ( ( endpos - objstart ) < (long)size )
{
FileError( "Object didn't read entire data from file" );
}

View File

@ -1867,7 +1867,6 @@ extern "C" void G_ClientUserinfoChanged( gentity_t *ent, const char *userinfo )
//Event *ev;
bool autoSwitchWeapons;
char tempName[ MAX_NETNAME ];
int i;
bool validName;
try
@ -1904,7 +1903,7 @@ extern "C" void G_ClientUserinfoChanged( gentity_t *ent, const char *userinfo )
validName = false;
for ( i = 0 ; i < strlen( tempName ) ; i++ )
for ( unsigned i = 0 ; i < strlen( tempName ) ; i++ )
{
if ( ( tempName[ i ] == '^' ) && ( tempName[ i + 1 ] >= '0' ) && ( tempName[ i + 1 ] <= '9' ) )
{
@ -1930,7 +1929,7 @@ extern "C" void G_ClientUserinfoChanged( gentity_t *ent, const char *userinfo )
// Strip out bad characters
for ( i = 0 ; i < strlen( ent->client->pers.netname ) ; i++ )
for ( unsigned i = 0 ; i < strlen( ent->client->pers.netname ) ; i++ )
{
if ( ent->client->pers.netname[ i ] == ':' )
{

View File

@ -917,7 +917,7 @@ qboolean G_SendCommandToAllPlayers( const char *command )
{
bool retVal = true ;
for( unsigned int clientIdx = 0; clientIdx < maxclients->integer; ++clientIdx )
for( int clientIdx = 0; clientIdx < maxclients->integer; ++clientIdx )
{
gentity_t *ent = g_entities + clientIdx ;
if ( !ent->inuse || !ent->client || !ent->entity ) continue;
@ -1007,8 +1007,7 @@ qboolean G_SetWidgetTextOfPlayer( const gentity_t *ent, const char *widgetName,
strcpy(tmpstr, widgetText);
int i;
for ( i=0; i<strlen(widgetText); i++ )
for ( unsigned i = 0; i < strlen(widgetText); i++ )
{
if ( tmpstr[i] == '\n' )
tmpstr[i] = '~';

View File

@ -663,7 +663,7 @@ void EventArgDef::Setup( const char *eventName, const char *argName, const char
qboolean second;
// one or two parameters
// see if there is anything behind the ','
if ( strlen( scratch ) > ( tokptr - scratch + 1) )
if ( (int)strlen( scratch ) > ( tokptr - scratch + 1) )
second = true;
else
second = false;
@ -1429,10 +1429,9 @@ void Event::PrintDocumentation( FILE *event_file, qboolean html )
if ( documentation )
{
char new_doc[1024];
int old_index;
int new_index = 0;
for ( old_index = 0 ; old_index < strlen ( documentation ) ; old_index++ )
for ( unsigned old_index = 0 ; old_index < strlen ( documentation ) ; old_index++ )
{
if ( documentation[old_index] == '\n' )
{
@ -2860,7 +2859,7 @@ void Event::SetConsoleEdict( const gentity_t *consoleedict )
gentity_t *Event::GetConsoleEdict( void )
{
// linenumber does double duty in the case of the console commands
if ( ( info.source != EV_FROM_CONSOLE ) || ( info.linenumber >= game.maxclients ) )
if ( ( info.source != EV_FROM_CONSOLE ) || ( game.maxclients && (info.linenumber >= (unsigned)game.maxclients )) )
{
// default to player 1 for release
return &g_entities[ 0 ];

View File

@ -178,9 +178,7 @@ void MultiplayerModeBase::initItems( void )
int MultiplayerModeBase::findPlayer( const Player *player )
{
int i;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( _playerGameData[ i ]._playing && _playerGameData[ i ]._entnum == player->entnum )
return i;
@ -341,13 +339,11 @@ void MultiplayerModeBase::update( float frameTime )
//================================================================
bool MultiplayerModeBase::isEndOfMatch( void )
{
int i;
// See if we have a gone over the point limit
if ( getPointLimit() > 0 )
{
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( _playerGameData[ i ]._playing )
{
@ -445,7 +441,6 @@ void MultiplayerModeBase::obituary( Player *killedPlayer, Player *attackingPlaye
str printString;
bool suicide;
bool printSomething;
int i;
char color;
bool sameTeam;
@ -660,7 +655,7 @@ void MultiplayerModeBase::obituary( Player *killedPlayer, Player *attackingPlaye
// Print to all of the players
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
currentPlayer = multiplayerManager.getPlayer( i );
@ -909,7 +904,6 @@ bool MultiplayerModeBase::shouldStartMatch( void )
{
int timeRemaining;
int numPlayers;
int i;
if ( _gameStarted )
return false;
@ -961,7 +955,7 @@ bool MultiplayerModeBase::shouldStartMatch( void )
numPlayers = 0;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( _playerGameData[ i ]._playing )
{
@ -980,7 +974,6 @@ int MultiplayerModeBase::getStat( Player *player, int statNum, int value )
if ( statNum == STAT_MP_STATE )
{
int numPlayers;
int i;
Player *player;
if ( _gameStarted )
@ -998,7 +991,7 @@ int MultiplayerModeBase::getStat( Player *player, int statNum, int value )
numPlayers = 0;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
player = multiplayerManager.getPlayer( i );
@ -1018,7 +1011,6 @@ int MultiplayerModeBase::getStat( Player *player, int statNum, int value )
void MultiplayerModeBase::startMatch( void )
{
int i;
Player *player;
_gameStarted = true;
@ -1026,7 +1018,7 @@ void MultiplayerModeBase::startMatch( void )
// Make everyone not a spectator and spawn them into the world
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
player = getPlayer( i );
@ -1056,14 +1048,13 @@ void MultiplayerModeBase::restartMatch( void )
void MultiplayerModeBase::endMatch( void )
{
int i;
Player *player;
_gameStarted = false;
// Make everyone a spectator
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( _playerGameData[ i ]._playing )
{
@ -1082,7 +1073,7 @@ bool MultiplayerModeBase::inMatch( void )
return _gameStarted;
}
Player *MultiplayerModeBase::getPlayer( int entnum )
Player *MultiplayerModeBase::getPlayer( unsigned entnum )
{
// Make sure everything is ok
@ -1149,7 +1140,6 @@ void MultiplayerModeBase::score( const Player *player )
{
char string[1400];
char entry[1024];
int i;
int tempStringlength;
int count = 0;
int stringlength = 0;
@ -1168,7 +1158,7 @@ void MultiplayerModeBase::score( const Player *player )
// This for loop builds a string containing all the players scores.
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
currentPlayer = multiplayerManager.getPlayer( i );
@ -1465,12 +1455,11 @@ void MultiplayerModeBase::_endMatch()
void MultiplayerModeBase::declareWinner( void )
{
int i;
Player *player;
int place;
bool tied;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
player = getPlayer( i );
@ -1591,7 +1580,7 @@ Entity* MultiplayerModeBase::getRandomSpawnpoint( bool useCounter )
if ( useCounter )
{
if ( _spawncounter > numPoints )
if ( (int)_spawncounter > numPoints )
{
_spawncounter = 1; // reuse spawn points
}
@ -1888,11 +1877,10 @@ int MultiplayerModeBase::getPlace( Player *player, bool *tied )
{
int place = 1;
bool isTied = false;
int i;
Player *currentPlayer;
int scoreDiff;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
// Get this player and make sure everything is ok
@ -1929,10 +1917,9 @@ int MultiplayerModeBase::getPlace( Player *player, bool *tied )
int MultiplayerModeBase::getHighestPoints( void )
{
int i;
int highestPoints = -999999999;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( _playerGameData[ i ]._points > highestPoints )
{

View File

@ -125,7 +125,7 @@ class MultiplayerModeBase : public Class
void handleKill( Player *killedPlayer, Player *attackingPlayer, Entity *inflictor, int meansOfDeath, bool goodKill );
Player * getPlayer( int entnum );
Player * getPlayer( unsigned entnum );
public:
CLASS_PROTOTYPE( MultiplayerModeBase );

View File

@ -422,7 +422,6 @@ float ModeCaptureTheFlag::findNearestTeamFlagDist( const str &teamName, const Ve
float ModeCaptureTheFlag::findNearestTeamFlagCarrierDist( const str &teamName, const Vector &position )
{
int i;
Player *currentPlayer;
Player *nearestFlagCarrier = NULL;
float nearestDistance = -1.0f;
@ -432,7 +431,7 @@ float ModeCaptureTheFlag::findNearestTeamFlagCarrierDist( const str &teamName, c
// Go through all of the flags
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( !_playerGameData[ i ]._playing )
continue;
@ -935,7 +934,6 @@ void ModeCaptureTheFlag::score( const Player *player )
{
char string[1400];
char entry[1024];
int i;
int tempStringlength;
int count = 0;
int stringlength = 0;
@ -958,7 +956,7 @@ void ModeCaptureTheFlag::score( const Player *player )
// This for loop builds a string containing all the players scores.
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
currentPlayer = multiplayerManager.getPlayer( i );

View File

@ -180,10 +180,9 @@ bool ModeDeathmatch::checkGameType( const char *gameType )
int ModeDeathmatch::getHighestPoints( int entnum )
{
int i;
int highestPoints = -999999999;
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
if ( _playerGameData[ i ]._playing && ( _playerGameData[ i ]._entnum != entnum ) )
{
@ -207,7 +206,6 @@ bool ModeDeathmatch::checkRule( const char *rule, bool defaultValue, Player *pla
void ModeDeathmatch::update( float frameTime )
{
int i;
Player *player;
int place;
bool tied;
@ -218,7 +216,7 @@ void ModeDeathmatch::update( float frameTime )
if ( _gameStarted )
{
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
player = multiplayerManager.getPlayer( i );

View File

@ -110,7 +110,7 @@ bool ModeTeamBase::isEndOfMatch( void )
for (int idx=1; idx <= _teamList.NumObjects(); idx++)
{
Team* team = _teamList.ObjectAt(idx);
if (team->getDeaths() > getPointLimit())
if ((int)(team->getDeaths()) > getPointLimit())
{
multiplayerManager.centerPrintAllClients(va("$$%s$$ $$TeamLoses$$\n", team->getName().c_str() ), CENTERPRINT_IMPORTANCE_NORMAL );

View File

@ -144,7 +144,6 @@ void ModeTeamDeathmatch::score( const Player *player )
{
char string[1400];
char entry[1024];
int i;
int tempStringlength;
int count = 0;
int stringlength = 0;
@ -167,7 +166,7 @@ void ModeTeamDeathmatch::score( const Player *player )
// This for loop builds a string containing all the players scores.
for ( i = 0 ; i < _maxPlayers ; i++ )
for ( unsigned i = 0 ; i < _maxPlayers ; i++ )
{
currentPlayer = multiplayerManager.getPlayer( i );

View File

@ -714,9 +714,9 @@ void PathFinder<Heuristic>::PropagateDown
child = thePathManager.GetNode( path->targetNodeIndex );
movecost = g + heuristic.cost( node, c );
if ( movecost < child->g )
if ( (long)movecost < child->g )
{
child->g = movecost;
child->g = (long)movecost;
child->f = child->g + child->h;
child->Parent = node;
@ -739,9 +739,9 @@ void PathFinder<Heuristic>::PropagateDown
// we stop the propagation when the g value of the child is equal or better than
// the cost we're propagating
movecost = parent->g + path->moveCost;
if ( movecost < child->g )
if ( (long)movecost < child->g )
{
child->g = movecost;
child->g = (long)movecost;
child->f = child->g + child->h;
child->Parent = parent;
stack.Push( child );

View File

@ -32,7 +32,7 @@
#ifdef _WIN32
#pragma warning(disable : 4018) // signed/unsigned mismatch
//#pragma warning(disable : 4018) // signed/unsigned mismatch
//#pragma warning(disable : 4032) // formal parameter 'number' has different type when promoted
#pragma warning(disable : 4051) // type conversion, possible loss of data
#pragma warning(disable : 4057) // slightly different base types

View File

@ -664,11 +664,10 @@ char *Script::EvaluateMacroString( const char *theMacroString )
static char evalText[255];
char buffer[255], *bufferptr = buffer, oper = '+', newoper = '+';
bool haveoper = false;
int i;
float value = 0.0f, val = 0.0f;
memset(buffer, 0, 255);
for ( i=0;i<=strlen(theMacroString);i++ )
for ( unsigned i=0;i<=strlen(theMacroString);i++ )
{
if ( theMacroString[i] == '+' ) { haveoper = true; newoper = '+'; }
if ( theMacroString[i] == '-' ) { haveoper = true; newoper = '-'; }

View File

@ -4280,7 +4280,7 @@ void Sentient::CheckAnimations( Event *ev )
int state_len = strlen( cs );
// Animation in tik file is longer than the state machine's anim
if ( strlen( c ) > state_len )
if ( (int)strlen( c ) > state_len )
{
if ( c[state_len] != '_' ) // If next character is an '_' then no match
{