tools: fix some -Wsign-compare warnings
Stefan Huehner
stefan at huehner.org
Thu Jun 30 15:03:07 CDT 2005
Hi,
attached fixes some -Wsign-compare warnings in tools/ by using
appropriate unsigned types where needed.
ChangeLog:
- fix some -Wsign-compare warnings
Regards,
Stefan
-------------- next part --------------
Index: tools/widl/typelib.c
===================================================================
RCS file: /home/wine/wine/tools/widl/typelib.c,v
retrieving revision 1.15
diff -u -p -r1.15 typelib.c
--- tools/widl/typelib.c 9 Jun 2005 09:45:26 -0000 1.15
+++ tools/widl/typelib.c 30 Jun 2005 19:58:36 -0000
@@ -72,7 +72,7 @@ static unsigned short builtin_vt(const c
kwp = bsearch(&key, oatypes, NTYPES, sizeof(oatypes[0]), kw_cmp_func);
#else
{
- int i;
+ unsigned int i;
for (kwp=NULL, i=0; i < NTYPES; i++)
if (!kw_cmp_func(&key, &oatypes[i])) {
kwp = &oatypes[i];
Index: tools/winedump/le.c
===================================================================
RCS file: /home/wine/wine/tools/winedump/le.c,v
retrieving revision 1.2
diff -u -p -r1.2 le.c
--- tools/winedump/le.c 3 Jan 2005 17:15:37 -0000 1.2
+++ tools/winedump/le.c 30 Jun 2005 19:58:36 -0000
@@ -229,13 +229,13 @@ static void dump_le_header( const IMAGE_
static void dump_le_objects( const void *base, const IMAGE_VXD_HEADER *le )
{
struct o32_obj *pobj;
- int i;
+ unsigned int i;
printf("\nObject table:\n");
pobj = (struct o32_obj *)((const unsigned char *)le + le->e32_objtab);
for (i = 0; i < le->e32_objcnt; i++)
{
- int j;
+ unsigned int j;
struct o32_map *pmap=0;
printf(" Obj. Rel.Base Codesize Flags Tableidx Tablesize Name\n");
Index: tools/winedump/minidump.c
===================================================================
RCS file: /home/wine/wine/tools/winedump/minidump.c,v
retrieving revision 1.3
diff -u -p -r1.3 minidump.c
--- tools/winedump/minidump.c 24 May 2005 11:45:14 -0000 1.3
+++ tools/winedump/minidump.c 30 Jun 2005 19:58:36 -0000
@@ -47,7 +47,7 @@ static void dump_mdmp_string(DWORD rva)
static MINIDUMP_DIRECTORY* get_mdmp_dir(const MINIDUMP_HEADER* hdr, int str_idx)
{
MINIDUMP_DIRECTORY* dir;
- int i;
+ unsigned int i;
for (i = 0; i < hdr->NumberOfStreams; i++)
{
@@ -92,7 +92,7 @@ void mdmp_dump(void)
{
MINIDUMP_THREAD_LIST* mtl = (MINIDUMP_THREAD_LIST*)stream;
MINIDUMP_THREAD* mt = &mtl->Threads[0];
- int i;
+ unsigned int i;
printf("Threads: %lu\n", mtl->NumberOfThreads);
for (i = 0; i < mtl->NumberOfThreads; i++, mt++)
@@ -117,7 +117,7 @@ void mdmp_dump(void)
{
MINIDUMP_MODULE_LIST* mml = (MINIDUMP_MODULE_LIST*)stream;
MINIDUMP_MODULE* mm = &mml->Modules[0];
- int i;
+ unsigned int i;
const char* p1;
const char* p2;
@@ -209,7 +209,7 @@ void mdmp_dump(void)
{
MINIDUMP_MEMORY_LIST* mml = (MINIDUMP_MEMORY_LIST*)stream;
MINIDUMP_MEMORY_DESCRIPTOR* mmd = &mml->MemoryRanges[0];
- int i;
+ unsigned int i;
printf("Memory Ranges: %lu\n", mml->NumberOfMemoryRanges);
for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++)
@@ -338,7 +338,7 @@ void mdmp_dump(void)
case ExceptionStream:
{
MINIDUMP_EXCEPTION_STREAM* mes = (MINIDUMP_EXCEPTION_STREAM*)stream;
- int i;
+ unsigned int i;
printf("Exception:\n");
printf(" ThreadId: %08lx\n", mes->ThreadId);
Index: tools/winegcc/utils.c
===================================================================
RCS file: /home/wine/wine/tools/winegcc/utils.c,v
retrieving revision 1.16
diff -u -p -r1.16 utils.c
--- tools/winegcc/utils.c 6 May 2005 15:44:31 -0000 1.16
+++ tools/winegcc/utils.c 30 Jun 2005 19:58:36 -0000
@@ -118,7 +118,7 @@ void strarray_add(strarray* arr, const c
arr->base[arr->size++] = str;
}
-void strarray_del(strarray* arr, int i)
+void strarray_del(strarray* arr, size_t i)
{
if (i < 0 || i >= arr->size) error("Invalid index i=%d", i);
memmove(&arr->base[i], &arr->base[i + 1], (arr->size - i - 1) * sizeof(arr->base[0]));
@@ -127,7 +127,7 @@ void strarray_del(strarray* arr, int i)
void strarray_addall(strarray* arr, const strarray* from)
{
- int i;
+ size_t i;
for (i = 0; i < from->size; i++)
strarray_add(arr, from->base[i]);
@@ -136,7 +136,7 @@ void strarray_addall(strarray* arr, cons
strarray* strarray_dup(const strarray* arr)
{
strarray* dup = strarray_alloc();
- int i;
+ size_t i;
for (i = 0; i < arr->size; i++)
strarray_add(dup, arr->base[i]);
@@ -160,7 +160,7 @@ strarray* strarray_fromstring(const char
char* strarray_tostring(const strarray* arr, const char* sep)
{
char *str, *newstr;
- int i;
+ size_t i;
str = strmake("%s", arr->base[0]);
for (i = 1; i < arr->size; i++)
@@ -269,7 +269,7 @@ static file_type guess_lib_type(const ch
file_type get_lib_type(strarray* path, const char* library, char** file)
{
- int i;
+ size_t i;
for (i = 0; i < path->size; i++)
{
@@ -281,7 +281,8 @@ file_type get_lib_type(strarray* path, c
void spawn(const strarray* prefix, const strarray* args)
{
- int i, status;
+ int status;
+ size_t i;
strarray* arr = strarray_dup(args);
const char** argv;
char* prog = 0;
Index: tools/winegcc/utils.h
===================================================================
RCS file: /home/wine/wine/tools/winegcc/utils.h,v
retrieving revision 1.10
diff -u -p -r1.10 utils.h
--- tools/winegcc/utils.h 23 Mar 2004 00:14:54 -0000 1.10
+++ tools/winegcc/utils.h 30 Jun 2005 19:58:36 -0000
@@ -48,7 +48,7 @@ strarray* strarray_alloc(void);
strarray* strarray_dup(const strarray* arr);
void strarray_free(strarray* arr);
void strarray_add(strarray* arr, const char* str);
-void strarray_del(strarray* arr, int i);
+void strarray_del(strarray* arr, size_t i);
void strarray_addall(strarray* arr, const strarray* from);
strarray* strarray_fromstring(const char* str, const char* delim);
char* strarray_tostring(const strarray* arr, const char* sep);
Index: tools/winegcc/winegcc.c
===================================================================
RCS file: /home/wine/wine/tools/winegcc/winegcc.c,v
retrieving revision 1.39
diff -u -p -r1.39 winegcc.c
--- tools/winegcc/winegcc.c 20 Jun 2005 14:18:03 -0000 1.39
+++ tools/winegcc/winegcc.c 30 Jun 2005 19:58:36 -0000
@@ -165,7 +165,7 @@ struct options
static void clean_temp_files(void)
{
- int i;
+ size_t i;
if (keep_generated) return;
@@ -230,7 +230,8 @@ static const strarray* get_translator(st
static void compile(struct options* opts, const char* lang)
{
strarray* comp_args = strarray_alloc();
- int j, gcc_defs = 0;
+ int gcc_defs = 0;
+ size_t j;
switch(opts->processor)
{
@@ -383,7 +384,7 @@ static void build(struct options* opts)
const char* winebuild = getenv("WINEBUILD");
int generate_app_loader = 1;
int old_processor;
- int j;
+ size_t j;
/* NOTE: for the files array we'll use the following convention:
* -axxx: xxx is an archive (.a)
@@ -662,7 +663,7 @@ static int is_linker_arg(const char* arg
"-static", "-static-libgcc", "-shared", "-shared-libgcc", "-symbolic",
"-framework"
};
- int j;
+ size_t j;
switch (arg[1])
{
@@ -712,7 +713,7 @@ static int is_mingw_arg(const char* arg)
{
"-mno-cygwin", "-mwindows", "-mconsole", "-mthreads"
};
- int j;
+ size_t j;
for (j = 0; j < sizeof(mingw_switches)/sizeof(mingw_switches[0]); j++)
if (strcmp(mingw_switches[j], arg) == 0) return 1;
More information about the wine-patches
mailing list