X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/28de1ff76a78ba4d87ea61d5d9fce01c6d035a18..ea6c1e33aa83826778637849d951a9eccabf3d67:/testsuite/xbt/graphxml_usage.c diff --git a/testsuite/xbt/graphxml_usage.c b/testsuite/xbt/graphxml_usage.c index cf89b3cb6b..f0e63f92cc 100644 --- a/testsuite/xbt/graphxml_usage.c +++ b/testsuite/xbt/graphxml_usage.c @@ -10,6 +10,12 @@ #pragma hdrstop #endif +#include + +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + #include "xbt/module.h" #include "xbt/sysdep.h" #include "xbt/graph.h" @@ -43,7 +49,7 @@ void test(char *graph_file) int test_shortest_paths = 1; int test_topo_sort = 1; - int i, j; + unsigned long i, j; unsigned long n; xbt_dynar_t edges = NULL; @@ -70,7 +76,7 @@ void test(char *graph_file) INFO0("---- Dumping Edge lengths ----"); adj = xbt_graph_get_length_matrix(graph); - buf = calloc(n * 20, sizeof(char)); + buf = xbt_new0(char,n * 20); for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]); @@ -88,7 +94,7 @@ void test(char *graph_file) INFO0("---- Testing Shortest Paths ----"); route = xbt_graph_shortest_paths(graph); - buf = calloc(n * 40, sizeof(char)); + buf = xbt_new0(char,n * 40); for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (route[i * n + j]) @@ -109,7 +115,7 @@ void test(char *graph_file) sorted = xbt_graph_topo_sort(graph); for (i = 0; i < n; i++) { if (sorted[i]) { - INFO3("sorted[%d] = %s (%p)", i, node_name(sorted[i]), sorted[i]); + INFO3("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]); } } free(sorted);