1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-09-03 01:21:16 +03:00

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 <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf
2014-03-23 23:38:51 +01:00
parent 9665010252
commit c4647ea6d3

View File

@@ -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