---- /dev/humancontroller  ---- 816b2d4 fix a bunch of compiler warnings diff --git src/cgame/cg_mem.c src/cgame/cg_mem.c index 6cf5ddd..7959ae4 100644 --- src/cgame/cg_mem.c +++ src/cgame/cg_mem.c @@ -48,7 +48,7 @@ void *CG_Alloc( int size ) char *endptr; int *ptr; - allocsize = ( size + sizeof(int) + ROUNDBITS ) & ~ROUNDBITS; // Round to 32-byte boundary + allocsize = (int)( (unsigned)size + (unsigned)sizeof(int) + (unsigned)ROUNDBITS ) & ~(unsigned)ROUNDBITS; // Round to 32-byte boundary ptr = NULL; smallest = NULL; diff --git src/game/g_admin.c src/game/g_admin.c index a519272..c6fbd2d 100644 --- src/game/g_admin.c +++ src/game/g_admin.c @@ -1029,8 +1029,8 @@ static int admin_listadmins( gentity_t *ent, int start, char *search, int minlev { G_DecolorString( g_admin_levels[ j ]->name, lname ); Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is", - ( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) - - strlen( lname ) ) ); + ( admin_level_maxname + (int)( strlen( g_admin_levels[ j ]->name ) + - strlen( lname ) ) ) ); Com_sprintf( lname, sizeof( lname ), lname_fmt, g_admin_levels[ j ]->name ); break; @@ -1086,8 +1086,8 @@ static int admin_listadmins( gentity_t *ent, int start, char *search, int minlev { G_DecolorString( g_admin_levels[ j ]->name, lname ); Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is", - ( admin_level_maxname + strlen( g_admin_levels[ j ]->name ) - - strlen( lname ) ) ); + ( admin_level_maxname + (int)( strlen( g_admin_levels[ j ]->name ) + - strlen( lname ) ) ) ); Com_sprintf( lname, sizeof( lname ), lname_fmt, g_admin_levels[ j ]->name ); break; @@ -3317,7 +3317,7 @@ qboolean G_admin_listplayers( gentity_t *ent, int skiparg ) { G_DecolorString( lname, lname2 ); Com_sprintf( lname_fmt, sizeof( lname_fmt ), "%%%is", - ( admin_level_maxname + strlen( lname ) - strlen( lname2 ) ) ); + ( admin_level_maxname + (int)( strlen( lname ) - strlen( lname2 ) ) ) ); Com_sprintf( lname2, sizeof( lname2 ), lname_fmt, lname ); } break; @@ -3630,12 +3630,12 @@ qboolean G_admin_showbans( gentity_t *ent, int skiparg ) G_DecolorString( g_admin_bans[ i ]->name, n1 ); Com_sprintf( name_fmt, sizeof( name_fmt ), "%%%is", - ( max_name + strlen( g_admin_bans[ i ]->name ) - strlen( n1 ) ) ); + ( max_name + (int)( strlen( g_admin_bans[ i ]->name ) - strlen( n1 ) ) ) ); Com_sprintf( n1, sizeof( n1 ), name_fmt, g_admin_bans[ i ]->name ); G_DecolorString( g_admin_bans[ i ]->banner, n2 ); Com_sprintf( banner_fmt, sizeof( banner_fmt ), "%%%is", - ( max_banner + strlen( g_admin_bans[ i ]->banner ) - strlen( n2 ) ) ); + ( max_banner + (int)( strlen( g_admin_bans[ i ]->banner ) - strlen( n2 ) ) ) ); Com_sprintf( n2, sizeof( n2 ), banner_fmt, g_admin_bans[ i ]->banner ); ADMBP( va( "%4i %s^7 %-15s %-8s %s^7 %-10s\n \\__ %s\n", @@ -3987,7 +3987,7 @@ qboolean G_admin_register(gentity_t *ent, int skiparg ){ return qfalse; } - trap_SendConsoleCommand( EXEC_APPEND,va( "!setlevel %d %d;",ent - g_entities, level) ); + trap_SendConsoleCommand( EXEC_APPEND,va( "!setlevel %d %d;", (int)(ent - g_entities), level) ); ClientUserinfoChanged( ent - g_entities ); AP( va( "print \"^3!register: ^7%s^7 is now a protected nickname.\n\"", ent->client->pers.netname) ); @@ -4783,7 +4783,7 @@ qboolean G_admin_revert( gentity_t *ent, int skiparg ) Com_sprintf( argbuf, sizeof argbuf, "%s%s%s%s%s%s%s!", ( repeat > 1 ) ? "x" : "", ( repeat > 1 ) ? va( "%d ", repeat ) : "", ( ID ) ? "#" : "", ( ID ) ? va( "%d ", ptr->ID ) : "", - ( builder ) ? "-" : "", ( builder ) ? va( "%d ", builder - g_entities ) : "", + ( builder ) ? "-" : "", ( builder ) ? va( "%d ", (int)(builder - g_entities) ) : "", ( team == PTE_ALIENS ) ? "a " : ( team == PTE_HUMANS ) ? "h " : "" ); ADMP( va( "^3!revert: ^7revert aborted: reverting this %s would conflict with " "another buildable, use ^3!revert %s ^7to override\n", action, argbuf ) ); @@ -4811,7 +4811,7 @@ qboolean G_admin_revert( gentity_t *ent, int skiparg ) Com_sprintf( argbuf, sizeof argbuf, "%s%s%s%s%s%s%s!", ( repeat > 1 ) ? "x" : "", ( repeat > 1 ) ? va( "%d ", repeat ) : "", ( ID ) ? "#" : "", ( ID ) ? va( "%d ", ptr->ID ) : "", - ( builder ) ? "-" : "", ( builder ) ? va( "%d ", builder - g_entities ) : "", + ( builder ) ? "-" : "", ( builder ) ? va( "%d ", (int)(builder - g_entities) ) : "", ( team == PTE_ALIENS ) ? "a " : ( team == PTE_HUMANS ) ? "h " : "" ); ADMP( va( "^3!revert: ^7revert aborted: reverting this %s would " "conflict with another buildable, use ^3!revert %s ^7to override\n", diff --git src/game/g_cmds.c src/game/g_cmds.c index 7ab77aa..296b6f0 100644 --- src/game/g_cmds.c +++ src/game/g_cmds.c @@ -5443,7 +5443,7 @@ void G_PrivateMessage( gentity_t *ent ) matches, color, msg, - ent ? ent-g_entities : -1 ) ); + ent ? (int)(ent-g_entities) : -1 ) ); trap_SendServerCommand( pids[ i ], va( "cp \"^%cprivate message from ^7%s^7\"", color, diff --git src/game/g_local.h src/game/g_local.h index 6e6dffd..a36522b 100644 --- src/game/g_local.h +++ src/game/g_local.h @@ -1400,7 +1400,7 @@ connectionRecord_t *G_FindConnectionForCode( int code ); extern level_locals_t level; extern gentity_t g_entities[ MAX_GENTITIES ]; -#define FOFS(x) ((int)&(((gentity_t *)0)->x)) +#define FOFS(x) ((int)(size_t)&(((gentity_t *)0)->x)) extern vmCvar_t g_dedicated; extern vmCvar_t g_cheats; diff --git src/game/g_mem.c src/game/g_mem.c index 6935194..a16c4c8 100644 --- src/game/g_mem.c +++ src/game/g_mem.c @@ -48,7 +48,7 @@ void *G_Alloc( int size ) char *endptr; int *ptr; - allocsize = ( size + sizeof(int) + ROUNDBITS ) & ~ROUNDBITS; // Round to 32-byte boundary + allocsize = (int)( (unsigned)size + (unsigned)sizeof(int) + (unsigned)ROUNDBITS ) & ~(unsigned)ROUNDBITS; // Round to 32-byte boundary ptr = NULL; smallest = NULL; diff --git src/game/g_session.c src/game/g_session.c index ae6c9a3..5db4604 100644 --- src/game/g_session.c +++ src/game/g_session.c @@ -58,7 +58,7 @@ void G_WriteClientSessionData( gclient_t *client ) BG_ClientListString( &client->sess.ignoreList ) ); - var = va( "session%i", client - level.clients ); + var = va( "session%i", (int)(client - level.clients) ); trap_Cvar_Set( var, s ); } @@ -81,7 +81,7 @@ void G_ReadSessionData( gclient_t *client ) int sessionTeam; int restartTeam; - var = va( "session%i", client - level.clients ); + var = va( "session%i", (int)(client - level.clients) ); trap_Cvar_VariableStringBuffer( var, s, sizeof(s) ); // FIXME: should be using BG_ClientListParse() for ignoreList, but diff --git src/tools/lcc/cpp/tokens.c src/tools/lcc/cpp/tokens.c index 147569b..8013518 100644 --- src/tools/lcc/cpp/tokens.c +++ src/tools/lcc/cpp/tokens.c @@ -267,7 +267,7 @@ peektokens(Tokenrow *trp, char *str) if (str) fprintf(stderr, "%s ", str); if (tpbp || tp>trp->lp) - fprintf(stderr, "(tp offset %d) ", tp-trp->bp); + fprintf(stderr, "(tp offset %d) ", (int)(tp-trp->bp)); for (tp=trp->bp; tplp && tpbp+32; tp++) { if (tp->type!=NL) { int c = tp->t[tp->len]; diff --git src/ui/ui_players.c src/ui/ui_players.c index 5dbfdd3..acf14b5 100644 --- src/ui/ui_players.c +++ src/ui/ui_players.c @@ -1194,7 +1194,7 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName } } - if (headModelName && headModelName[0] == '*' ) { + if (headModelName[0] == '*' ) { Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headModelName[1], &headModelName[1] ); } else {