Change shift expressions to unsigned types. Shifting signed values to

a result that is not representable has undefined behaviour.
This commit is contained in:
Thomas Köppe 2018-01-16 16:04:17 +00:00 committed by Zack Middleton
parent 7e2aa2c627
commit ed1794fe17
6 changed files with 11 additions and 8 deletions

View file

@ -1539,7 +1539,7 @@ void CL_RequestMotd( void ) {
info[0] = 0;
Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", (int)((((unsigned int)rand() << 16) ^ (unsigned int)rand()) ^ Com_Milliseconds()));
Info_SetValueForKey( info, "challenge", cls.updateChallenge );
Info_SetValueForKey( info, "renderer", cls.glconfig.renderer_string );
@ -1768,7 +1768,7 @@ void CL_Connect_f( void ) {
clc.state = CA_CONNECTING;
// Set a client challenge number that ideally is mirrored back by the server.
clc.challenge = ((rand() << 16) ^ rand()) ^ Com_Milliseconds();
clc.challenge = (((unsigned int)rand() << 16) ^ (unsigned int)rand()) ^ Com_Milliseconds();
}
Key_SetCatcher( 0 );