From 80e4318f1d3724248fb16ea2d5521bf4f5304a49 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 30 Sep 2016 00:53:23 +0300 Subject: [PATCH] Fix printf format specifiers in extra files (to eliminate cppcheck warnings) * extra/MacOS.c (GC_MacFreeTemporaryMemory): Cast GC_gc_no to unsigned long, and adjust fprintf format specifier appropriately. * extra/msvc_dbg.c (GetDescriptionFromAddress): Cast line_number to int when passed to wsprintf() to match format specifier. --- extra/MacOS.c | 3 ++- extra/msvc_dbg.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/extra/MacOS.c b/extra/MacOS.c index 13e239d4..57c22482 100644 --- a/extra/MacOS.c +++ b/extra/MacOS.c @@ -133,7 +133,8 @@ void GC_MacFreeTemporaryMemory() if (GC_print_stats) { fprintf(stdout, "[total memory used: %ld bytes.]\n", totalMemoryUsed); - fprintf(stdout, "[total collections: %ld.]\n", GC_gc_no); + fprintf(stdout, "[total collections: %lu]\n", + (unsigned long)GC_gc_no); } # endif } diff --git a/extra/msvc_dbg.c b/extra/msvc_dbg.c index ea7fc7b6..abf46717 100644 --- a/extra/msvc_dbg.c +++ b/extra/msvc_dbg.c @@ -317,7 +317,7 @@ size_t GetDescriptionFromAddress(void* address, const char* format, size = (GC_ULONG_PTR)end < (GC_ULONG_PTR)buffer ? 0 : end - buffer; if (line_number) { - wsprintf(str, "(%d) : ", line_number); + wsprintf(str, "(%d) : ", (int)line_number); if (size) { strncpy(buffer, str, size)[size - 1] = 0; } -- 2.40.0