소스 검색

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>
Danny Al-Gaaf 11 년 전
부모
커밋
c4647ea6d3
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      src/civetweb.c

+ 4 - 4
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