Skip to content

Commit

Permalink
Issue json-c#300: Cast size_t values to int instead of unsigned long …
Browse files Browse the repository at this point in the history
…long to work around broken behavior of MinGW.
  • Loading branch information
hawicz committed Feb 5, 2017
1 parent bad6c9a commit 3948fca
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test1.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void test_array_del_idx()
for(ii = 0; ii < json_object_array_length(my_array); ii++)
{
json_object *obj = json_object_array_get_idx(my_array, ii);
printf("\t[%llu]=%s\n", (unsigned long long)ii, json_object_to_json_string(obj));
printf("\t[%d]=%s\n", (int)ii, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));

Expand All @@ -108,16 +108,16 @@ void test_array_del_idx()
/* Delete all array indexes at once */
my_array = make_array();
rc = json_object_array_del_idx(my_array, 0, orig_array_len);
printf("after del_idx(0,%llu)=%d, my_array.to_string()=%s\n",
(unsigned long long)orig_array_len, rc, json_object_to_json_string(my_array));
printf("after del_idx(0,%d)=%d, my_array.to_string()=%s\n",
(int)orig_array_len, rc, json_object_to_json_string(my_array));

json_object_put(my_array);

/* Delete *more* than all array indexes at once */
my_array = make_array();
rc = json_object_array_del_idx(my_array, 0, orig_array_len + 1);
printf("after del_idx(0,%llu)=%d, my_array.to_string()=%s\n",
(unsigned long long)(orig_array_len + 1), rc, json_object_to_json_string(my_array));
printf("after del_idx(0,%d)=%d, my_array.to_string()=%s\n",
(int)(orig_array_len + 1), rc, json_object_to_json_string(my_array));

json_object_put(my_array);
}
Expand Down Expand Up @@ -175,7 +175,7 @@ int main(int argc, char **argv)
for(i=0; i < json_object_array_length(my_array); i++)
{
json_object *obj = json_object_array_get_idx(my_array, i);
printf("\t[%llu]=%s\n", (unsigned long long)i, json_object_to_json_string(obj));
printf("\t[%d]=%s\n", (int)i, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));

Expand All @@ -192,15 +192,15 @@ int main(int argc, char **argv)
for(i=0; i < json_object_array_length(my_array); i++)
{
json_object *obj = json_object_array_get_idx(my_array, i);
printf("\t[%llu]=%s\n", (unsigned long long)i, json_object_to_json_string(obj));
printf("\t[%d]=%s\n", (int)i, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
json_object_array_sort(my_array, sort_fn);
printf("my_array=\n");
for(i=0; i < json_object_array_length(my_array); i++)
{
json_object *obj = json_object_array_get_idx(my_array, i);
printf("\t[%llu]=%s\n", (unsigned long long)i, json_object_to_json_string(obj));
printf("\t[%d]=%s\n", (int)i, json_object_to_json_string(obj));
}
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));

Expand Down

0 comments on commit 3948fca

Please sign in to comment.