Fix printf format specifiers in extra files
authorIvan Maidanski <ivmai@mail.ru>
Thu, 29 Sep 2016 21:53:23 +0000 (00:53 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 29 Sep 2016 21:53:23 +0000 (00:53 +0300)
(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
extra/msvc_dbg.c

index 13e239d..57c2248 100644 (file)
@@ -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
     }
index ea7fc7b..abf4671 100644 (file)
@@ -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;
     }