libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 3f5fe81d43728e9d7eecad00234ce244fa8211be
parent a5b63e992bb1d45982269cd4be4d8990414acc17
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Fri, 29 Sep 2017 18:52:34 +0300

Fixed compiler warnings for tests in src/microhttpd

Diffstat:
Msrc/microhttpd/test_daemon.c | 9+++++++++
Msrc/microhttpd/test_http_reasons.c | 2++
Msrc/microhttpd/test_postprocessor.c | 31+++++++++++++++++--------------
Msrc/microhttpd/test_postprocessor_amp.c | 3+++
Msrc/microhttpd/test_postprocessor_large.c | 7+++++--
Msrc/microhttpd/test_shutdown_select.c | 1+
Msrc/microhttpd/test_str_token.c | 1+
Msrc/microhttpd/test_upgrade.c | 8++++++++
8 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c @@ -57,6 +57,8 @@ apc_nothing (void *cls, const struct sockaddr *addr, socklen_t addrlen) { + (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */ + return MHD_NO; } @@ -66,6 +68,8 @@ apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen) { + (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */ + return MHD_YES; } @@ -79,6 +83,10 @@ ahc_nothing (void *cls, const char *upload_data, size_t *upload_data_size, void **unused) { + (void)cls;(void)connection;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + return MHD_NO; } @@ -215,6 +223,7 @@ main (int argc, char *const *argv) { int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ errorCount += testStartError (); errorCount += testStartStop (); diff --git a/src/microhttpd/test_http_reasons.c b/src/microhttpd/test_http_reasons.c @@ -121,6 +121,8 @@ static int test_5xx(void) int main(int argc, char * argv[]) { int errcount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + errcount += test_absent_codes(); errcount += test_1xx(); errcount += test_2xx(); diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c @@ -91,6 +91,8 @@ value_checker (void *cls, { int *want_off = cls; int idx = *want_off; + (void)kind; /* Unused. Silent compiler warning. */ + #if 0 fprintf (stderr, @@ -120,14 +122,14 @@ value_checker (void *cls, static int -test_urlencoding () +test_urlencoding (void) { struct MHD_Connection connection; struct MHD_HTTP_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = URL_START; - int i; - int delta; + size_t i; + size_t delta; size_t size; memset (&connection, 0, sizeof (struct MHD_Connection)); @@ -154,7 +156,7 @@ test_urlencoding () static int -test_multipart_garbage () +test_multipart_garbage (void) { struct MHD_Connection connection; struct MHD_HTTP_Header header; @@ -195,7 +197,7 @@ test_multipart_garbage () static int -test_multipart_splits () +test_multipart_splits (void) { struct MHD_Connection connection; struct MHD_HTTP_Header header; @@ -228,14 +230,14 @@ test_multipart_splits () static int -test_multipart () +test_multipart (void) { struct MHD_Connection connection; struct MHD_HTTP_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = FORM_START; - int i; - int delta; + size_t i; + size_t delta; size_t size; memset (&connection, 0, sizeof (struct MHD_Connection)); @@ -263,14 +265,14 @@ test_multipart () static int -test_nested_multipart () +test_nested_multipart (void) { struct MHD_Connection connection; struct MHD_HTTP_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = FORM_NESTED_START; - int i; - int delta; + size_t i; + size_t delta; size_t size; memset (&connection, 0, sizeof (struct MHD_Connection)); @@ -298,14 +300,14 @@ test_nested_multipart () static int -test_empty_value () +test_empty_value (void) { struct MHD_Connection connection; struct MHD_HTTP_Header header; struct MHD_PostProcessor *pp; unsigned int want_off = URL_EMPTY_VALUE_START; - int i; - int delta; + size_t i; + size_t delta; size_t size; memset (&connection, 0, sizeof (struct MHD_Connection)); @@ -337,6 +339,7 @@ int main (int argc, char *const *argv) { unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ errorCount += test_multipart_splits (); errorCount += test_multipart_garbage (); diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c @@ -11,6 +11,8 @@ int check_post(void *cls, enum MHD_ValueKind kind, const char* key, const char* content_encoding, const char* data, uint64_t off, size_t size) { + (void)cls; (void)kind; (void)filename; (void)content_type; /* Unused. Silent compiler warning. */ + (void)content_encoding; (void)data; (void)off; (void)size; /* Unused. Silent compiler warning. */ if ((0 != strcmp(key, "a")) && (0 != strcmp(key, "b"))) { printf("ERROR: got unexpected '%s'\n", key); @@ -26,6 +28,7 @@ main (int argc, char *const *argv) struct MHD_Connection connection; struct MHD_HTTP_Header header; struct MHD_PostProcessor *pp; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ memset (&connection, 0, sizeof (struct MHD_Connection)); memset (&header, 0, sizeof (struct MHD_HTTP_Header)); diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c @@ -43,6 +43,8 @@ value_checker (void *cls, const char *data, uint64_t off, size_t size) { unsigned int *pos = cls; + (void)kind; (void)key; (void)filename; (void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding; (void)data; (void)off; /* Unused. Silent compiler warning. */ #if 0 fprintf (stderr, "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n", @@ -63,8 +65,8 @@ test_simple_large () struct MHD_Connection connection; struct MHD_HTTP_Header header; struct MHD_PostProcessor *pp; - int i; - int delta; + size_t i; + size_t delta; size_t size; char data[102400]; unsigned int pos; @@ -98,6 +100,7 @@ int main (int argc, char *const *argv) { unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ errorCount += test_simple_large (); if (errorCount != 0) diff --git a/src/microhttpd/test_shutdown_select.c b/src/microhttpd/test_shutdown_select.c @@ -286,6 +286,7 @@ main (int argc, char *const *argv) #endif /* MHD_WINSOCK_SOCKETS */ bool test_poll; bool must_ignore; + (void)argc; /* Unused. Silent compiler warning. */ test_poll = has_in_name(argv[0], "_poll"); must_ignore = has_in_name(argv[0], "_ignore"); diff --git a/src/microhttpd/test_str_token.c b/src/microhttpd/test_str_token.c @@ -111,6 +111,7 @@ int check_not_match(void) int main(int argc, char * argv[]) { int errcount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ errcount += check_match(); errcount += check_not_match(); return errcount == 0 ? 0 : 1; diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c @@ -443,6 +443,7 @@ notify_completed_cb (void *cls, void **con_cls, enum MHD_RequestTerminationCode toe) { + (void)cls; (void)connection; /* Unused. Silent compiler warning. */ if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) && (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) @@ -468,6 +469,8 @@ log_cb (void *cls, struct MHD_Connection *connection) { pthread_t* ppth; + (void)cls; (void)connection; /* Unused. Silent compiler warning. */ + if (0 != strcmp (uri, "/")) abort (); @@ -505,6 +508,7 @@ notify_connection_cb (void *cls, enum MHD_ConnectionNotificationCode toe) { static int started; + (void)cls; (void)connection; /* Unused. Silent compiler warning. */ switch (toe) { @@ -759,6 +763,7 @@ upgrade_cb (void *cls, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh) { + (void)cls; (void)connection; (void)con_cls; (void)extra_in; /* Unused. Silent compiler warning. */ usock = wr_create_from_plain_sckt (sock); if (0 != extra_in_size) abort (); @@ -821,6 +826,8 @@ ahc_upgrade (void *cls, { struct MHD_Response *resp; int ret; + (void)cls;(void)url;(void)method; /* Unused. Silent compiler warning. */ + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ if (NULL == *con_cls) abort (); @@ -898,6 +905,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon) static void run_mhd_poll_loop (struct MHD_Daemon *daemon) { + (void)daemon; /* Unused. Silent compiler warning. */ abort (); /* currently not implementable with existing MHD API */ } #endif /* HAVE_POLL */