[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: Fixed and muted compiler warnings
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: Fixed and muted compiler warnings |
Date: |
Wed, 23 Dec 2020 20:42:00 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 6d7f0a8f54bed3282199afc1bbe9c35c8af80a7f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Dec 23 22:40:59 2020 +0300
Fixed and muted compiler warnings
---
src/microhttpd/mhd_itc_types.h | 5 +++--
src/microhttpd/mhd_sockets.c | 1 +
src/microhttpd/test_postprocessor.c | 3 +++
src/microhttpd/test_postprocessor_md.c | 18 ++++++++++++++++++
src/testcurl/https/test_https_get.c | 2 +-
src/testcurl/test_add_conn.c | 8 +++++---
src/testcurl/test_digestauth.c | 19 ++++++++++---------
src/testcurl/test_digestauth_sha256.c | 23 ++++++++++++-----------
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_
/**
* Static initialiser for struct MHD_itc_
*/
-#define MHD_ITC_STATIC_INIT_INVALID { -1, -1 }
+#define MHD_ITC_STATIC_INIT_INVALID { { -1, -1 } }
#elif defined(_MHD_ITC_SOCKETPAIR)
@@ -86,7 +86,8 @@ struct MHD_itc_
/**
* Static initialiser for struct MHD_itc_
*/
-#define MHD_ITC_STATIC_INIT_INVALID { MHD_INVALID_SOCKET, MHD_INVALID_SOCKET }
+#define MHD_ITC_STATIC_INIT_INVALID \
+ { { MHD_INVALID_SOCKET, MHD_INVALID_SOCKET } }
#endif /* _MHD_ITC_SOCKETPAIR */
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,
#endif
#else
/* do not have MHD_TCP_CORK_NOPUSH at all */
+ (void) sock; (void) on; /* Mute compiler warnings */
return 0;
#endif
}
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,
uint64_t off,
size_t size)
{
+ (void) cls; (void) kind; (void) key; /* Mute compiler warnings */
+ (void) filename; (void) content_type; (void) transfer_encoding;
+ (void) data; (void) off; (void) size;
return MHD_YES;
}
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,
const char **value_ptr,
size_t *value_size_ptr)
{
+ (void) connection; (void) kind; (void) key; /* Mute compiler warnings */
+ (void) key_size; (void) value_ptr; (void) value_size_ptr;
return MHD_NO;
}
@@ -73,6 +75,9 @@ post_data_iterator (void *cls,
uint64_t off,
size_t size)
{
+ (void) cls; (void) kind; (void) filename; /* Mute compiler warnings */
+ (void) content_type; (void) transfer_encoding;
+ (void) off; /* FIXME: shoudn't be checked? */
#if DEBUG
fprintf (stderr,
"%s\t%s\n",
@@ -120,6 +125,8 @@ post_data_iterator2 (void *cls,
uint64_t off,
size_t size)
{
+ (void) cls; (void) kind; (void) filename; /* Mute compiler warnings */
+ (void) content_type; (void) transfer_encoding;
static char seen[16];
#if DEBUG
@@ -154,6 +161,9 @@ post_data_iterator3 (void *cls,
uint64_t off,
size_t size)
{
+ (void) cls; (void) kind; (void) filename; /* Mute compiler warnings */
+ (void) content_type; (void) transfer_encoding;
+ (void) off; /* FIXME: shoudn't be checked? */
#if DEBUG
fprintf (stderr,
"%s\t%s\n",
@@ -182,6 +192,9 @@ post_data_iterator4 (void *cls,
uint64_t off,
size_t size)
{
+ (void) cls; (void) kind; (void) key; /* Mute compiler warnings */
+ (void) filename; (void) content_type; (void) transfer_encoding;
+ (void) off; /* FIXME: shoudn't be checked? */
#if DEBUG
fprintf (stderr,
"%s\t%s\n",
@@ -207,6 +220,10 @@ post_data_iterator5 (void *cls,
uint64_t off,
size_t size)
{
+ (void) cls; (void) kind; (void) key; /* Mute compiler warnings */
+ (void) filename; (void) content_type; (void) transfer_encoding;
+ (void) data; (void) off; (void) size;
+
found++;
return MHD_YES;
}
@@ -215,6 +232,7 @@ post_data_iterator5 (void *cls,
int
main (int argc, char *argv[])
{
+ (void) argc; (void) argv;
struct MHD_PostProcessor *postprocessor;
{
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)
{
unsigned int errorCount = 0;
const char *aes256_sha_tlsv1 = "AES256-SHA";
- (void) argc; /* Unused. Silent compiler warning. */
+ (void) argc; (void) argv; /* Unused. Silent compiler warning. */
#ifdef MHD_HTTPS_REQUIRE_GRYPT
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
createListeningSocket (int *pport)
{
MHD_socket skt;
- static const int on = 1;
struct sockaddr_in sin;
socklen_t sin_len;
+#ifdef MHD_POSIX_SOCKETS
+ static const int on = 1;
+#endif /* MHD_POSIX_SOCKETS */
skt = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (MHD_INVALID_SOCKET == skt)
@@ -286,11 +288,11 @@ createListeningSocket (int *pport)
if (0 == *pport)
{
memset (&sin, 0, sizeof(sin));
- sin_len = sizeof(sin);
+ sin_len = (socklen_t) sizeof(sin);
if (0 != getsockname (skt, (struct sockaddr *) &sin, &sin_len))
externalErrorExitDesc ("getsockname() failed");
- if (sizeof(sin) < sin_len)
+ if (sizeof(sin) < (size_t) sin_len)
externalErrorExitDesc ("getsockname() failed");
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,
const char *password = "testpass";
const char *realm = "test@example.com";
enum MHD_Result ret;
+ int ret_i;
(void) cls; (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. */
@@ -110,14 +111,14 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- ret = MHD_digest_auth_check (connection,
- realm,
- username,
- password,
- 300);
+ ret_i = MHD_digest_auth_check (connection,
+ realm,
+ username,
+ password,
+ 300);
free (username);
- if ( (ret == MHD_INVALID_NONCE) ||
- (ret == MHD_NO) )
+ if ( (ret_i == MHD_INVALID_NONCE) ||
+ (ret_i == MHD_NO) )
{
response = MHD_create_response_from_buffer (strlen (DENIED),
DENIED,
@@ -128,8 +129,8 @@ ahc_echo (void *cls,
realm,
MY_OPAQUE,
response,
- (MHD_INVALID_NONCE == ret) ? MHD_YES :
- MHD_NO);
+ (MHD_INVALID_NONCE == ret_i) ?
+ MHD_YES : MHD_NO);
MHD_destroy_response (response);
return ret;
}
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,
const char *password = "testpass";
const char *realm = "test@example.com";
enum MHD_Result ret;
+ int ret_i;
(void) cls; (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. */
@@ -112,15 +113,15 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- ret = MHD_digest_auth_check2 (connection,
- realm,
- username,
- password,
- 300,
- MHD_DIGEST_ALG_SHA256);
+ ret_i = MHD_digest_auth_check2 (connection,
+ realm,
+ username,
+ password,
+ 300,
+ MHD_DIGEST_ALG_SHA256);
free (username);
- if ( (ret == MHD_INVALID_NONCE) ||
- (ret == MHD_NO) )
+ if ( (ret_i == MHD_INVALID_NONCE) ||
+ (ret_i == MHD_NO) )
{
response = MHD_create_response_from_buffer (strlen (DENIED),
DENIED,
@@ -131,8 +132,8 @@ ahc_echo (void *cls,
realm,
MY_OPAQUE,
response,
- (MHD_INVALID_NONCE == ret) ? MHD_YES :
- MHD_NO,
+ (MHD_INVALID_NONCE == ret_i) ?
+ MHD_YES : MHD_NO,
MHD_DIGEST_ALG_SHA256);
MHD_destroy_response (response);
return ret;
@@ -297,7 +298,7 @@ main (int argc, char *const *argv)
(void) argc; (void) argv; /* Unused. Silent compiler warning. */
#ifdef CURL_VERSION_SSPI
- if (0 != (d->features | CURL_VERSION_SSPI))
+ if (0 != (d->features & CURL_VERSION_SSPI))
return 77; /* Skip test, W32 SSPI doesn't support sha256 digest */
#endif /* CURL_VERSION_SSPI */
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,
const char *password = "testpass";
const char *realm = "test@example.com";
enum MHD_Result ret;
+ int ret_i;
(void) cls; (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. */
@@ -103,13 +104,13 @@ ahc_echo (void *cls,
MHD_destroy_response (response);
return ret;
}
- ret = MHD_digest_auth_check (connection, realm,
- username,
- password,
- 300);
+ ret_i = MHD_digest_auth_check (connection, realm,
+ username,
+ password,
+ 300);
free (username);
- if ( (ret == MHD_INVALID_NONCE) ||
- (ret == MHD_NO) )
+ if ( (ret_i == MHD_INVALID_NONCE) ||
+ (ret_i == MHD_NO) )
{
response = MHD_create_response_from_buffer (strlen (DENIED),
DENIED,
@@ -119,8 +120,8 @@ ahc_echo (void *cls,
ret = MHD_queue_auth_fail_response (connection, realm,
MY_OPAQUE,
response,
- (ret == MHD_INVALID_NONCE) ? MHD_YES :
- MHD_NO);
+ (ret_i == MHD_INVALID_NONCE) ?
+ MHD_YES : MHD_NO);
MHD_destroy_response (response);
return ret;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.