From abe635cfd76366f8daee0e09d998369f6aa696d7 Mon Sep 17 00:00:00 2001 From: Joerg Mayer Date: Sat, 11 Nov 2000 00:38:37 +0000 Subject: [PATCH] Get rid of some warnings about unused variables, signed/unsigned comparisons and incomplete initializations. --- console/generic.c | 2 +- controls/button.c | 6 +++++- server/request.c | 8 +++++++- tools/bin2res.c | 2 +- tools/makedep.c | 2 +- tools/winebuild/parser.c | 2 +- tools/winebuild/res16.c | 3 ++- tools/winebuild/res32.c | 23 ++++++++++++----------- tools/winebuild/spec32.c | 4 ++-- tools/wmc/lang.c | 2 +- tools/wrc/dumpres.c | 2 +- tools/wrc/newstruc.c | 2 +- tools/wrc/newstruc.h | 2 +- tools/wrc/parser.y | 2 +- tools/wrc/readres.c | 2 +- tools/wrc/utils.c | 2 +- tools/wrc/wrctypes.h | 6 +++--- tools/wrc/writeres.c | 18 +++++++++--------- 18 files changed, 51 insertions(+), 39 deletions(-) diff --git a/console/generic.c b/console/generic.c index 5d3b9ba04cd..a12ac246c70 100644 --- a/console/generic.c +++ b/console/generic.c @@ -146,7 +146,7 @@ static void GENERIC_ClearLine(char row, char col1, char col2, int bgcolor, char x; - TRACE("Clear Line: %d from %d to %d.\n", row, col1, col2); + TRACE("Clear Line: %d from %d to %d (unused: bgcolor %d, attrib %d).\n", row, col1, col2, bgcolor, attribute); for (x = col1; x <= col2; x++) { diff --git a/controls/button.c b/controls/button.c index 560746bd2ee..39ab807ca82 100644 --- a/controls/button.c +++ b/controls/button.c @@ -541,7 +541,11 @@ static UINT BUTTON_CalcLabelRect(WND *wndPtr, HDC hdc, RECT *rc) */ static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy) { - RECT rc = {0, 0, cx, cy}; + RECT rc; + rc.left = 0; + rc.top = 0; + rc.right = cx; + rc.bottom = cy; DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp); return TRUE; diff --git a/server/request.c b/server/request.c index 083c6013f1b..f4c90fb33cf 100644 --- a/server/request.c +++ b/server/request.c @@ -78,7 +78,7 @@ static struct master_socket *master_socket; /* the master socket object */ /* socket communication static structures */ static struct iovec myiovec; -static struct msghdr msghdr = { NULL, 0, &myiovec, 1, /* remaining fields depend on system */ }; +static struct msghdr msghdr; #ifndef HAVE_MSGHDR_ACCRIGHTS struct cmsg_fd { @@ -388,6 +388,12 @@ void open_master_socket(void) fatal_error( "out of memory\n" ); set_select_events( &master_socket->obj, POLLIN ); + /* setup msghdr structure constant fields */ + msghdr.msg_name = NULL; + msghdr.msg_namelen = 0; + msghdr.msg_iov = &myiovec; + msghdr.msg_iovlen = 1; + /* go in the background */ switch(fork()) { diff --git a/tools/bin2res.c b/tools/bin2res.c index ed27db26c9c..63b1117e13c 100644 --- a/tools/bin2res.c +++ b/tools/bin2res.c @@ -102,7 +102,7 @@ void parse_options(int argc, char **argv) int insert_hex (char * infile, FILE * outfile) { - int i; + unsigned int i; int fd; struct stat st; diff --git a/tools/makedep.c b/tools/makedep.c index f29ca2726ea..ac26cfa5cd0 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -87,7 +87,7 @@ static char *xstrdup( const char *str ) static int is_generated( const char *name ) { static const char * const extensions[] = { ".tab.h", ".mc.rc" }; - int i, len = strlen(name); + size_t i, len = strlen(name); for (i = 0; i < sizeof(extensions)/sizeof(extensions[0]); i++) { if (len <= strlen(extensions[i])) continue; diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 958ecd7fffc..19085a434ce 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -183,7 +183,7 @@ static void ParseVariable( ORDDEF *odp ) static void ParseExportFunction( ORDDEF *odp ) { char *token; - int i; + unsigned int i; switch(SpecType) { diff --git a/tools/winebuild/res16.c b/tools/winebuild/res16.c index 0f369cc62bb..29c0c7e4939 100644 --- a/tools/winebuild/res16.c +++ b/tools/winebuild/res16.c @@ -244,7 +244,8 @@ int output_res16_data( FILE *outfile ) /* output the resource definitions */ int output_res16_directory( unsigned char *buffer ) { - int i, j, offset, res_offset = 0; + int i, offset, res_offset = 0; + unsigned int j; const struct res_type *type; const struct resource *res; unsigned char *start = buffer; diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c index 9cb10170212..f0e375026fe 100644 --- a/tools/winebuild/res32.c +++ b/tools/winebuild/res32.c @@ -265,6 +265,7 @@ static void output_string( FILE *outfile, const WCHAR *name ) int output_resources( FILE *outfile ) { int i, j, k; + unsigned int n; const struct res_type *type; const struct res_name *name; const struct resource *res; @@ -316,11 +317,11 @@ int output_resources( FILE *outfile ) { fprintf( outfile, " struct res_dir name_%d_dir;\n", i ); fprintf( outfile, " struct res_dir_entry name_%d_entries[%d];\n", i, type->nb_names ); - for (j = 0, name = type->names; j < type->nb_names; j++, name++) + for (n = 0, name = type->names; n < type->nb_names; n++, name++) { - fprintf( outfile, " struct res_dir lang_%d_%d_dir;\n", i, j ); + fprintf( outfile, " struct res_dir lang_%d_%d_dir;\n", i, n ); fprintf( outfile, " struct res_dir_entry lang_%d_%d_entries[%d];\n", - i, j, name->nb_languages ); + i, n, name->nb_languages ); } } @@ -331,11 +332,11 @@ int output_resources( FILE *outfile ) if (type->type->str) fprintf( outfile, " unsigned short type_%d_name[%d];\n", i, strlenW(type->type->str)+1 ); - for (j = 0, name = type->names; j < type->nb_names; j++, name++) + for (n = 0, name = type->names; n < type->nb_names; n++, name++) { if (name->name->str) fprintf( outfile, " unsigned short name_%d_%d_name[%d];\n", - i, j, strlenW(name->name->str)+1 ); + i, n, strlenW(name->name->str)+1 ); } } @@ -362,21 +363,21 @@ int output_resources( FILE *outfile ) { fprintf( outfile, " { 0, 0, 0, 0, %d, %d }, /* name_%d_dir */\n {\n", type->nb_names - type->nb_id_names, type->nb_id_names, i ); - for (j = 0, name = type->names; j < type->nb_names; j++, name++) + for (n = 0, name = type->names; n < type->nb_names; n++, name++) { if (!name->name->str) fprintf( outfile, " { 0x%04x, OFFSETOF(lang_%d_%d_dir) | 0x80000000 },\n", - name->name->id, i, j ); + name->name->id, i, n ); else fprintf( outfile, " { OFFSETOF(name_%d_%d_name) | 0x80000000, OFFSETOF(lang_%d_%d_dir) | 0x80000000 },\n", - i, j, i, j ); + i, n, i, n ); } fprintf( outfile, " },\n" ); - for (j = 0, name = type->names; j < type->nb_names; j++, name++) + for (n = 0, name = type->names; n < type->nb_names; n++, name++) { fprintf( outfile, " { 0, 0, 0, 0, 0, %d }, /* lang_%d_%d_dir */\n {\n", - name->nb_languages, i, j ); + name->nb_languages, i, n ); for (k = 0, res = name->res; k < name->nb_languages; k++, res++) { fprintf( outfile, " { 0x%04x, OFFSETOF(data_entries[%d]) },\n", @@ -401,7 +402,7 @@ int output_resources( FILE *outfile ) fprintf( outfile, " },\n { " ); output_string( outfile, type->type->str ); } - for (j = 0, name = type->names; j < type->nb_names; j++, name++) + for (n = 0, name = type->names; n < type->nb_names; n++, name++) { if (name->name->str) { diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 1d8c7ca062a..1629be61089 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -108,7 +108,7 @@ static int output_debug( FILE *outfile ) * * Output the export table for a Win32 module. */ -static void output_exports( FILE *outfile, int nr_exports, int nr_names, int fwd_size ) +static void output_exports( FILE *outfile, int nr_exports, int fwd_size ) { int i, fwd_pos = 0; @@ -454,7 +454,7 @@ void BuildSpec32File( FILE *outfile, int output_main ) /* Output the exports and relay entry points */ - output_exports( outfile, nr_exports, nb_names, fwd_size ); + output_exports( outfile, nr_exports, fwd_size ); /* Output the DLL imports */ diff --git a/tools/wmc/lang.c b/tools/wmc/lang.c index d5fe72e94d8..1b8b66ba068 100644 --- a/tools/wmc/lang.c +++ b/tools/wmc/lang.c @@ -111,7 +111,7 @@ static const language_t languages[] = { void show_languages(void) { - int i; + unsigned int i; printf(" Code | DOS-cp | WIN-cp | Language | Country\n"); printf("-------+--------+--------+--------------+---------\n"); for(i = 0; i < NLAN; i++) diff --git a/tools/wrc/dumpres.c b/tools/wrc/dumpres.c index f5caba68b7d..a101beec313 100644 --- a/tools/wrc/dumpres.c +++ b/tools/wrc/dumpres.c @@ -216,7 +216,7 @@ static void dump_lvc(lvc_t *l) */ static void dump_raw_data(raw_data_t *d) { - int n; + unsigned int n; int i; int j; diff --git a/tools/wrc/newstruc.c b/tools/wrc/newstruc.c index cc5a4262b5e..7268ba6f861 100644 --- a/tools/wrc/newstruc.c +++ b/tools/wrc/newstruc.c @@ -987,7 +987,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) } #undef MSGTAB_BAD_PTR -void copy_raw_data(raw_data_t *dst, raw_data_t *src, int offs, int len) +void copy_raw_data(raw_data_t *dst, raw_data_t *src, unsigned int offs, int len) { assert(offs <= src->size); assert(offs + len <= src->size); diff --git a/tools/wrc/newstruc.h b/tools/wrc/newstruc.h index 3f1395da0e8..a305d6d29f0 100644 --- a/tools/wrc/newstruc.h +++ b/tools/wrc/newstruc.h @@ -63,7 +63,7 @@ ver_words_t *new_ver_words(int i); ver_words_t *add_ver_words(ver_words_t *w, int i); messagetable_t *new_messagetable(raw_data_t *rd, int *memopt); dlginit_t *new_dlginit(raw_data_t *rd, int *memopt); -void copy_raw_data(raw_data_t *dst, raw_data_t *src, int offs, int len); +void copy_raw_data(raw_data_t *dst, raw_data_t *src, unsigned int offs, int len); int *new_int(int i); stringtable_t *new_stringtable(lvc_t *lvc); toolbar_t *new_toolbar(int button_width, int button_Height, toolbar_item_t *items, int nitems); diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y index 2e4eac4ff4a..8f7161ff657 100644 --- a/tools/wrc/parser.y +++ b/tools/wrc/parser.y @@ -2717,7 +2717,7 @@ static resource_t *build_fontdir(resource_t **fnt, int nfnt) static int once = 0; if(!once) { - warning("Need to parse fonts, not yet implemented"); + warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)", fnt, nfnt); once++; } return NULL; diff --git a/tools/wrc/readres.c b/tools/wrc/readres.c index d57c42f3dbf..02b5fad0269 100644 --- a/tools/wrc/readres.c +++ b/tools/wrc/readres.c @@ -65,7 +65,7 @@ struct resheader32 { */ int read_data(FILE *fp, size_t size, void *buf) { - int r; + unsigned int r; int pos = ftell(fp); r = fread(buf, 1, size, fp); if(r == size) diff --git a/tools/wrc/utils.c b/tools/wrc/utils.c index aadc374d984..dc8dd19e4a0 100644 --- a/tools/wrc/utils.c +++ b/tools/wrc/utils.c @@ -377,7 +377,7 @@ static const struct lang2cp lang2cps[] = void set_language( unsigned short lang, unsigned short sublang ) { - int i; + unsigned int i; unsigned int cp = 0, defcp = 0; for (i = 0; i < sizeof(lang2cps)/sizeof(lang2cps[0]); i++) diff --git a/tools/wrc/wrctypes.h b/tools/wrc/wrctypes.h index f867e6a569e..5f8162dd7c3 100644 --- a/tools/wrc/wrctypes.h +++ b/tools/wrc/wrctypes.h @@ -175,9 +175,9 @@ enum res_e { /* Raw bytes in a row... */ typedef struct raw_data { - int size; - char *data; - lvc_t lvc; /* Localized data */ + unsigned int size; + char *data; + lvc_t lvc; /* Localized data */ } raw_data_t; /* Dialog structures */ diff --git a/tools/wrc/writeres.c b/tools/wrc/writeres.c index b67b29b7170..7f535fbed76 100644 --- a/tools/wrc/writeres.c +++ b/tools/wrc/writeres.c @@ -511,14 +511,14 @@ static void count_resources(resource_t *top) /* ***************************************************************************** * Function : write_pe_segment - * Syntax : void write_pe_segment(FILE *fp, resource_t *top) + * Syntax : void write_pe_segment(FILE *fp) * Input : * Output : * Description : * Remarks : ***************************************************************************** */ -static void write_pe_segment(FILE *fp, resource_t *top) +static void write_pe_segment(FILE *fp) { int i; @@ -711,14 +711,14 @@ static void write_pe_segment(FILE *fp, resource_t *top) /* ***************************************************************************** * Function : write_ne_segment - * Syntax : void write_ne_segment(FILE *fp, resource_t *top) + * Syntax : void write_ne_segment(FILE *fp) * Input : * Output : * Description : * Remarks : ***************************************************************************** */ -static void write_ne_segment(FILE *fp, resource_t *top) +static void write_ne_segment(FILE *fp) { int i, j; @@ -790,14 +790,14 @@ static void write_ne_segment(FILE *fp, resource_t *top) /* ***************************************************************************** * Function : write_rsc_names - * Syntax : void write_rsc_names(FILE *fp, resource_t *top) + * Syntax : void write_rsc_names(FILE *fp) * Input : * Output : * Description : * Remarks : ***************************************************************************** */ -static void write_rsc_names(FILE *fp, resource_t *top) +static void write_rsc_names(FILE *fp) { int i, j; @@ -909,13 +909,13 @@ void write_s_file(char *outname, resource_t *top) if(create_dir) { if(win32) - write_pe_segment(fo, top); + write_pe_segment(fo); else - write_ne_segment(fo, top); + write_ne_segment(fo); } /* Dump the names */ - write_rsc_names(fo, top); + write_rsc_names(fo); if(create_dir) fprintf(fo, ".LResTabEnd:\n");