Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix some 'signed/unsigned comparison' warnings
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 19 Sep 2015 22:51:51 +0000 (00:51 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 19 Sep 2015 22:56:34 +0000 (00:56 +0200)
src/xbt/dynar.c
src/xbt/setset.c
src/xbt/xbt_matrix.c
src/xbt/xbt_str.c

index 25de69f..28c6efc 100644 (file)
@@ -27,7 +27,7 @@ static XBT_INLINE void _sanity_check_idx(int idx)
 
 static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx)
 {
 
 static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx)
 {
-  if (idx < 0 || idx >= dynar->used) {
+  if (idx < 0 || idx >= (int)dynar->used) {
     THROWF(bound_error, idx,
            "dynar is not that long. You asked %d, but it's only %lu long",
            (int) (idx), (unsigned long) dynar->used);
     THROWF(bound_error, idx,
            "dynar is not that long. You asked %d, but it's only %lu long",
            (int) (idx), (unsigned long) dynar->used);
index 2b0ec89..8dbf6ec 100644 (file)
@@ -201,7 +201,7 @@ void xbt_setset_set_reset(xbt_setset_set_t set)
  */
 void *xbt_setset_set_choose(xbt_setset_set_t set)
 {
  */
 void *xbt_setset_set_choose(xbt_setset_set_t set)
 {
-  int i;
+  unsigned int i;
   /* Traverse the set and return the first element */
   for (i = 0; i < set->size; i++)
     if (set->bitmap[i] != 0)
   /* Traverse the set and return the first element */
   for (i = 0; i < set->size; i++)
     if (set->bitmap[i] != 0)
@@ -243,7 +243,8 @@ int xbt_setset_set_belongs(xbt_setset_set_t set, void *obj)
 
 int xbt_setset_set_size(xbt_setset_set_t set)
 {
 
 int xbt_setset_set_size(xbt_setset_set_t set)
 {
-  int i, count = 0;
+  unsigned int i;
+  int count = 0;
 
   for (i = 0; i < set->size; i++)
     count += bitcount(set->bitmap[i]);
 
   for (i = 0; i < set->size; i++)
     count += bitcount(set->bitmap[i]);
@@ -260,7 +261,7 @@ int xbt_setset_set_size(xbt_setset_set_t set)
  */
 void xbt_setset_add(xbt_setset_set_t set1, xbt_setset_set_t set2)
 {
  */
 void xbt_setset_add(xbt_setset_set_t set1, xbt_setset_set_t set2)
 {
-  int i;
+  unsigned int i;
 
   /* Increase the size of set1 if necessary */
   if (set1->size < set2->size) {
 
   /* Increase the size of set1 if necessary */
   if (set1->size < set2->size) {
@@ -283,7 +284,7 @@ void xbt_setset_add(xbt_setset_set_t set1, xbt_setset_set_t set2)
  */
 void xbt_setset_substract(xbt_setset_set_t set1, xbt_setset_set_t set2)
 {
  */
 void xbt_setset_substract(xbt_setset_set_t set1, xbt_setset_set_t set2)
 {
-  int i;
+  unsigned int i;
 
   for (i = 0; i < MIN(set1->size, set2->size); i++)
     if (set2->bitmap[i] != 0)
 
   for (i = 0; i < MIN(set1->size, set2->size); i++)
     if (set2->bitmap[i] != 0)
@@ -300,7 +301,7 @@ void xbt_setset_substract(xbt_setset_set_t set1, xbt_setset_set_t set2)
  */
 void xbt_setset_intersect(xbt_setset_set_t set1, xbt_setset_set_t set2)
 {
  */
 void xbt_setset_intersect(xbt_setset_set_t set1, xbt_setset_set_t set2)
 {
-  int i;
+  unsigned int i;
 
   for (i = 0; i < MIN(set1->size, set2->size); i++)
     if (set1->bitmap[i] && set2->bitmap[i])
 
   for (i = 0; i < MIN(set1->size, set2->size); i++)
     if (set1->bitmap[i] && set2->bitmap[i])
@@ -313,7 +314,7 @@ void xbt_setset_intersect(xbt_setset_set_t set1, xbt_setset_set_t set2)
 void xbt_setset_cursor_first(xbt_setset_set_t set,
                              xbt_setset_cursor_t * cursor)
 {
 void xbt_setset_cursor_first(xbt_setset_set_t set,
                              xbt_setset_cursor_t * cursor)
 {
-  int i;
+  unsigned int i;
   (*cursor) = xbt_new0(s_xbt_setset_cursor_t, 1);
   (*cursor)->set = set;
 
   (*cursor) = xbt_new0(s_xbt_setset_cursor_t, 1);
   (*cursor)->set = set;
 
index 333d5cd..9cb965c 100644 (file)
@@ -185,7 +185,7 @@ xbt_matrix_t xbt_matrix_double_new_seq(int lines, int rows)
 /** \brief Checks whether the matrix contains the sequence of numbers */
 int xbt_matrix_double_is_seq(xbt_matrix_t mat)
 {
 /** \brief Checks whether the matrix contains the sequence of numbers */
 int xbt_matrix_double_is_seq(xbt_matrix_t mat)
 {
-  int i;
+  unsigned int i;
 
   for (i = 0; i < mat->lines * mat->rows; i++) {
     double val = xbt_matrix_get_as(mat, i, 0, double);
 
   for (i = 0; i < mat->lines * mat->rows; i++) {
     double val = xbt_matrix_get_as(mat, i, 0, double);
index d1f1cd9..5943a11 100644 (file)
@@ -861,7 +861,7 @@ char *xbt_str_from_file(FILE * file)
  */
 int xbt_str_start_with(const char* str, const char* start)
 {
  */
 int xbt_str_start_with(const char* str, const char* start)
 {
-  int i;
+  unsigned int i;
   size_t l_str = strlen(str);
   size_t l_start = strlen(start);
 
   size_t l_str = strlen(str);
   size_t l_start = strlen(start);