commit 04d8449af5d2908adce7dfae256bbc0694b8552f
parent 2c54092e7e608e6121addbfebbb8c6283de609f8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Thu, 13 Jun 2019 13:04:36 +0300
memorypool: fixed build with VC, minor fixes
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
@@ -33,7 +33,7 @@
#include <sys/mman.h>
#endif
#ifdef _WIN32
-#include <memoryapi.h>
+#include <windows.h>
#endif
/* define MAP_ANONYMOUS for Mac OS X */
@@ -42,7 +42,7 @@
#endif
#if defined(_WIN32)
#define MAP_FAILED NULL
-#elif ! defined(MAP_FAILED)
+#elif !defined(MAP_FAILED)
#define MAP_FAILED ((void*)-1)
#endif
@@ -126,8 +126,7 @@ MHD_pool_create (size_t max)
#else
pool->memory = MAP_FAILED;
#endif
- if ( (MAP_FAILED == pool->memory) ||
- (NULL == pool->memory))
+ if (MAP_FAILED == pool->memory)
{
pool->memory = malloc (max);
if (NULL == pool->memory)
@@ -285,7 +284,7 @@ MHD_pool_reallocate (struct MemoryPool *pool,
pool->pos = new_apos;
/* Zero-out unused part if shrinking */
if (old_size > new_size)
- memset (old + new_size, 0, old_size - new_size);
+ memset ((uint8_t*)old + new_size, 0, old_size - new_size);
return old;
}
}