winebuild: sign-compare fixes
Joris Huizer
joris_huizer at yahoo.com
Sat Feb 17 13:33:05 CST 2007
Skipped content of type multipart/alternative-------------- next part --------------
>From acb20c81bcc554be73db764142f8acf1456d4f2d Mon Sep 17 00:00:00 2001
From: Joris Huizer <jorishuizer at debian.(none)>
Date: Sat, 17 Feb 2007 20:18:53 +0100
Subject: [PATCH] winebuild: sign-compare fixes
To: wine-patches <wine-patches at winehq.org>
---
tools/winebuild/build.h | 2 +-
tools/winebuild/import.c | 10 ++++++----
tools/winebuild/parser.c | 5 +++--
tools/winebuild/spec32.c | 5 +++--
tools/winebuild/utils.c | 10 ++++++----
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 5668271..aa178ba 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -162,7 +162,7 @@ extern void output_standard_file_header(
extern FILE *open_input_file( const char *srcdir, const char *name );
extern void close_input_file( FILE *file );
extern void dump_bytes( const void *buffer, unsigned int size );
-extern int remove_stdcall_decoration( char *name );
+extern unsigned int remove_stdcall_decoration( char *name );
extern void assemble_file( const char *src_file, const char *obj_file );
extern DLLSPEC *alloc_dll_spec(void);
extern void free_dll_spec( DLLSPEC *spec );
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 2241fa5..a94cb6a 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -168,7 +168,7 @@ static void free_imports( struct import
/* check whether a given dll is imported in delayed mode */
static int is_delayed_import( const char *name )
{
- int i;
+ unsigned int i;
for (i = 0; i < delayed_imports.count; i++)
{
@@ -469,15 +469,16 @@ static char *create_undef_symbols_file(
{
char *as_file, *obj_file;
unsigned int i;
+ int j;
FILE *f;
as_file = get_temp_file_name( output_file_name, ".s" );
if (!(f = fopen( as_file, "w" ))) fatal_error( "Cannot create %s\n", as_file );
fprintf( f, "\t.data\n" );
- for (i = 0; i < spec->nb_entry_points; i++)
+ for (j = 0; j < spec->nb_entry_points; j++)
{
- ORDDEF *odp = &spec->entry_points[i];
+ ORDDEF *odp = &spec->entry_points[j];
if (odp->type == TYPE_STUB) continue;
if (odp->flags & FLAG_FORWARD) continue;
fprintf( f, "\t%s %s\n", get_asm_ptr_keyword(), asm_name(odp->link_name) );
@@ -557,7 +558,8 @@ void read_undef_symbols( DLLSPEC *spec,
/* resolve the imports for a Win32 module */
int resolve_imports( DLLSPEC *spec )
{
- unsigned int i, j, removed;
+ int i;
+ unsigned int j, removed;
ORDDEF *odp;
sort_names( &ignore_symbols );
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 3e0c400..771e808 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "windef.h"
#include "winbase.h"
@@ -808,7 +809,7 @@ static int parse_def_stack_heap_size( in
*/
static int parse_def_export( char *name, DLLSPEC *spec )
{
- int i, args;
+ unsigned int i, args;
const char *token = GetToken(1);
ORDDEF *odp = add_entry_point( spec );
@@ -818,7 +819,7 @@ static int parse_def_export( char *name,
odp->ordinal = -1;
odp->name = name;
args = remove_stdcall_decoration( odp->name );
- if (args == -1) odp->type = TYPE_CDECL;
+ if (args == UINT_MAX) odp->type = TYPE_CDECL;
else
{
odp->type = TYPE_STDCALL;
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 6fcc42e..26e66b8 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -51,7 +51,7 @@ static inline int needs_relay( const ORD
/* check if dll will output relay thunks */
int has_relays( DLLSPEC *spec )
{
- unsigned int i;
+ int i;
if (target_cpu != CPU_x86) return 0;
@@ -70,7 +70,8 @@ int has_relays( DLLSPEC *spec )
*/
static void output_relay_debug( DLLSPEC *spec )
{
- unsigned int i, j, args, flags;
+ int i;
+ unsigned int j, args, flags;
/* first the table of entry point offsets */
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 3458eb7..c63f9ca 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -27,10 +27,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+
#include "windef.h"
#include "winnt.h"
#include "build.h"
@@ -280,12 +282,12 @@ void close_input_file( FILE *file )
* Remove a possible @xx suffix from a function name.
* Return the numerical value of the suffix, or -1 if none.
*/
-int remove_stdcall_decoration( char *name )
+unsigned int remove_stdcall_decoration( char *name )
{
char *p, *end = strrchr( name, '@' );
- if (!end || !end[1] || end == name) return -1;
+ if (!end || !end[1] || end == name) return UINT_MAX;
/* make sure all the rest is digits */
- for (p = end + 1; *p; p++) if (!isdigit(*p)) return -1;
+ for (p = end + 1; *p; p++) if (!isdigit(*p)) return UINT_MAX;
*end = 0;
return atoi( end + 1 );
}
@@ -454,7 +456,7 @@ unsigned int get_alignment(unsigned int
case CPU_POWERPC:
case CPU_ALPHA:
n = 0;
- while ((1 << n) != align) n++;
+ while ((1u << n) != align) n++;
return n;
}
/* unreached */
--
1.4.4
More information about the wine-patches
mailing list