diff --git a/src/cairo-misc.c b/src/cairo-misc.c index 2f551ee27..81f9325ca 100644 --- a/src/cairo-misc.c +++ b/src/cairo-misc.c @@ -38,10 +38,13 @@ * Adrian Johnson */ +#define _GNU_SOURCE 1 /* strtod_l() */ + #include "cairoint.h" #include "cairo-error-private.h" #include +#include #include #include #ifdef HAVE_XLOCALE_H diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c index b1f77b358..6d4134ad9 100644 --- a/test/cairo-test-runner.c +++ b/test/cairo-test-runner.c @@ -164,11 +164,13 @@ static cairo_bool_t is_running_under_debugger (void) { #if HAVE_UNISTD_H && HAVE_LIBGEN_H && __linux__ - char buf[1024]; + char buf[1024] = { 0 }; + char buf2[1024] = { 0 }; sprintf (buf, "/proc/%d/exe", getppid ()); - if (readlink (buf, buf, sizeof (buf)) != -1 && - strncmp (basename (buf), "gdb", 3) == 0) + if (readlink (buf, buf2, sizeof (buf2)) != -1 && + buf2[1023] == 0 && + strncmp (basename (buf2), "gdb", 3) == 0) { return TRUE; } diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c index 5badc4377..6b7e00afc 100644 --- a/test/cairo-test-trace.c +++ b/test/cairo-test-trace.c @@ -83,6 +83,7 @@ #include #include #include +#include #if CAIRO_HAS_REAL_PTHREAD #include #endif @@ -906,7 +907,7 @@ write_result (const char *trace, struct slave *slave) static int index; char *filename; - xasprintf (&filename, "%s-%s-pass-%d-%d-%d.png", + xasprintf (&filename, "%s-%s-pass-%d-%ld-%ld.png", trace, slave->target->name, ++index, slave->start_line, slave->end_line); cairo_surface_write_to_png (slave->image, filename); @@ -1175,7 +1176,7 @@ test_run (void *base, if (write_results) write_result (trace, &slaves[1]); if (write_traces && slaves[0].is_recording) { char buf[80]; - snprintf (buf, sizeof (buf), "%d", slaves[0].image_serial); + snprintf (buf, sizeof (buf), "%ld", slaves[0].image_serial); write_trace (trace, buf, &slaves[0]); } @@ -1203,7 +1204,7 @@ test_run (void *base, image = 0; } } -done: + ret = TRUE; out: diff --git a/test/cairo-test.c b/test/cairo-test.c index bab952603..230579f6e 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -1663,11 +1663,13 @@ cairo_test_get_context (cairo_t *cr) } cairo_t * -cairo_test_create (cairo_surface_t *surface, cairo_test_context_t *ctx) +cairo_test_create (cairo_surface_t *surface, + const cairo_test_context_t *ctx) { - cairo_t *cr = cairo_create(surface); - cairo_set_user_data(cr, &_cairo_test_context_key, ctx, NULL); - return cr; + cairo_t *cr = cairo_create (surface); + cairo_set_user_data (cr, &_cairo_test_context_key, + (void*) ctx, NULL); + return cr; } cairo_surface_t * diff --git a/test/cairo-test.h b/test/cairo-test.h index 6d423ba01..6169c5371 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -320,7 +320,8 @@ cairo_bool_t cairo_test_mkdir (const char *path); cairo_t * -cairo_test_create (cairo_surface_t *surface, cairo_test_context_t *ctx); +cairo_test_create (cairo_surface_t *surface, + const cairo_test_context_t *ctx); CAIRO_END_DECLS diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index 28ec11941..bb618b5d9 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -784,7 +784,7 @@ static cairo_bool_t _init_logfile (void) { static cairo_bool_t initialized; - char buf[4096]; + char buf[4105]; const char *filename; const char *env; diff --git a/util/meson.build b/util/meson.build index 3f16d7c78..6982ad758 100644 --- a/util/meson.build +++ b/util/meson.build @@ -58,8 +58,7 @@ foreach util : cairo_utils ) endforeach -# This is useless and doesn't build on Windows -if host_machine.system() != 'windows' +if cc.has_header_symbol('malloc.h', '__malloc_hook') libmallocstats = library('malloc-stats', 'malloc-stats.c') endif