Commit fd839f18 authored by Artem Bulavin's avatar Artem Bulavin Committed by Cesanta Bot

Pointer to int casting warning

PUBLISHED_FROM=6bf2a710edaae6133d68eaf900ede14bba75ad5a
parent f149f4aa
...@@ -1509,7 +1509,7 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *fmt, va_list ap) { ...@@ -1509,7 +1509,7 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *fmt, va_list ap) {
i += c_itoa(buf + i, buf_size - i, va_arg(ap, size_t), i += c_itoa(buf + i, buf_size - i, va_arg(ap, size_t),
ch == 'x' ? 16 : 10, flags, field_width); ch == 'x' ? 16 : 10, flags, field_width);
} else if (ch == 'p') { } else if (ch == 'p') {
unsigned long num = (unsigned long) va_arg(ap, void *); unsigned long num = (unsigned long) (uintptr_t) va_arg(ap, void *);
C_SNPRINTF_APPEND_CHAR('0'); C_SNPRINTF_APPEND_CHAR('0');
C_SNPRINTF_APPEND_CHAR('x'); C_SNPRINTF_APPEND_CHAR('x');
i += c_itoa(buf + i, buf_size - i, num, 16, flags, 0); i += c_itoa(buf + i, buf_size - i, num, 16, flags, 0);
...@@ -5151,7 +5151,7 @@ void mg_send_websocket_handshake2(struct mg_connection *nc, const char *path, ...@@ -5151,7 +5151,7 @@ void mg_send_websocket_handshake2(struct mg_connection *nc, const char *path,
const char *host, const char *protocol, const char *host, const char *protocol,
const char *extra_headers) { const char *extra_headers) {
/* pretty poor source of randomness, TODO fix */ /* pretty poor source of randomness, TODO fix */
unsigned long random = (unsigned long) path; unsigned long random = (unsigned long) (uintptr_t) path;
char key[sizeof(random) * 3]; char key[sizeof(random) * 3];
mg_base64_encode((unsigned char *) &random, sizeof(random), key); mg_base64_encode((unsigned char *) &random, sizeof(random), key);
......
...@@ -186,6 +186,9 @@ ...@@ -186,6 +186,9 @@
#else #else
#define fseeko(x, y, z) fseek((x), (y), (z)) #define fseeko(x, y, z) fseek((x), (y), (z))
#endif #endif
#if defined(_MSC_VER) && _MSC_VER <= 1200
typedef unsigned long uintptr_t;
#endif
typedef int socklen_t; typedef int socklen_t;
#if _MSC_VER >= 1700 #if _MSC_VER >= 1700
#include <stdint.h> #include <stdint.h>
......
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