From c4647ea6d3babcaac6a444fc14d355d48a80931a Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sun, 23 Mar 2014 23:38:51 +0100 Subject: [PATCH] civetweb.c: fix sprintf format specifier Change %u to %lu and cast size_t to unsigned long to fix: [src/civetweb.c:360]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [src/civetweb.c:360]: (warning) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:360]: (warning) %u in format string (no. 4) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:388]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [src/civetweb.c:388]: (warning) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:388]: (warning) %u in format string (no. 4) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:414]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [src/civetweb.c:414]: (warning) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:414]: (warning) %u in format string (no. 4) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:421]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'. [src/civetweb.c:421]: (warning) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'unsigned long'. [src/civetweb.c:421]: (warning) %u in format string (no. 4) requires 'unsigned int' but the argument type is 'unsigned long'. Signed-off-by: Danny Al-Gaaf --- src/civetweb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/civetweb.c b/src/civetweb.c index 80cf0ac5..6f7906f8 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -398,7 +398,7 @@ static void * mg_malloc_ex(size_t size, const char * file, unsigned line) { memory = (void *)(((char*)data)+sizeof(size_t)); } - sprintf(mallocStr, "MEM: %p %5u alloc %7u %4u --- %s:%u\n", memory, size, totalMemUsed, blockCount, file, line); + sprintf(mallocStr, "MEM: %p %5lu alloc %7lu %4lu --- %s:%u\n", memory, (unsigned long)size, totalMemUsed, blockCount, file, line); #if defined(_WIN32) OutputDebugStringA(mallocStr); #else @@ -426,7 +426,7 @@ static void mg_free_ex(void * memory, const char * file, unsigned line) { size = *(size_t*)data; totalMemUsed -= size; blockCount--; - sprintf(mallocStr, "MEM: %p %5u free %7u %4u --- %s:%u\n", memory, size, totalMemUsed, blockCount, file, line); + sprintf(mallocStr, "MEM: %p %5lu free %7lu %4lu --- %s:%u\n", memory, (unsigned long)size, totalMemUsed, blockCount, file, line); #if defined(_WIN32) OutputDebugStringA(mallocStr); #else @@ -452,14 +452,14 @@ static void * mg_realloc_ex(void * memory, size_t newsize, const char * file, un if (_realloc) { data = _realloc; totalMemUsed -= oldsize; - sprintf(mallocStr, "MEM: %p %5u r-free %7u %4u --- %s:%u\n", memory, oldsize, totalMemUsed, blockCount, file, line); + sprintf(mallocStr, "MEM: %p %5lu r-free %7lu %4lu --- %s:%u\n", memory, (unsigned long)oldsize, totalMemUsed, blockCount, file, line); #if defined(_WIN32) OutputDebugStringA(mallocStr); #else DEBUG_TRACE("%s", mallocStr); #endif totalMemUsed += newsize; - sprintf(mallocStr, "MEM: %p %5u r-alloc %7u %4u --- %s:%u\n", memory, newsize, totalMemUsed, blockCount, file, line); + sprintf(mallocStr, "MEM: %p %5lu r-alloc %7lu %4lu --- %s:%u\n", memory, (unsigned long)newsize, totalMemUsed, blockCount, file, line); #if defined(_WIN32) OutputDebugStringA(mallocStr); #else