diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-12-23 22:40:59 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2020-12-23 22:40:59 +0300 |
commit | 6d7f0a8f54bed3282199afc1bbe9c35c8af80a7f (patch) | |
tree | 3d67768870118ada13569e4d8b9487be57e17297 | |
parent | aee82048c22265757b1b2f99aa709ccdbf6c48ff (diff) | |
download | libmicrohttpd-6d7f0a8f54bed3282199afc1bbe9c35c8af80a7f.tar.gz libmicrohttpd-6d7f0a8f54bed3282199afc1bbe9c35c8af80a7f.zip |
Fixed and muted compiler warnings
-rw-r--r-- | src/microhttpd/mhd_itc_types.h | 5 | ||||
-rw-r--r-- | src/microhttpd/mhd_sockets.c | 1 | ||||
-rw-r--r-- | src/microhttpd/test_postprocessor.c | 3 | ||||
-rw-r--r-- | src/microhttpd/test_postprocessor_md.c | 18 | ||||
-rw-r--r-- | src/testcurl/https/test_https_get.c | 2 | ||||
-rw-r--r-- | src/testcurl/test_add_conn.c | 8 | ||||
-rw-r--r-- | src/testcurl/test_digestauth.c | 19 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_sha256.c | 23 | ||||
-rw-r--r-- | src/testcurl/test_digestauth_with_arguments.c | 17 |
9 files changed, 62 insertions, 34 deletions
diff --git a/src/microhttpd/mhd_itc_types.h b/src/microhttpd/mhd_itc_types.h index bb354d37..04d30239 100644 --- a/src/microhttpd/mhd_itc_types.h +++ b/src/microhttpd/mhd_itc_types.h | |||
@@ -67,7 +67,7 @@ struct MHD_itc_ | |||
67 | /** | 67 | /** |
68 | * Static initialiser for struct MHD_itc_ | 68 | * Static initialiser for struct MHD_itc_ |
69 | */ | 69 | */ |
70 | #define MHD_ITC_STATIC_INIT_INVALID { -1, -1 } | 70 | #define MHD_ITC_STATIC_INIT_INVALID { { -1, -1 } } |
71 | 71 | ||
72 | 72 | ||
73 | #elif defined(_MHD_ITC_SOCKETPAIR) | 73 | #elif defined(_MHD_ITC_SOCKETPAIR) |
@@ -86,7 +86,8 @@ struct MHD_itc_ | |||
86 | /** | 86 | /** |
87 | * Static initialiser for struct MHD_itc_ | 87 | * Static initialiser for struct MHD_itc_ |
88 | */ | 88 | */ |
89 | #define MHD_ITC_STATIC_INIT_INVALID { MHD_INVALID_SOCKET, MHD_INVALID_SOCKET } | 89 | #define MHD_ITC_STATIC_INIT_INVALID \ |
90 | { { MHD_INVALID_SOCKET, MHD_INVALID_SOCKET } } | ||
90 | 91 | ||
91 | #endif /* _MHD_ITC_SOCKETPAIR */ | 92 | #endif /* _MHD_ITC_SOCKETPAIR */ |
92 | 93 | ||
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c index a00330a3..ef3dc35d 100644 --- a/src/microhttpd/mhd_sockets.c +++ b/src/microhttpd/mhd_sockets.c | |||
@@ -538,6 +538,7 @@ MHD_socket_cork_ (MHD_socket sock, | |||
538 | #endif | 538 | #endif |
539 | #else | 539 | #else |
540 | /* do not have MHD_TCP_CORK_NOPUSH at all */ | 540 | /* do not have MHD_TCP_CORK_NOPUSH at all */ |
541 | (void) sock; (void) on; /* Mute compiler warnings */ | ||
541 | return 0; | 542 | return 0; |
542 | #endif | 543 | #endif |
543 | } | 544 | } |
diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c index b77bfb26..4c2ec2e7 100644 --- a/src/microhttpd/test_postprocessor.c +++ b/src/microhttpd/test_postprocessor.c | |||
@@ -462,6 +462,9 @@ value_checker2 (void *cls, | |||
462 | uint64_t off, | 462 | uint64_t off, |
463 | size_t size) | 463 | size_t size) |
464 | { | 464 | { |
465 | (void) cls; (void) kind; (void) key; /* Mute compiler warnings */ | ||
466 | (void) filename; (void) content_type; (void) transfer_encoding; | ||
467 | (void) data; (void) off; (void) size; | ||
465 | return MHD_YES; | 468 | return MHD_YES; |
466 | } | 469 | } |
467 | 470 | ||
diff --git a/src/microhttpd/test_postprocessor_md.c b/src/microhttpd/test_postprocessor_md.c index 2d1cae61..e07a94c3 100644 --- a/src/microhttpd/test_postprocessor_md.c +++ b/src/microhttpd/test_postprocessor_md.c | |||
@@ -50,6 +50,8 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection, | |||
50 | const char **value_ptr, | 50 | const char **value_ptr, |
51 | size_t *value_size_ptr) | 51 | size_t *value_size_ptr) |
52 | { | 52 | { |
53 | (void) connection; (void) kind; (void) key; /* Mute compiler warnings */ | ||
54 | (void) key_size; (void) value_ptr; (void) value_size_ptr; | ||
53 | return MHD_NO; | 55 | return MHD_NO; |
54 | } | 56 | } |
55 | 57 | ||
@@ -73,6 +75,9 @@ post_data_iterator (void *cls, | |||
73 | uint64_t off, | 75 | uint64_t off, |
74 | size_t size) | 76 | size_t size) |
75 | { | 77 | { |
78 | (void) cls; (void) kind; (void) filename; /* Mute compiler warnings */ | ||
79 | (void) content_type; (void) transfer_encoding; | ||
80 | (void) off; /* FIXME: shoudn't be checked? */ | ||
76 | #if DEBUG | 81 | #if DEBUG |
77 | fprintf (stderr, | 82 | fprintf (stderr, |
78 | "%s\t%s\n", | 83 | "%s\t%s\n", |
@@ -120,6 +125,8 @@ post_data_iterator2 (void *cls, | |||
120 | uint64_t off, | 125 | uint64_t off, |
121 | size_t size) | 126 | size_t size) |
122 | { | 127 | { |
128 | (void) cls; (void) kind; (void) filename; /* Mute compiler warnings */ | ||
129 | (void) content_type; (void) transfer_encoding; | ||
123 | static char seen[16]; | 130 | static char seen[16]; |
124 | 131 | ||
125 | #if DEBUG | 132 | #if DEBUG |
@@ -154,6 +161,9 @@ post_data_iterator3 (void *cls, | |||
154 | uint64_t off, | 161 | uint64_t off, |
155 | size_t size) | 162 | size_t size) |
156 | { | 163 | { |
164 | (void) cls; (void) kind; (void) filename; /* Mute compiler warnings */ | ||
165 | (void) content_type; (void) transfer_encoding; | ||
166 | (void) off; /* FIXME: shoudn't be checked? */ | ||
157 | #if DEBUG | 167 | #if DEBUG |
158 | fprintf (stderr, | 168 | fprintf (stderr, |
159 | "%s\t%s\n", | 169 | "%s\t%s\n", |
@@ -182,6 +192,9 @@ post_data_iterator4 (void *cls, | |||
182 | uint64_t off, | 192 | uint64_t off, |
183 | size_t size) | 193 | size_t size) |
184 | { | 194 | { |
195 | (void) cls; (void) kind; (void) key; /* Mute compiler warnings */ | ||
196 | (void) filename; (void) content_type; (void) transfer_encoding; | ||
197 | (void) off; /* FIXME: shoudn't be checked? */ | ||
185 | #if DEBUG | 198 | #if DEBUG |
186 | fprintf (stderr, | 199 | fprintf (stderr, |
187 | "%s\t%s\n", | 200 | "%s\t%s\n", |
@@ -207,6 +220,10 @@ post_data_iterator5 (void *cls, | |||
207 | uint64_t off, | 220 | uint64_t off, |
208 | size_t size) | 221 | size_t size) |
209 | { | 222 | { |
223 | (void) cls; (void) kind; (void) key; /* Mute compiler warnings */ | ||
224 | (void) filename; (void) content_type; (void) transfer_encoding; | ||
225 | (void) data; (void) off; (void) size; | ||
226 | |||
210 | found++; | 227 | found++; |
211 | return MHD_YES; | 228 | return MHD_YES; |
212 | } | 229 | } |
@@ -215,6 +232,7 @@ post_data_iterator5 (void *cls, | |||
215 | int | 232 | int |
216 | main (int argc, char *argv[]) | 233 | main (int argc, char *argv[]) |
217 | { | 234 | { |
235 | (void) argc; (void) argv; | ||
218 | struct MHD_PostProcessor *postprocessor; | 236 | struct MHD_PostProcessor *postprocessor; |
219 | 237 | ||
220 | { | 238 | { |
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c index ab0dd9cf..b3f2fbf7 100644 --- a/src/testcurl/https/test_https_get.c +++ b/src/testcurl/https/test_https_get.c | |||
@@ -236,7 +236,7 @@ main (int argc, char *const *argv) | |||
236 | { | 236 | { |
237 | unsigned int errorCount = 0; | 237 | unsigned int errorCount = 0; |
238 | const char *aes256_sha_tlsv1 = "AES256-SHA"; | 238 | const char *aes256_sha_tlsv1 = "AES256-SHA"; |
239 | (void) argc; /* Unused. Silent compiler warning. */ | 239 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ |
240 | 240 | ||
241 | #ifdef MHD_HTTPS_REQUIRE_GRYPT | 241 | #ifdef MHD_HTTPS_REQUIRE_GRYPT |
242 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); | 242 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); |
diff --git a/src/testcurl/test_add_conn.c b/src/testcurl/test_add_conn.c index c81939d4..daa45206 100644 --- a/src/testcurl/test_add_conn.c +++ b/src/testcurl/test_add_conn.c | |||
@@ -260,9 +260,11 @@ static MHD_socket | |||
260 | createListeningSocket (int *pport) | 260 | createListeningSocket (int *pport) |
261 | { | 261 | { |
262 | MHD_socket skt; | 262 | MHD_socket skt; |
263 | static const int on = 1; | ||
264 | struct sockaddr_in sin; | 263 | struct sockaddr_in sin; |
265 | socklen_t sin_len; | 264 | socklen_t sin_len; |
265 | #ifdef MHD_POSIX_SOCKETS | ||
266 | static const int on = 1; | ||
267 | #endif /* MHD_POSIX_SOCKETS */ | ||
266 | 268 | ||
267 | skt = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); | 269 | skt = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); |
268 | if (MHD_INVALID_SOCKET == skt) | 270 | if (MHD_INVALID_SOCKET == skt) |
@@ -286,11 +288,11 @@ createListeningSocket (int *pport) | |||
286 | if (0 == *pport) | 288 | if (0 == *pport) |
287 | { | 289 | { |
288 | memset (&sin, 0, sizeof(sin)); | 290 | memset (&sin, 0, sizeof(sin)); |
289 | sin_len = sizeof(sin); | 291 | sin_len = (socklen_t) sizeof(sin); |
290 | if (0 != getsockname (skt, (struct sockaddr *) &sin, &sin_len)) | 292 | if (0 != getsockname (skt, (struct sockaddr *) &sin, &sin_len)) |
291 | externalErrorExitDesc ("getsockname() failed"); | 293 | externalErrorExitDesc ("getsockname() failed"); |
292 | 294 | ||
293 | if (sizeof(sin) < sin_len) | 295 | if (sizeof(sin) < (size_t) sin_len) |
294 | externalErrorExitDesc ("getsockname() failed"); | 296 | externalErrorExitDesc ("getsockname() failed"); |
295 | 297 | ||
296 | if (AF_INET != sin.sin_family) | 298 | if (AF_INET != sin.sin_family) |
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c index 6a82c5a2..389cfd5a 100644 --- a/src/testcurl/test_digestauth.c +++ b/src/testcurl/test_digestauth.c | |||
@@ -91,6 +91,7 @@ ahc_echo (void *cls, | |||
91 | const char *password = "testpass"; | 91 | const char *password = "testpass"; |
92 | const char *realm = "test@example.com"; | 92 | const char *realm = "test@example.com"; |
93 | enum MHD_Result ret; | 93 | enum MHD_Result ret; |
94 | int ret_i; | ||
94 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 95 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
95 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 96 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
96 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 97 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ |
@@ -110,14 +111,14 @@ ahc_echo (void *cls, | |||
110 | MHD_destroy_response (response); | 111 | MHD_destroy_response (response); |
111 | return ret; | 112 | return ret; |
112 | } | 113 | } |
113 | ret = MHD_digest_auth_check (connection, | 114 | ret_i = MHD_digest_auth_check (connection, |
114 | realm, | 115 | realm, |
115 | username, | 116 | username, |
116 | password, | 117 | password, |
117 | 300); | 118 | 300); |
118 | free (username); | 119 | free (username); |
119 | if ( (ret == MHD_INVALID_NONCE) || | 120 | if ( (ret_i == MHD_INVALID_NONCE) || |
120 | (ret == MHD_NO) ) | 121 | (ret_i == MHD_NO) ) |
121 | { | 122 | { |
122 | response = MHD_create_response_from_buffer (strlen (DENIED), | 123 | response = MHD_create_response_from_buffer (strlen (DENIED), |
123 | DENIED, | 124 | DENIED, |
@@ -128,8 +129,8 @@ ahc_echo (void *cls, | |||
128 | realm, | 129 | realm, |
129 | MY_OPAQUE, | 130 | MY_OPAQUE, |
130 | response, | 131 | response, |
131 | (MHD_INVALID_NONCE == ret) ? MHD_YES : | 132 | (MHD_INVALID_NONCE == ret_i) ? |
132 | MHD_NO); | 133 | MHD_YES : MHD_NO); |
133 | MHD_destroy_response (response); | 134 | MHD_destroy_response (response); |
134 | return ret; | 135 | return ret; |
135 | } | 136 | } |
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c index 4088dc32..5023bcad 100644 --- a/src/testcurl/test_digestauth_sha256.c +++ b/src/testcurl/test_digestauth_sha256.c | |||
@@ -92,6 +92,7 @@ ahc_echo (void *cls, | |||
92 | const char *password = "testpass"; | 92 | const char *password = "testpass"; |
93 | const char *realm = "test@example.com"; | 93 | const char *realm = "test@example.com"; |
94 | enum MHD_Result ret; | 94 | enum MHD_Result ret; |
95 | int ret_i; | ||
95 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 96 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
96 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 97 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
97 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 98 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ |
@@ -112,15 +113,15 @@ ahc_echo (void *cls, | |||
112 | MHD_destroy_response (response); | 113 | MHD_destroy_response (response); |
113 | return ret; | 114 | return ret; |
114 | } | 115 | } |
115 | ret = MHD_digest_auth_check2 (connection, | 116 | ret_i = MHD_digest_auth_check2 (connection, |
116 | realm, | 117 | realm, |
117 | username, | 118 | username, |
118 | password, | 119 | password, |
119 | 300, | 120 | 300, |
120 | MHD_DIGEST_ALG_SHA256); | 121 | MHD_DIGEST_ALG_SHA256); |
121 | free (username); | 122 | free (username); |
122 | if ( (ret == MHD_INVALID_NONCE) || | 123 | if ( (ret_i == MHD_INVALID_NONCE) || |
123 | (ret == MHD_NO) ) | 124 | (ret_i == MHD_NO) ) |
124 | { | 125 | { |
125 | response = MHD_create_response_from_buffer (strlen (DENIED), | 126 | response = MHD_create_response_from_buffer (strlen (DENIED), |
126 | DENIED, | 127 | DENIED, |
@@ -131,8 +132,8 @@ ahc_echo (void *cls, | |||
131 | realm, | 132 | realm, |
132 | MY_OPAQUE, | 133 | MY_OPAQUE, |
133 | response, | 134 | response, |
134 | (MHD_INVALID_NONCE == ret) ? MHD_YES : | 135 | (MHD_INVALID_NONCE == ret_i) ? |
135 | MHD_NO, | 136 | MHD_YES : MHD_NO, |
136 | MHD_DIGEST_ALG_SHA256); | 137 | MHD_DIGEST_ALG_SHA256); |
137 | MHD_destroy_response (response); | 138 | MHD_destroy_response (response); |
138 | return ret; | 139 | return ret; |
@@ -297,7 +298,7 @@ main (int argc, char *const *argv) | |||
297 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ | 298 | (void) argc; (void) argv; /* Unused. Silent compiler warning. */ |
298 | 299 | ||
299 | #ifdef CURL_VERSION_SSPI | 300 | #ifdef CURL_VERSION_SSPI |
300 | if (0 != (d->features | CURL_VERSION_SSPI)) | 301 | if (0 != (d->features & CURL_VERSION_SSPI)) |
301 | return 77; /* Skip test, W32 SSPI doesn't support sha256 digest */ | 302 | return 77; /* Skip test, W32 SSPI doesn't support sha256 digest */ |
302 | #endif /* CURL_VERSION_SSPI */ | 303 | #endif /* CURL_VERSION_SSPI */ |
303 | 304 | ||
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c index 3d90f0db..c6154ffb 100644 --- a/src/testcurl/test_digestauth_with_arguments.c +++ b/src/testcurl/test_digestauth_with_arguments.c | |||
@@ -85,6 +85,7 @@ ahc_echo (void *cls, | |||
85 | const char *password = "testpass"; | 85 | const char *password = "testpass"; |
86 | const char *realm = "test@example.com"; | 86 | const char *realm = "test@example.com"; |
87 | enum MHD_Result ret; | 87 | enum MHD_Result ret; |
88 | int ret_i; | ||
88 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 89 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
89 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 90 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
90 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ | 91 | (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ |
@@ -103,13 +104,13 @@ ahc_echo (void *cls, | |||
103 | MHD_destroy_response (response); | 104 | MHD_destroy_response (response); |
104 | return ret; | 105 | return ret; |
105 | } | 106 | } |
106 | ret = MHD_digest_auth_check (connection, realm, | 107 | ret_i = MHD_digest_auth_check (connection, realm, |
107 | username, | 108 | username, |
108 | password, | 109 | password, |
109 | 300); | 110 | 300); |
110 | free (username); | 111 | free (username); |
111 | if ( (ret == MHD_INVALID_NONCE) || | 112 | if ( (ret_i == MHD_INVALID_NONCE) || |
112 | (ret == MHD_NO) ) | 113 | (ret_i == MHD_NO) ) |
113 | { | 114 | { |
114 | response = MHD_create_response_from_buffer (strlen (DENIED), | 115 | response = MHD_create_response_from_buffer (strlen (DENIED), |
115 | DENIED, | 116 | DENIED, |
@@ -119,8 +120,8 @@ ahc_echo (void *cls, | |||
119 | ret = MHD_queue_auth_fail_response (connection, realm, | 120 | ret = MHD_queue_auth_fail_response (connection, realm, |
120 | MY_OPAQUE, | 121 | MY_OPAQUE, |
121 | response, | 122 | response, |
122 | (ret == MHD_INVALID_NONCE) ? MHD_YES : | 123 | (ret_i == MHD_INVALID_NONCE) ? |
123 | MHD_NO); | 124 | MHD_YES : MHD_NO); |
124 | MHD_destroy_response (response); | 125 | MHD_destroy_response (response); |
125 | return ret; | 126 | return ret; |
126 | } | 127 | } |