aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-09-29 18:52:34 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-09-29 22:07:49 +0300
commit3f5fe81d43728e9d7eecad00234ce244fa8211be (patch)
tree1f7c7be89f1899fef0b607dc7b0d98a69ff9691b
parenta5b63e992bb1d45982269cd4be4d8990414acc17 (diff)
downloadlibmicrohttpd-3f5fe81d43728e9d7eecad00234ce244fa8211be.tar.gz
libmicrohttpd-3f5fe81d43728e9d7eecad00234ce244fa8211be.zip
Fixed compiler warnings for tests in src/microhttpd
-rw-r--r--src/microhttpd/test_daemon.c9
-rw-r--r--src/microhttpd/test_http_reasons.c2
-rw-r--r--src/microhttpd/test_postprocessor.c31
-rw-r--r--src/microhttpd/test_postprocessor_amp.c3
-rw-r--r--src/microhttpd/test_postprocessor_large.c7
-rw-r--r--src/microhttpd/test_shutdown_select.c1
-rw-r--r--src/microhttpd/test_str_token.c1
-rw-r--r--src/microhttpd/test_upgrade.c8
8 files changed, 46 insertions, 16 deletions
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c
index f22ca138..e3b72bcd 100644
--- a/src/microhttpd/test_daemon.c
+++ b/src/microhttpd/test_daemon.c
@@ -57,6 +57,8 @@ apc_nothing (void *cls,
57 const struct sockaddr *addr, 57 const struct sockaddr *addr,
58 socklen_t addrlen) 58 socklen_t addrlen)
59{ 59{
60 (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */
61
60 return MHD_NO; 62 return MHD_NO;
61} 63}
62 64
@@ -66,6 +68,8 @@ apc_all (void *cls,
66 const struct sockaddr *addr, 68 const struct sockaddr *addr,
67 socklen_t addrlen) 69 socklen_t addrlen)
68{ 70{
71 (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */
72
69 return MHD_YES; 73 return MHD_YES;
70} 74}
71 75
@@ -79,6 +83,10 @@ ahc_nothing (void *cls,
79 const char *upload_data, size_t *upload_data_size, 83 const char *upload_data, size_t *upload_data_size,
80 void **unused) 84 void **unused)
81{ 85{
86 (void)cls;(void)connection;(void)url; /* Unused. Silent compiler warning. */
87 (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */
88 (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */
89
82 return MHD_NO; 90 return MHD_NO;
83} 91}
84 92
@@ -215,6 +223,7 @@ main (int argc,
215 char *const *argv) 223 char *const *argv)
216{ 224{
217 int errorCount = 0; 225 int errorCount = 0;
226 (void)argc; (void)argv; /* Unused. Silent compiler warning. */
218 227
219 errorCount += testStartError (); 228 errorCount += testStartError ();
220 errorCount += testStartStop (); 229 errorCount += testStartStop ();
diff --git a/src/microhttpd/test_http_reasons.c b/src/microhttpd/test_http_reasons.c
index 1a78e2c6..a4dab63a 100644
--- a/src/microhttpd/test_http_reasons.c
+++ b/src/microhttpd/test_http_reasons.c
@@ -121,6 +121,8 @@ static int test_5xx(void)
121int main(int argc, char * argv[]) 121int main(int argc, char * argv[])
122{ 122{
123 int errcount = 0; 123 int errcount = 0;
124 (void)argc; (void)argv; /* Unused. Silent compiler warning. */
125
124 errcount += test_absent_codes(); 126 errcount += test_absent_codes();
125 errcount += test_1xx(); 127 errcount += test_1xx();
126 errcount += test_2xx(); 128 errcount += test_2xx();
diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c
index 029600a2..8edc5b22 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -91,6 +91,8 @@ value_checker (void *cls,
91{ 91{
92 int *want_off = cls; 92 int *want_off = cls;
93 int idx = *want_off; 93 int idx = *want_off;
94 (void)kind; /* Unused. Silent compiler warning. */
95
94 96
95#if 0 97#if 0
96 fprintf (stderr, 98 fprintf (stderr,
@@ -120,14 +122,14 @@ value_checker (void *cls,
120 122
121 123
122static int 124static int
123test_urlencoding () 125test_urlencoding (void)
124{ 126{
125 struct MHD_Connection connection; 127 struct MHD_Connection connection;
126 struct MHD_HTTP_Header header; 128 struct MHD_HTTP_Header header;
127 struct MHD_PostProcessor *pp; 129 struct MHD_PostProcessor *pp;
128 unsigned int want_off = URL_START; 130 unsigned int want_off = URL_START;
129 int i; 131 size_t i;
130 int delta; 132 size_t delta;
131 size_t size; 133 size_t size;
132 134
133 memset (&connection, 0, sizeof (struct MHD_Connection)); 135 memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -154,7 +156,7 @@ test_urlencoding ()
154 156
155 157
156static int 158static int
157test_multipart_garbage () 159test_multipart_garbage (void)
158{ 160{
159 struct MHD_Connection connection; 161 struct MHD_Connection connection;
160 struct MHD_HTTP_Header header; 162 struct MHD_HTTP_Header header;
@@ -195,7 +197,7 @@ test_multipart_garbage ()
195 197
196 198
197static int 199static int
198test_multipart_splits () 200test_multipart_splits (void)
199{ 201{
200 struct MHD_Connection connection; 202 struct MHD_Connection connection;
201 struct MHD_HTTP_Header header; 203 struct MHD_HTTP_Header header;
@@ -228,14 +230,14 @@ test_multipart_splits ()
228 230
229 231
230static int 232static int
231test_multipart () 233test_multipart (void)
232{ 234{
233 struct MHD_Connection connection; 235 struct MHD_Connection connection;
234 struct MHD_HTTP_Header header; 236 struct MHD_HTTP_Header header;
235 struct MHD_PostProcessor *pp; 237 struct MHD_PostProcessor *pp;
236 unsigned int want_off = FORM_START; 238 unsigned int want_off = FORM_START;
237 int i; 239 size_t i;
238 int delta; 240 size_t delta;
239 size_t size; 241 size_t size;
240 242
241 memset (&connection, 0, sizeof (struct MHD_Connection)); 243 memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -263,14 +265,14 @@ test_multipart ()
263 265
264 266
265static int 267static int
266test_nested_multipart () 268test_nested_multipart (void)
267{ 269{
268 struct MHD_Connection connection; 270 struct MHD_Connection connection;
269 struct MHD_HTTP_Header header; 271 struct MHD_HTTP_Header header;
270 struct MHD_PostProcessor *pp; 272 struct MHD_PostProcessor *pp;
271 unsigned int want_off = FORM_NESTED_START; 273 unsigned int want_off = FORM_NESTED_START;
272 int i; 274 size_t i;
273 int delta; 275 size_t delta;
274 size_t size; 276 size_t size;
275 277
276 memset (&connection, 0, sizeof (struct MHD_Connection)); 278 memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -298,14 +300,14 @@ test_nested_multipart ()
298 300
299 301
300static int 302static int
301test_empty_value () 303test_empty_value (void)
302{ 304{
303 struct MHD_Connection connection; 305 struct MHD_Connection connection;
304 struct MHD_HTTP_Header header; 306 struct MHD_HTTP_Header header;
305 struct MHD_PostProcessor *pp; 307 struct MHD_PostProcessor *pp;
306 unsigned int want_off = URL_EMPTY_VALUE_START; 308 unsigned int want_off = URL_EMPTY_VALUE_START;
307 int i; 309 size_t i;
308 int delta; 310 size_t delta;
309 size_t size; 311 size_t size;
310 312
311 memset (&connection, 0, sizeof (struct MHD_Connection)); 313 memset (&connection, 0, sizeof (struct MHD_Connection));
@@ -337,6 +339,7 @@ int
337main (int argc, char *const *argv) 339main (int argc, char *const *argv)
338{ 340{
339 unsigned int errorCount = 0; 341 unsigned int errorCount = 0;
342 (void)argc; (void)argv; /* Unused. Silent compiler warning. */
340 343
341 errorCount += test_multipart_splits (); 344 errorCount += test_multipart_splits ();
342 errorCount += test_multipart_garbage (); 345 errorCount += test_multipart_garbage ();
diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c
index 73f72f92..ef271810 100644
--- 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,
11 const char* content_encoding, const char* data, 11 const char* content_encoding, const char* data,
12 uint64_t off, size_t size) 12 uint64_t off, size_t size)
13{ 13{
14 (void)cls; (void)kind; (void)filename; (void)content_type; /* Unused. Silent compiler warning. */
15 (void)content_encoding; (void)data; (void)off; (void)size; /* Unused. Silent compiler warning. */
14 if ((0 != strcmp(key, "a")) && (0 != strcmp(key, "b"))) 16 if ((0 != strcmp(key, "a")) && (0 != strcmp(key, "b")))
15 { 17 {
16 printf("ERROR: got unexpected '%s'\n", key); 18 printf("ERROR: got unexpected '%s'\n", key);
@@ -26,6 +28,7 @@ main (int argc, char *const *argv)
26 struct MHD_Connection connection; 28 struct MHD_Connection connection;
27 struct MHD_HTTP_Header header; 29 struct MHD_HTTP_Header header;
28 struct MHD_PostProcessor *pp; 30 struct MHD_PostProcessor *pp;
31 (void)argc; (void)argv; /* Unused. Silent compiler warning. */
29 32
30 memset (&connection, 0, sizeof (struct MHD_Connection)); 33 memset (&connection, 0, sizeof (struct MHD_Connection));
31 memset (&header, 0, sizeof (struct MHD_HTTP_Header)); 34 memset (&header, 0, sizeof (struct MHD_HTTP_Header));
diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c
index a509a7ba..13e8c78f 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -43,6 +43,8 @@ value_checker (void *cls,
43 const char *data, uint64_t off, size_t size) 43 const char *data, uint64_t off, size_t size)
44{ 44{
45 unsigned int *pos = cls; 45 unsigned int *pos = cls;
46 (void)kind; (void)key; (void)filename; (void)content_type; /* Unused. Silent compiler warning. */
47 (void)transfer_encoding; (void)data; (void)off; /* Unused. Silent compiler warning. */
46#if 0 48#if 0
47 fprintf (stderr, 49 fprintf (stderr,
48 "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n", 50 "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n",
@@ -63,8 +65,8 @@ test_simple_large ()
63 struct MHD_Connection connection; 65 struct MHD_Connection connection;
64 struct MHD_HTTP_Header header; 66 struct MHD_HTTP_Header header;
65 struct MHD_PostProcessor *pp; 67 struct MHD_PostProcessor *pp;
66 int i; 68 size_t i;
67 int delta; 69 size_t delta;
68 size_t size; 70 size_t size;
69 char data[102400]; 71 char data[102400];
70 unsigned int pos; 72 unsigned int pos;
@@ -98,6 +100,7 @@ int
98main (int argc, char *const *argv) 100main (int argc, char *const *argv)
99{ 101{
100 unsigned int errorCount = 0; 102 unsigned int errorCount = 0;
103 (void)argc; (void)argv; /* Unused. Silent compiler warning. */
101 104
102 errorCount += test_simple_large (); 105 errorCount += test_simple_large ();
103 if (errorCount != 0) 106 if (errorCount != 0)
diff --git a/src/microhttpd/test_shutdown_select.c b/src/microhttpd/test_shutdown_select.c
index e3cd0249..e8942c0b 100644
--- a/src/microhttpd/test_shutdown_select.c
+++ b/src/microhttpd/test_shutdown_select.c
@@ -286,6 +286,7 @@ main (int argc, char *const *argv)
286#endif /* MHD_WINSOCK_SOCKETS */ 286#endif /* MHD_WINSOCK_SOCKETS */
287 bool test_poll; 287 bool test_poll;
288 bool must_ignore; 288 bool must_ignore;
289 (void)argc; /* Unused. Silent compiler warning. */
289 290
290 test_poll = has_in_name(argv[0], "_poll"); 291 test_poll = has_in_name(argv[0], "_poll");
291 must_ignore = has_in_name(argv[0], "_ignore"); 292 must_ignore = has_in_name(argv[0], "_ignore");
diff --git a/src/microhttpd/test_str_token.c b/src/microhttpd/test_str_token.c
index 464cc7a5..15f3f406 100644
--- a/src/microhttpd/test_str_token.c
+++ b/src/microhttpd/test_str_token.c
@@ -111,6 +111,7 @@ int check_not_match(void)
111int main(int argc, char * argv[]) 111int main(int argc, char * argv[])
112{ 112{
113 int errcount = 0; 113 int errcount = 0;
114 (void)argc; (void)argv; /* Unused. Silent compiler warning. */
114 errcount += check_match(); 115 errcount += check_match();
115 errcount += check_not_match(); 116 errcount += check_not_match();
116 return errcount == 0 ? 0 : 1; 117 return errcount == 0 ? 0 : 1;
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index b1a234cb..377e712d 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -443,6 +443,7 @@ notify_completed_cb (void *cls,
443 void **con_cls, 443 void **con_cls,
444 enum MHD_RequestTerminationCode toe) 444 enum MHD_RequestTerminationCode toe)
445{ 445{
446 (void)cls; (void)connection; /* Unused. Silent compiler warning. */
446 if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) && 447 if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) &&
447 (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && 448 (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) &&
448 (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) 449 (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) )
@@ -468,6 +469,8 @@ log_cb (void *cls,
468 struct MHD_Connection *connection) 469 struct MHD_Connection *connection)
469{ 470{
470 pthread_t* ppth; 471 pthread_t* ppth;
472 (void)cls; (void)connection; /* Unused. Silent compiler warning. */
473
471 if (0 != strcmp (uri, 474 if (0 != strcmp (uri,
472 "/")) 475 "/"))
473 abort (); 476 abort ();
@@ -505,6 +508,7 @@ notify_connection_cb (void *cls,
505 enum MHD_ConnectionNotificationCode toe) 508 enum MHD_ConnectionNotificationCode toe)
506{ 509{
507 static int started; 510 static int started;
511 (void)cls; (void)connection; /* Unused. Silent compiler warning. */
508 512
509 switch (toe) 513 switch (toe)
510 { 514 {
@@ -759,6 +763,7 @@ upgrade_cb (void *cls,
759 MHD_socket sock, 763 MHD_socket sock,
760 struct MHD_UpgradeResponseHandle *urh) 764 struct MHD_UpgradeResponseHandle *urh)
761{ 765{
766 (void)cls; (void)connection; (void)con_cls; (void)extra_in; /* Unused. Silent compiler warning. */
762 usock = wr_create_from_plain_sckt (sock); 767 usock = wr_create_from_plain_sckt (sock);
763 if (0 != extra_in_size) 768 if (0 != extra_in_size)
764 abort (); 769 abort ();
@@ -821,6 +826,8 @@ ahc_upgrade (void *cls,
821{ 826{
822 struct MHD_Response *resp; 827 struct MHD_Response *resp;
823 int ret; 828 int ret;
829 (void)cls;(void)url;(void)method; /* Unused. Silent compiler warning. */
830 (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */
824 831
825 if (NULL == *con_cls) 832 if (NULL == *con_cls)
826 abort (); 833 abort ();
@@ -898,6 +905,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
898static void 905static void
899run_mhd_poll_loop (struct MHD_Daemon *daemon) 906run_mhd_poll_loop (struct MHD_Daemon *daemon)
900{ 907{
908 (void)daemon; /* Unused. Silent compiler warning. */
901 abort (); /* currently not implementable with existing MHD API */ 909 abort (); /* currently not implementable with existing MHD API */
902} 910}
903#endif /* HAVE_POLL */ 911#endif /* HAVE_POLL */