From d3c02331d47cc1653a195f6b2d023772eaaaa3df Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 24 Feb 2013 23:22:34 +0800 Subject: [PATCH 1/3] squash mingw printf format warning --- mongoose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 3cb1be74..8459a43e 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1336,7 +1336,7 @@ static pid_t spawn_process(struct mg_connection *conn, const char *prog, DEBUG_TRACE(("Running [%s]", cmdline)); if (CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, CREATE_NEW_PROCESS_GROUP, envblk, NULL, &si, &pi) == 0) { - cry(conn, "%s: CreateProcess(%s): %d", + cry(conn, "%s: CreateProcess(%s): %ld", __func__, cmdline, ERRNO); pi.hProcess = (pid_t) -1; } @@ -5195,7 +5195,7 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks, // Start worker threads for (i = 0; i < atoi(ctx->config[NUM_THREADS]); i++) { 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 { ctx->num_threads++; } From a2239c2b4b86a3ecaf19282143fa03c0b4366ac4 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 24 Feb 2013 23:29:05 +0800 Subject: [PATCH 2/3] squash mingw variable set but not used warning --- mongoose.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mongoose.c b/mongoose.c index 8459a43e..a17d1e45 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1018,14 +1018,11 @@ static void change_slashes_to_backslashes(char *path) { // Encode 'path' which is assumed UTF-8 string, into UNICODE string. // 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) { - char buf[PATH_MAX], buf2[PATH_MAX], *p; + char buf[PATH_MAX], buf2[PATH_MAX]; mg_strlcpy(buf, path, sizeof(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 // match the original, something is fishy, reject. memset(wbuf, 0, wbuf_len * sizeof(wchar_t)); From d8536b011cca06b77e2dae26a0731071ed254d7d Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 24 Feb 2013 23:41:32 +0800 Subject: [PATCH 3/3] portable socket type should be SOCKET --- mongoose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index a17d1e45..5b715c01 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4693,7 +4693,7 @@ struct mg_connection *mg_connect(const char *host, int port, int use_ssl, struct mg_connection *conn = NULL; struct sockaddr_in sin; struct hostent *he; - int sock; + SOCKET sock; if (host == NULL) { snprintf(ebuf, ebuf_len, "%s", "NULL host");