From 447bf4adb0c5a56af86ab108d338b660ff41c560 Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Mon, 8 Aug 2016 11:25:55 +0100 Subject: [PATCH] Compile examples with -Werror PUBLISHED_FROM=5a24bda9029db3fc7bf04dc871656d65d551f4ab --- examples/examples.mk | 2 +- examples/publish_subscribe/publish_subscribe.c | 5 +++-- mongoose.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/examples.mk b/examples/examples.mk index 631fa1e0..7b258f22 100644 --- a/examples/examples.mk +++ b/examples/examples.mk @@ -1,5 +1,5 @@ SOURCES = $(PROG).c ../../mongoose.c -CFLAGS = -g -W -Wall -I../.. -Wno-unused-function $(CFLAGS_EXTRA) $(MODULE_CFLAGS) +CFLAGS = -g -W -Wall -Werror -I../.. -Wno-unused-function $(CFLAGS_EXTRA) $(MODULE_CFLAGS) all: $(PROG) diff --git a/examples/publish_subscribe/publish_subscribe.c b/examples/publish_subscribe/publish_subscribe.c index 25868255..57d987ec 100644 --- a/examples/publish_subscribe/publish_subscribe.c +++ b/examples/publish_subscribe/publish_subscribe.c @@ -20,9 +20,10 @@ static void *stdin_thread(void *param) { int ch, sock = *(int *) param; + // Forward all types characters to the socketpair while ((ch = getchar()) != EOF) { unsigned char c = (unsigned char) ch; - send(sock, &c, 1, 0); // Forward all types characters to the socketpair + send(sock, (const char *) &c, 1, 0); } return NULL; } @@ -75,7 +76,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Usage: %s \n", argv[0]); exit(EXIT_FAILURE); } else if (strcmp(argv[2], "client") == 0) { - int fds[2]; + sock_t fds[2]; struct mg_connection *ioconn, *server_conn; mg_mgr_init(&mgr, NULL); diff --git a/mongoose.c b/mongoose.c index 18936ee7..9331760b 100644 --- a/mongoose.c +++ b/mongoose.c @@ -6567,6 +6567,7 @@ static pid_t mg_start_process(const char *interp, const char *cmd, /* CloseHandle(pi.hThread); */ /* CloseHandle(pi.hProcess); */ + (void) envp; return pi.hProcess; } #else @@ -8676,7 +8677,7 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) { *key = "SYSTEM\\ControlSet001\\Services\\Tcpip\\Parameters\\Interfaces"; if ((err = RegOpenKeyA(HKEY_LOCAL_MACHINE, key, &hKey)) != ERROR_SUCCESS) { - fprintf(stderr, "cannot open reg key %s: %d\n", key, err); + fprintf(stderr, "cannot open reg key %s: %ld\n", key, err); ret = -1; } else { for (ret = -1, i = 0;