Commit c15e2af8 authored by Sergey Lyubka's avatar Sergey Lyubka

Merge pull request #104 from pijyoi/warning-fix

minor fixes to reduce warnings in mingw
parents d7078411 d8536b01
...@@ -1018,14 +1018,11 @@ static void change_slashes_to_backslashes(char *path) { ...@@ -1018,14 +1018,11 @@ static void change_slashes_to_backslashes(char *path) {
// Encode 'path' which is assumed UTF-8 string, into UNICODE string. // Encode 'path' which is assumed UTF-8 string, into UNICODE string.
// wbuf and wbuf_len is a target buffer and its length. // wbuf and wbuf_len is a target buffer and its length.
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) {
char buf[PATH_MAX], buf2[PATH_MAX], *p; char buf[PATH_MAX], buf2[PATH_MAX];
mg_strlcpy(buf, path, sizeof(buf)); mg_strlcpy(buf, path, sizeof(buf));
change_slashes_to_backslashes(buf); change_slashes_to_backslashes(buf);
// Point p to the end of the file name
p = buf + strlen(buf) - 1;
// Convert to Unicode and back. If doubly-converted string does not // Convert to Unicode and back. If doubly-converted string does not
// match the original, something is fishy, reject. // match the original, something is fishy, reject.
memset(wbuf, 0, wbuf_len * sizeof(wchar_t)); memset(wbuf, 0, wbuf_len * sizeof(wchar_t));
...@@ -1336,7 +1333,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog, ...@@ -1336,7 +1333,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog,
DEBUG_TRACE(("Running [%s]", cmdline)); DEBUG_TRACE(("Running [%s]", cmdline));
if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE,
CREATE_NEW_PROCESS_GROUP, envblk, NULL, &si, &pi) == 0) { CREATE_NEW_PROCESS_GROUP, envblk, NULL, &si, &pi) == 0) {
cry(conn, "%s: CreateProcess(%s): %d", cry(conn, "%s: CreateProcess(%s): %ld",
__func__, cmdline, ERRNO); __func__, cmdline, ERRNO);
pi.hProcess = (pid_t) -1; pi.hProcess = (pid_t) -1;
} }
...@@ -4696,7 +4693,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl, ...@@ -4696,7 +4693,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl,
struct mg_connection *conn = NULL; struct mg_connection *conn = NULL;
struct sockaddr_in sin; struct sockaddr_in sin;
struct hostent *he; struct hostent *he;
int sock; SOCKET sock;
if (host == NULL) { if (host == NULL) {
snprintf(ebuf, ebuf_len, "%s", "NULL host"); snprintf(ebuf, ebuf_len, "%s", "NULL host");
...@@ -5195,7 +5192,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks, ...@@ -5195,7 +5192,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
// Start worker threads // Start worker threads
for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) { for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) {
if (mg_start_thread(worker_thread, ctx) != 0) { if (mg_start_thread(worker_thread, ctx) != 0) {
cry(fc(ctx), "Cannot start worker thread: %d", ERRNO); cry(fc(ctx), "Cannot start worker thread: %ld", ERRNO);
} else { } else {
ctx->num_threads++; ctx->num_threads++;
} }
......
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