From c782c3c14d386ebbc065e36d483878afe41df36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Mon, 25 Apr 2005 08:26:29 +0000 Subject: [PATCH] Sync to Wine-20040419: Jon Griffiths - -Wunsigned fixes. Alexandre Julliard - Use the correct file name in the "generated automatically" comments. - Don't crash on xrealloc(0) (found by Jon Griffiths). Marcus Meissner - Use correct movw instead of movl when handling segment registers. svn path=/trunk/; revision=14796 --- reactos/tools/winebuild/build.h | 3 ++- reactos/tools/winebuild/main.c | 2 +- reactos/tools/winebuild/relay.c | 8 ++++---- reactos/tools/winebuild/res16.c | 9 +++++---- reactos/tools/winebuild/res32.c | 8 ++++---- reactos/tools/winebuild/spec32.c | 7 +++++-- reactos/tools/winebuild/utils.c | 6 +++--- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/reactos/tools/winebuild/build.h b/reactos/tools/winebuild/build.h index c17c7208202..d6af3a0fbd2 100644 --- a/reactos/tools/winebuild/build.h +++ b/reactos/tools/winebuild/build.h @@ -98,7 +98,7 @@ typedef struct int nb_entry_points; /* number of used entry points */ int alloc_entry_points; /* number of allocated entry points */ int nb_names; /* number of entry points with names */ - int nb_resources; /* number of resources */ + unsigned int nb_resources; /* number of resources */ int characteristics; /* characteristics for the PE header */ int subsystem; /* subsystem id */ int subsystem_major; /* subsystem version major number */ @@ -203,6 +203,7 @@ extern int display_warnings; extern int kill_at; extern char *input_file_name; +extern char *spec_file_name; extern const char *output_file_name; extern char **debug_channels; extern char **lib_path; diff --git a/reactos/tools/winebuild/main.c b/reactos/tools/winebuild/main.c index 0250e60365f..8148ba71677 100644 --- a/reactos/tools/winebuild/main.c +++ b/reactos/tools/winebuild/main.c @@ -56,6 +56,7 @@ char **debug_channels = NULL; char **lib_path = NULL; char *input_file_name = NULL; +char *spec_file_name = NULL; const char *output_file_name = NULL; char *ld_command = "ld"; @@ -65,7 +66,6 @@ static FILE *output_file; static const char *current_src_dir; static int nb_res_files; static char **res_files; -static char *spec_file_name; /* execution mode */ enum exec_mode_values diff --git a/reactos/tools/winebuild/relay.c b/reactos/tools/winebuild/relay.c index b43f5a09633..6548714b43d 100644 --- a/reactos/tools/winebuild/relay.c +++ b/reactos/tools/winebuild/relay.c @@ -171,7 +171,7 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk, int sho else fprintf( outfile, "\tmovw " __ASM_NAME("CallTo16_TebSelector") ", %%fs\n" ); - fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); + fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); /* Get address of wine_ldt_copy array into %ecx */ if ( UsePIC ) @@ -481,7 +481,7 @@ static void BuildCallTo16Core( FILE *outfile, int reg_func ) fprintf( outfile, "\tpushl %%ebx\n" ); fprintf( outfile, "\tpushl %%esi\n" ); fprintf( outfile, "\tpushl %%edi\n" ); - fprintf( outfile, "\t.byte 0x64\n\tmovl %%gs,(%d)\n", STRUCTOFFSET(TEB,gs_sel) ); + fprintf( outfile, "\t.byte 0x64\n\tmov %%gs,(%d)\n", STRUCTOFFSET(TEB,gs_sel) ); /* Setup exception frame */ fprintf( outfile, "\t.byte 0x64\n\tpushl (%d)\n", STACKOFFSET ); @@ -635,9 +635,9 @@ static void BuildRet16Func( FILE *outfile ) #endif fprintf( outfile, "\tmovw %%di,%%es\n" ); - fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_TebSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%fs\n" ); + fprintf( outfile, "\t.byte 0x2e\n\tmov " __ASM_NAME("CallTo16_TebSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%fs\n" ); - fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); + fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); /* Restore the 32-bit stack */ diff --git a/reactos/tools/winebuild/res16.c b/reactos/tools/winebuild/res16.c index 285e890859f..92dca83cc8f 100644 --- a/reactos/tools/winebuild/res16.c +++ b/reactos/tools/winebuild/res16.c @@ -215,7 +215,7 @@ static int cmp_res( const void *ptr1, const void *ptr2 ) /* build the 2-level (type,name) resource tree */ static struct res_tree *build_resource_tree( DLLSPEC *spec ) { - int i; + unsigned int i; struct res_tree *tree; struct res_type *type = NULL; @@ -270,7 +270,8 @@ int output_res16_data( FILE *outfile, DLLSPEC *spec ) { const struct resource *res; unsigned char *buffer, *p; - int i, total; + unsigned int i; + int total; if (!spec->nb_resources) return 0; @@ -292,8 +293,8 @@ int output_res16_data( FILE *outfile, DLLSPEC *spec ) /* output the resource definitions */ int output_res16_directory( unsigned char *buffer, DLLSPEC *spec ) { - int i, offset, res_offset = 0; - unsigned int j; + int offset, res_offset = 0; + unsigned int i, j; struct res_tree *tree; const struct res_type *type; const struct resource *res; diff --git a/reactos/tools/winebuild/res32.c b/reactos/tools/winebuild/res32.c index 1e4d28bde84..8513863dbb2 100644 --- a/reactos/tools/winebuild/res32.c +++ b/reactos/tools/winebuild/res32.c @@ -267,7 +267,7 @@ static int cmp_res( const void *ptr1, const void *ptr2 ) /* build the 3-level (type,name,language) resource tree */ static struct res_tree *build_resource_tree( DLLSPEC *spec ) { - int i; + unsigned int i; struct res_tree *tree; struct res_type *type = NULL; struct res_name *name = NULL; @@ -297,7 +297,7 @@ static struct res_tree *build_resource_tree( DLLSPEC *spec ) /* free the resource tree */ static void free_resource_tree( struct res_tree *tree ) { - int i; + unsigned int i; for (i = 0; i < tree->nb_types; i++) free( tree->types[i].names ); free( tree->types ); @@ -318,8 +318,8 @@ static void output_string( FILE *outfile, const WCHAR *name ) /* output the resource definitions */ void output_resources( FILE *outfile, DLLSPEC *spec ) { - int i, j, k, nb_id_types; - unsigned int n, offset, data_offset; + int j, k, nb_id_types; + unsigned int i, n, offset, data_offset; struct res_tree *tree; struct res_type *type; struct res_name *name; diff --git a/reactos/tools/winebuild/spec32.c b/reactos/tools/winebuild/spec32.c index 222cdabe500..6fb1f4ae0ef 100644 --- a/reactos/tools/winebuild/spec32.c +++ b/reactos/tools/winebuild/spec32.c @@ -846,8 +846,11 @@ void BuildDef32File( FILE *outfile, DLLSPEC *spec ) const char *name; int i; - fprintf(outfile, "; File generated automatically from %s; do not edit!\n\n", - input_file_name ); + if (spec_file_name) + fprintf( outfile, "; File generated automatically from %s; do not edit!\n\n", + spec_file_name ); + else + fprintf( outfile, "; File generated automatically; do not edit!\n\n" ); fprintf(outfile, "LIBRARY %s\n\n", spec->file_name); diff --git a/reactos/tools/winebuild/utils.c b/reactos/tools/winebuild/utils.c index bf71941ee0d..79b3899d97e 100644 --- a/reactos/tools/winebuild/utils.c +++ b/reactos/tools/winebuild/utils.c @@ -48,7 +48,7 @@ void *xmalloc (size_t size) void *xrealloc (void *ptr, size_t size) { void *res = realloc (ptr, size); - if (res == NULL) + if (size && res == NULL) { fprintf (stderr, "Virtual memory exhausted.\n"); exit (1); @@ -145,9 +145,9 @@ void warning( const char *msg, ... ) /* output a standard header for generated files */ void output_standard_file_header( FILE *outfile ) { - if (input_file_name) + if (spec_file_name) fprintf( outfile, "/* File generated automatically from %s; do not edit! */\n", - input_file_name ); + spec_file_name ); else fprintf( outfile, "/* File generated automatically; do not edit! */\n" ); fprintf( outfile,