From: Ivan Maidanski Date: Thu, 29 Sep 2016 21:53:23 +0000 (+0300) Subject: Fix printf format specifiers in extra files X-Git-Tag: v7.4.6~245 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77d9f9d318ce9b87abd908d50786ddbf2137c3f2;p=gc 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. --- diff --git a/extra/MacOS.c b/extra/MacOS.c index 27f07eb4..1ef3a681 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; }