]> granicus.if.org Git - curl/commitdiff
lib: fix compiler warnings
authorMarcel Raad <raad@teamviewer.com>
Tue, 2 May 2017 18:47:13 +0000 (20:47 +0200)
committerMarcel Raad <raad@teamviewer.com>
Wed, 3 May 2017 18:11:13 +0000 (20:11 +0200)
Fix the following warnings when building the tests by using the correct
types:
cast from 'const char *' to 'void *' drops const qualifier
[-Wcast-qual]
implicit conversion changes signedness [-Wsign-conversion]

lib/memdebug.c
lib/mprintf.c

index 32d2adfb5b3c963e45128e898bbb92cf52d7b4d9..516f273c1122f246df67b0eb8fd0c591f340b130 100644 (file)
@@ -236,7 +236,7 @@ char *curl_dostrdup(const char *str, int line, const char *source)
 
   if(source)
     curl_memlog("MEM %s:%d strdup(%p) (%zu) = %p\n",
-                source, line, (void *)str, len, (void *)mem);
+                source, line, (const void *)str, len, (const void *)mem);
 
   return mem;
 }
@@ -480,7 +480,7 @@ void curl_memlog(const char *format, ...)
     nchars = LOGLINE_BUFSIZE - 1;
 
   if(nchars > 0)
-    fwrite(buf, 1, nchars, logfile);
+    fwrite(buf, 1, (size_t)nchars, logfile);
 
   (Curl_cfree)(buf);
 }
index 6d4e733f0c6c1bcf17a773eca5f6a756198125ed..037132c868da61ce26990a5e7bdc15193a09f230 100644 (file)
@@ -610,7 +610,7 @@ static int dprintf_formatf(
     int is_neg;
 
     /* Base of a number to be written.  */
-    long base;
+    unsigned long base;
 
     /* Integral values to be written.  */
     mp_uintmax_t num;