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

View file

@ -863,11 +863,11 @@ Class * Archiver::ReadObject( void )
if ( !fileerror ) if ( !fileerror )
{ {
endpos = readfile.Pos(); endpos = readfile.Pos();
if ( ( endpos - objstart ) > size ) if ( ( endpos - objstart ) > (long)size )
{ {
FileError( "Object read past end of object's data" ); 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" ); FileError( "Object didn't read entire data from file" );
} }
@ -945,11 +945,11 @@ void Archiver::ArchiveObject( Class *obj )
if ( !fileerror ) if ( !fileerror )
{ {
endpos = readfile.Pos(); endpos = readfile.Pos();
if ( ( endpos - objstart ) > size ) if ( ( endpos - objstart ) > (long)size )
{ {
FileError( "Object read past end of object's data" ); 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" ); 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; //Event *ev;
bool autoSwitchWeapons; bool autoSwitchWeapons;
char tempName[ MAX_NETNAME ]; char tempName[ MAX_NETNAME ];
int i;
bool validName; bool validName;
try try
@ -1904,7 +1903,7 @@ extern "C" void G_ClientUserinfoChanged( gentity_t *ent, const char *userinfo )
validName = false; 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' ) ) 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 // 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 ] == ':' ) if ( ent->client->pers.netname[ i ] == ':' )
{ {

View file

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

View file

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

View file

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

View file

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

View file

@ -110,7 +110,7 @@ bool ModeTeamBase::isEndOfMatch( void )
for (int idx=1; idx <= _teamList.NumObjects(); idx++) for (int idx=1; idx <= _teamList.NumObjects(); idx++)
{ {
Team* team = _teamList.ObjectAt(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 ); 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 string[1400];
char entry[1024]; char entry[1024];
int i;
int tempStringlength; int tempStringlength;
int count = 0; int count = 0;
int stringlength = 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. // 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 ); currentPlayer = multiplayerManager.getPlayer( i );

View file

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

View file

@ -32,7 +32,7 @@
#ifdef _WIN32 #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 : 4032) // formal parameter 'number' has different type when promoted
#pragma warning(disable : 4051) // type conversion, possible loss of data #pragma warning(disable : 4051) // type conversion, possible loss of data
#pragma warning(disable : 4057) // slightly different base types #pragma warning(disable : 4057) // slightly different base types

View file

@ -664,11 +664,10 @@ char *Script::EvaluateMacroString( const char *theMacroString )
static char evalText[255]; static char evalText[255];
char buffer[255], *bufferptr = buffer, oper = '+', newoper = '+'; char buffer[255], *bufferptr = buffer, oper = '+', newoper = '+';
bool haveoper = false; bool haveoper = false;
int i;
float value = 0.0f, val = 0.0f; float value = 0.0f, val = 0.0f;
memset(buffer, 0, 255); 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 = '+'; }
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 ); int state_len = strlen( cs );
// Animation in tik file is longer than the state machine's anim // 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 if ( c[state_len] != '_' ) // If next character is an '_' then no match
{ {