aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-06-13 13:04:36 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-06-13 13:04:36 +0300
commit04d8449af5d2908adce7dfae256bbc0694b8552f (patch)
treee52b5f62c462f860f49fdb81f719d89051c60404
parent2c54092e7e608e6121addbfebbb8c6283de609f8 (diff)
downloadlibmicrohttpd-04d8449af5d2908adce7dfae256bbc0694b8552f.tar.gz
libmicrohttpd-04d8449af5d2908adce7dfae256bbc0694b8552f.zip
memorypool: fixed build with VC, minor fixes
-rw-r--r--src/microhttpd/memorypool.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 20ab4908..c7541cda 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -33,7 +33,7 @@
33#include <sys/mman.h> 33#include <sys/mman.h>
34#endif 34#endif
35#ifdef _WIN32 35#ifdef _WIN32
36#include <memoryapi.h> 36#include <windows.h>
37#endif 37#endif
38 38
39/* define MAP_ANONYMOUS for Mac OS X */ 39/* define MAP_ANONYMOUS for Mac OS X */
@@ -42,7 +42,7 @@
42#endif 42#endif
43#if defined(_WIN32) 43#if defined(_WIN32)
44#define MAP_FAILED NULL 44#define MAP_FAILED NULL
45#elif ! defined(MAP_FAILED) 45#elif !defined(MAP_FAILED)
46#define MAP_FAILED ((void*)-1) 46#define MAP_FAILED ((void*)-1)
47#endif 47#endif
48 48
@@ -126,8 +126,7 @@ MHD_pool_create (size_t max)
126#else 126#else
127 pool->memory = MAP_FAILED; 127 pool->memory = MAP_FAILED;
128#endif 128#endif
129 if ( (MAP_FAILED == pool->memory) || 129 if (MAP_FAILED == pool->memory)
130 (NULL == pool->memory))
131 { 130 {
132 pool->memory = malloc (max); 131 pool->memory = malloc (max);
133 if (NULL == pool->memory) 132 if (NULL == pool->memory)
@@ -285,7 +284,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
285 pool->pos = new_apos; 284 pool->pos = new_apos;
286 /* Zero-out unused part if shrinking */ 285 /* Zero-out unused part if shrinking */
287 if (old_size > new_size) 286 if (old_size > new_size)
288 memset (old + new_size, 0, old_size - new_size); 287 memset ((uint8_t*)old + new_size, 0, old_size - new_size);
289 return old; 288 return old;
290 } 289 }
291 } 290 }