add -Wsign-compare (default for -Wall only in C++) and fix up the warnings

This commit is contained in:
Bill Currie 2004-07-13 19:14:01 +00:00
parent db112dd83f
commit ca46503607
13 changed files with 24 additions and 19 deletions

View file

@ -1409,6 +1409,7 @@ if test "x$optimize" = xyes; then
CFLAGS="" CFLAGS=""
QF_CC_OPTION(-frename-registers) QF_CC_OPTION(-frename-registers)
QF_CC_OPTION(-finline-limit=32000 -Winline) QF_CC_OPTION(-finline-limit=32000 -Winline)
QF_CC_OPTION(-Wsign-compare)
heavy="-O2 $CFLAGS -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations" heavy="-O2 $CFLAGS -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
CFLAGS="$saved_cflags" CFLAGS="$saved_cflags"
light="-O2" light="-O2"

View file

@ -719,7 +719,7 @@ GIB_Text_From_Decimal_f (void)
if (GIB_Argc () < 2) if (GIB_Argc () < 2)
GIB_USAGE ("num1 [...]"); GIB_USAGE ("num1 [...]");
else if (GIB_CanReturn ()) { else if (GIB_CanReturn ()) {
unsigned int i; int i;
dstring_t *dstr; dstring_t *dstr;
char *str; char *str;

View file

@ -192,11 +192,11 @@ LoadPNG (QFile *infile)
void void
WritePNG (const char *fileName, byte *data, int width, int height) WritePNG (const char *fileName, byte *data, int width, int height)
{ {
QFile *outfile; QFile *outfile;
png_uint_32 i; int i;
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr; png_infop info_ptr;
png_bytepp row_pointers = NULL; png_bytepp row_pointers = NULL;
/* initialize write struct */ /* initialize write struct */
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);

View file

@ -54,7 +54,7 @@ static void (*init_funcs[])(progs_t *, int) = {
void void
RUA_Init (progs_t *pr, int secure) RUA_Init (progs_t *pr, int secure)
{ {
int i; size_t i;
PR_Resources_Init (pr); PR_Resources_Init (pr);
for (i = 0; i < sizeof (init_funcs) / sizeof (init_funcs[0]); i++) for (i = 0; i < sizeof (init_funcs) / sizeof (init_funcs[0]); i++)

View file

@ -114,7 +114,8 @@ static inline void
R_AddDynamicLights_1 (msurface_t *surf) R_AddDynamicLights_1 (msurface_t *surf)
{ {
float dist; float dist;
int maxdist, maxdist2, maxdist3, smax, smax_bytes, tmax, unsigned int maxdist, maxdist2, maxdist3;
int smax, smax_bytes, tmax,
grey, s, t; grey, s, t;
unsigned int lnum, td, i, j; unsigned int lnum, td, i, j;
unsigned int sdtable[18]; unsigned int sdtable[18];
@ -178,7 +179,8 @@ static inline void
R_AddDynamicLights_3 (msurface_t *surf) R_AddDynamicLights_3 (msurface_t *surf)
{ {
float dist; float dist;
int maxdist, maxdist2, maxdist3, smax, smax_bytes, tmax, unsigned int maxdist, maxdist2, maxdist3;
int smax, smax_bytes, tmax,
red, green, blue, s, t; red, green, blue, s, t;
unsigned int lnum, td, i, j; unsigned int lnum, td, i, j;
unsigned int sdtable[18]; unsigned int sdtable[18];

View file

@ -442,7 +442,7 @@ ucmds_getkey (void *_a, void *unused)
void void
Client_Init (void) Client_Init (void)
{ {
int i; size_t i;
ucmd_table = Hash_NewTable (251, ucmds_getkey, 0, 0); ucmd_table = Hash_NewTable (251, ucmds_getkey, 0, 0);
for (i = 0; i < sizeof (ucmds) / sizeof (ucmds[0]); i++) for (i = 0; i < sizeof (ucmds) / sizeof (ucmds[0]); i++)

View file

@ -134,7 +134,7 @@ void
qtv_flush_redirect (void) qtv_flush_redirect (void)
{ {
char send[8000 + 6]; char send[8000 + 6];
int count; size_t count;
int bytes; int bytes;
const char *p; const char *p;

View file

@ -544,7 +544,7 @@ qwe_user_cmd (void)
static int static int
qwe_load (progs_t * pr) qwe_load (progs_t * pr)
{ {
int i; size_t i;
for (i = 0; i < sizeof (qwe_func_list) / sizeof (qwe_func_list[0]); i++) { for (i = 0; i < sizeof (qwe_func_list) / sizeof (qwe_func_list[0]); i++) {
dfunction_t *f = ED_FindFunction (pr, qwe_func_list[i].name); dfunction_t *f = ED_FindFunction (pr, qwe_func_list[i].name);

View file

@ -72,7 +72,7 @@ static void
SV_FlushRedirect (void) SV_FlushRedirect (void)
{ {
char send[8000 + 6]; char send[8000 + 6];
int count; size_t count;
int bytes; int bytes;
const char *p; const char *p;

View file

@ -571,7 +571,8 @@ static void
SV_NextDownload_f (void *unused) SV_NextDownload_f (void *unused)
{ {
byte buffer[768]; // FIXME protocol limit? could be bigger? byte buffer[768]; // FIXME protocol limit? could be bigger?
int percent, size, r; int percent, size;
size_t r;
if (!host_client->download) if (!host_client->download)
return; return;

View file

@ -842,9 +842,10 @@ undefined_def (qfo_def_t *def)
line = lines.lines + best->line_info; line = lines.lines + best->line_info;
line_def.file = best->file; line_def.file = best->file;
line_def.line = best->line; line_def.line = best->line;
if (!line->line && line->fa.func == best - funcs.funcs) { if (!line->line
&& line->fa.func == (unsigned int) (best - funcs.funcs)) {
while (line - lines.lines < lines.num_lines - 1 && line[1].line while (line - lines.lines < lines.num_lines - 1 && line[1].line
&& line[1].fa.addr <= reloc->ofs) && line[1].fa.addr <= (unsigned int) reloc->ofs)
line++; line++;
line_def.line = line->line + best->line; line_def.line = line->line + best->line;
} }

View file

@ -416,14 +416,14 @@ DecodeArgs (int argc, char **argv)
options.traditional = true; options.traditional = true;
options.advanced = false; options.advanced = false;
options.code.progsversion = PROG_ID_VERSION; options.code.progsversion = PROG_ID_VERSION;
if (options.code.short_circuit == -1) if (options.code.short_circuit == (qboolean) -1)
options.code.short_circuit = false; options.code.short_circuit = false;
} }
if (!options.traditional) { if (!options.traditional) {
options.advanced = true; options.advanced = true;
add_cpp_def ("-D__RUAMOKO__=1"); add_cpp_def ("-D__RUAMOKO__=1");
add_cpp_def ("-D__RAUMOKO__=1"); add_cpp_def ("-D__RAUMOKO__=1");
if (options.code.short_circuit == -1) if (options.code.short_circuit == (qboolean) -1)
options.code.short_circuit = true; options.code.short_circuit = true;
} }
if (options.code.progsversion == PROG_ID_VERSION) if (options.code.progsversion == PROG_ID_VERSION)

View file

@ -264,7 +264,7 @@ wad_extract (wad_t *wad, lumpinfo_t *pf)
case TYP_PALETTE: case TYP_PALETTE:
count = 768; count = 768;
memset (buffer, 0, count); memset (buffer, 0, count);
if (count > pf->size) if ((int) count > pf->size)
count = pf->size; count = pf->size;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
buffer[i + 768] = i; buffer[i + 768] = i;