Fixed some 64bit warnings by using size_t and fixing compare functions.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 22 Dec 2010 00:54:22 +0000 (00:54 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 22 Dec 2010 00:54:22 +0000 (00:54 +0000)
[r28196]

ir/be/beabi.c
ir/debug/debugger.c
ir/libcore/lc_printf.c
ir/lower/lower_dw.c
ir/stat/distrib.c
ir/stat/firmstat.c

index ffa46c1..5046377 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -1193,7 +1193,7 @@ static int cmp_regs(const void *a, const void *b)
        if (p->reg->reg_class == q->reg->reg_class)
                return p->reg->index - q->reg->index;
        else
-               return p->reg->reg_class - q->reg->reg_class;
+               return p->reg->reg_class < q->reg->reg_class ? -1 : +1;
 }
 
 static void reg_map_to_arr(reg_node_map_t *res, pmap *reg_map)
index cd808b6..e8d3e7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -933,7 +933,7 @@ static struct lexer {
        unsigned cur_token;   /**< current token. */
        unsigned number;      /**< current token attribute. */
        const char *s;        /**< current token attribute. */
-       unsigned len;         /**< current token attribute. */
+       size_t len;           /**< current token attribute. */
 
        const char *curr_pos;
        const char *end_pos;
@@ -1052,7 +1052,7 @@ static unsigned get_token(void)
 void firm_debug(const char *cmd)
 {
        char name[1024], fname[1024];
-       int len;
+       size_t len;
 
        init_lexer(cmd);
 
index c8a552c..e740c03 100644 (file)
@@ -387,7 +387,7 @@ int lc_evpprintf(const lc_arg_env_t *env, lc_appendable_t *app, const char *fmt,
                                        for (ch = *s; ch != '}' && ch != '\0'; ch = *++s);
 
                                        if (s - named) {
-                                               int n = s - named;
+                                               size_t n = s - named;
                                                char *name;
                                                lc_arg_t tmp;
 
index b029607..0aa2a83 100644 (file)
@@ -1992,7 +1992,7 @@ static int cmp_op_mode(const void *elt, const void *key, size_t size)
        const op_mode_entry_t *e2 = (const op_mode_entry_t*)key;
        (void) size;
 
-       return (e1->op - e2->op) | (e1->imode - e2->imode) | (e1->omode - e2->omode);
+       return (e1->op != e2->op) | (e1->imode != e2->imode) | (e1->omode != e2->omode);
 }
 
 /**
@@ -2004,7 +2004,7 @@ static int cmp_conv_tp(const void *elt, const void *key, size_t size)
        const conv_tp_entry_t *e2 = (const conv_tp_entry_t*)key;
        (void) size;
 
-       return (e1->imode - e2->imode) | (e1->omode - e2->omode);
+       return (e1->imode != e2->imode) | (e1->omode != e2->omode);
 }
 
 /**
index cc6df37..e145b3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -54,7 +54,9 @@ static int int_cmp_fun(const void *elt, const void *key)
        const distrib_entry_t *p1 = (const distrib_entry_t*)elt;
        const distrib_entry_t *p2 = (const distrib_entry_t*)key;
 
-       return (char *)p1->object - (char *)p2->object;
+       if (p1->object == p2->object)
+               return 0;
+       return p1->object < p2->object ? -1 : 1;
 }
 
 /*
index bf7c7e9..5e663a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -2134,7 +2134,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
 {
        char fname[2048];
        const char *p;
-       int l;
+       size_t l;
 
        if (! status->stat_options)
                return;