Commit 64cfe1d3 authored by Sergey Lyubka's avatar Sergey Lyubka

Merge pull request #49 from nullable-type/master

Avoid some level-4 warnings issued by Visual Studio (2012 and possibly previous versions)
parents 69b0b58d eb92b5f1
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
#define __STDC_LIMIT_MACROS // C++ wants that for INT64_MAX #define __STDC_LIMIT_MACROS // C++ wants that for INT64_MAX
#endif #endif
#if defined (_MSC_VER)
#pragma warning (disable : 4127) // conditional expression is constant: introduced by FD_SET(..)
#pragma warning (disable : 4204) // non-constant aggregate initializer: issued due to missing C99 support
#endif
// Disable WIN32_LEAN_AND_MEAN. // Disable WIN32_LEAN_AND_MEAN.
// This makes windows.h always include winsock2.h // This makes windows.h always include winsock2.h
#ifdef WIN32_LEAN_AND_MEAN #ifdef WIN32_LEAN_AND_MEAN
...@@ -146,6 +151,8 @@ static int pthread_mutex_lock(pthread_mutex_t *); ...@@ -146,6 +151,8 @@ static int pthread_mutex_lock(pthread_mutex_t *);
static int pthread_mutex_unlock(pthread_mutex_t *); static int pthread_mutex_unlock(pthread_mutex_t *);
static void to_unicode(const char *path, wchar_t *wbuf, size_t wbuf_len); static void to_unicode(const char *path, wchar_t *wbuf, size_t wbuf_len);
struct file;
static char *mg_fgets(char *buf, size_t size, struct file *filep, char **p); static char *mg_fgets(char *buf, size_t size, struct file *filep, char **p);
#if defined(HAVE_STDINT) #if defined(HAVE_STDINT)
...@@ -5075,6 +5082,7 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data, ...@@ -5075,6 +5082,7 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data,
} }
if (ctx->config[i] != NULL) { if (ctx->config[i] != NULL) {
cry(fc(ctx), "warning: %s: duplicate option", name); cry(fc(ctx), "warning: %s: duplicate option", name);
free(ctx->config[i]);
} }
ctx->config[i] = mg_strdup(value); ctx->config[i] = mg_strdup(value);
DEBUG_TRACE(("[%s] -> [%s]", name, value)); DEBUG_TRACE(("[%s] -> [%s]", name, value));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment