commit 28f723b238181f10f3bd86de84a4c4621e62a712
parent dc96775e3210bce764284d46be5fd889d63ef0b8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Mon, 30 Oct 2017 23:36:21 +0300
Silenced compiler warnings in src/testcurl/https, minor fixes.
Diffstat:
12 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c
@@ -35,8 +35,6 @@
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
-extern const char srv_signed_cert_pem[];
-extern const char srv_signed_key_pem[];
static int oneone;
@@ -51,6 +49,8 @@ ahc_echo (void *cls,
{
struct MHD_Response *response;
int ret;
+ (void)cls;(void)url;(void)method;(void)version; /* Unused. Silent compiler warning. */
+ (void)upload_data;(void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */
response = MHD_create_response_from_buffer (0, NULL,
MHD_RESPMEM_PERSISTENT);
@@ -220,6 +220,7 @@ int
main (int argc, char *const *argv)
{
unsigned int errorCount = 0;
+ (void)argc; /* Unused. Silent compiler warning. */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c
@@ -131,6 +131,7 @@ main (int argc, char *const *argv)
unsigned int errorCount = 0;
const char *aes256_sha_tlsv1 = "AES256-SHA";
const char *des_cbc3_sha_tlsv1 = "DES-CBC3-SHA";
+ (void)argc; /* Unused. Silent compiler warning. */
#ifdef MHD_HTTPS_REQUIRE_GRYPT
gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
diff --git a/src/testcurl/https/test_https_get_parallel.c b/src/testcurl/https/test_https_get_parallel.c
@@ -84,6 +84,7 @@ test_single_client (void *cls, int port, const char *cipher_suite,
void *client_thread_ret;
struct https_test_data client_args =
{ NULL, port, cipher_suite, curl_proto_version };
+ (void)cls; /* Unused. Silent compiler warning. */
client_thread_ret = https_transfer_thread_adapter (&client_args);
if (client_thread_ret != NULL)
@@ -109,6 +110,7 @@ test_parallel_clients (void * cls, int port, const char *cipher_suite,
pthread_t client_arr[client_count];
struct https_test_data client_args =
{ NULL, port, cipher_suite, curl_proto_version };
+ (void)cls; /* Unused. Silent compiler warning. */
for (i = 0; i < client_count; ++i)
{
@@ -138,6 +140,7 @@ main (int argc, char *const *argv)
unsigned int errorCount = 0;
const char *aes256_sha = "AES256-SHA";
int port;
+ (void)argc; /* Unused. Silent compiler warning. */
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port = 0;
diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c
@@ -84,6 +84,7 @@ test_single_client (void *cls, int port, const char *cipher_suite,
void *client_thread_ret;
struct https_test_data client_args =
{ NULL, port, cipher_suite, curl_proto_version };
+ (void)cls; /* Unused. Silent compiler warning. */
client_thread_ret = https_transfer_thread_adapter (&client_args);
if (client_thread_ret != NULL)
@@ -109,6 +110,7 @@ test_parallel_clients (void *cls, int port, const char *cipher_suite,
pthread_t client_arr[client_count];
struct https_test_data client_args =
{ NULL, port, cipher_suite, curl_proto_version };
+ (void)cls; /* Unused. Silent compiler warning. */
for (i = 0; i < client_count; ++i)
{
@@ -139,6 +141,7 @@ main (int argc, char *const *argv)
unsigned int errorCount = 0;
const char *ssl_version;
int port;
+ (void)argc; /* Unused. Silent compiler warning. */
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port = 0;
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c
@@ -36,8 +36,6 @@
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
-extern const char srv_signed_cert_pem[];
-extern const char srv_signed_key_pem[];
static int oneone;
@@ -54,6 +52,7 @@ ahc_echo (void *cls,
const char *me = cls;
struct MHD_Response *response;
int ret;
+ (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */
if (0 != strcmp (me, method))
return MHD_NO; /* unexpected method */
@@ -249,6 +248,7 @@ int
main (int argc, char *const *argv)
{
unsigned int errorCount = 0;
+ (void)argc; /* Unused. Silent compiler warning. */
if (0 != curl_global_init (CURL_GLOBAL_ALL))
{
diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c
@@ -34,7 +34,6 @@
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
#include "tls_test_common.h"
-extern int curl_check_version (const char *req_version, ...);
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
@@ -43,7 +42,7 @@ extern const char srv_self_signed_cert_pem[];
* doesn't affect the other
*/
static int
-test_concurent_daemon_pair (void *cls,
+test_concurent_daemon_pair (void *cls,
const char *cipher_suite,
int proto_version)
{
@@ -51,6 +50,8 @@ test_concurent_daemon_pair (void *cls,
struct MHD_Daemon *d1;
struct MHD_Daemon *d2;
int port1, port2;
+ (void)cls; /* Unused. Silent compiler warning. */
+
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port1 = port2 = 0;
@@ -127,6 +128,7 @@ main (int argc, char *const *argv)
unsigned int errorCount = 0;
FILE *cert;
const char *aes256_sha = "AES256-SHA";
+ (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/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c
@@ -32,7 +32,6 @@
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
#include "tls_test_common.h"
-extern int curl_check_version (const char *req_version, ...);
extern const char srv_key_pem[];
extern const char srv_self_signed_cert_pem[];
@@ -45,11 +44,13 @@ struct MHD_Daemon *d;
static int
query_session_ahc (void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
- const char *upload_data, const char *version,
+ const char *version, const char *upload_data,
size_t *upload_data_size, void **ptr)
{
struct MHD_Response *response;
int ret;
+ (void)cls;(void)url;(void)method;(void)version; /* Unused. Silent compiler warning. */
+ (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */
if (NULL == *ptr)
{
@@ -190,6 +191,7 @@ main (int argc, char *const *argv)
#if LIBCURL_VERSION_NUM >= 0x072200
unsigned int errorCount = 0;
const char *ssl_version;
+ (void)argc; /* Unused. Silent compiler warning. */
#ifdef MHD_HTTPS_REQUIRE_GRYPT
gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c
@@ -145,6 +145,7 @@ sni_callback (gnutls_session_t session,
size_t name_len;
struct Hosts *host;
unsigned int type;
+ (void)req_ca_dn;(void)nreqs;(void)pk_algos;(void)pk_algos_length; /* Unused. Silent compiler warning. */
name_len = sizeof (name);
if (GNUTLS_E_SUCCESS !=
@@ -255,6 +256,7 @@ main (int argc, char *const *argv)
unsigned int error_count = 0;
struct MHD_Daemon *d;
int port;
+ (void)argc; /* Unused. Silent compiler warning. */
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port = 0;
@@ -315,7 +317,7 @@ main (int argc, char *const *argv)
#else
-int main ()
+int main (void)
{
fprintf (stderr,
"SNI not supported by GnuTLS < 3.0\n");
diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c
@@ -54,7 +54,7 @@ test_tls_session_time_out (gnutls_session_t session, int port)
struct sockaddr_in sa;
sd = socket (AF_INET, SOCK_STREAM, 0);
- if (sd == -1)
+ if (sd == MHD_INVALID_SOCKET)
{
fprintf (stderr, "Failed to create socket: %s\n", strerror (errno));
return -1;
@@ -110,6 +110,7 @@ main (int argc, char *const *argv)
gnutls_datum_t cert;
gnutls_certificate_credentials_t xcred;
int port;
+ (void)argc; /* Unused. Silent compiler warning. */
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port = 0;
diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c
@@ -34,11 +34,6 @@
#endif /* MHD_HTTPS_REQUIRE_GRYPT */
#include "tls_test_common.h"
-extern int curl_check_version (const char *req_version, ...);
-extern const char test_file_data[];
-
-extern const char ca_key_pem[];
-extern const char ca_cert_pem[];
extern const char srv_signed_cert_pem[];
extern const char srv_signed_key_pem[];
@@ -51,6 +46,7 @@ test_secure_get (void * cls, char *cipher_suite, int proto_version)
int ret;
struct MHD_Daemon *d;
int port;
+ (void)cls; /* Unused. Silent compiler warning. */
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port = 0;
@@ -90,6 +86,7 @@ main (int argc, char *const *argv)
{
unsigned int errorCount = 0;
char *aes256_sha = "AES256-SHA";
+ (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/https/test_tls_options.c b/src/testcurl/https/test_tls_options.c
@@ -47,6 +47,7 @@ test_unmatching_ssl_version (void * cls, int port, const char *cipher_suite,
int curl_req_ssl_version)
{
struct CBC cbc;
+ (void)cls; /* Unused. Silent compiler warning. */
if (NULL == (cbc.buf = malloc (sizeof (char) * 256)))
{
fprintf (stderr, "Error: failed to allocate: %s\n",
@@ -90,6 +91,7 @@ main (int argc, char *const *argv)
int daemon_flags =
MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG;
int port;
+ (void)argc; (void)argv; /* Unused. Silent compiler warning. */
if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT))
port = 0;
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
@@ -73,6 +73,7 @@ test_daemon_get (void *cls,
CURLcode errornum;
char url[255];
size_t len;
+ (void)cls; /* Unused. Silent compiler warning. */
len = strlen (test_data);
if (NULL == (cbc.buf = malloc (sizeof (char) * len)))
@@ -166,12 +167,14 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
*/
int
http_ahc (void *cls, struct MHD_Connection *connection,
- const char *url, const char *method, const char *upload_data,
- const char *version, size_t *upload_data_size, void **ptr)
+ const char *url, const char *method, const char *version,
+ const char *upload_data, size_t *upload_data_size, void **ptr)
{
static int aptr;
struct MHD_Response *response;
int ret;
+ (void)cls;(void)url;(void)version; /* Unused. Silent compiler warning. */
+ (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */
if (0 != strcmp (method, MHD_HTTP_METHOD_GET))
return MHD_NO; /* unexpected method */
@@ -193,11 +196,13 @@ http_ahc (void *cls, struct MHD_Connection *connection,
/* HTTP access handler call back */
int
http_dummy_ahc (void *cls, struct MHD_Connection *connection,
- const char *url, const char *method, const char *upload_data,
- const char *version, size_t *upload_data_size,
+ const char *url, const char *method, const char *version,
+ const char *upload_data, size_t *upload_data_size,
void **ptr)
{
- return 0;
+ (void)cls;(void)connection;(void)url;(void)method;(void)version; /* Unused. Silent compiler warning. */
+ (void)upload_data;(void)upload_data_size;(void)ptr; /* Unused. Silent compiler warning. */
+ return 0;
}
/**
@@ -273,6 +278,7 @@ gen_test_file_url (char *url,
int ret = 0;
char *doc_path;
size_t doc_path_len;
+ size_t i;
/* setup test file path, url */
#ifdef PATH_MAX
doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX;
@@ -293,7 +299,7 @@ gen_test_file_url (char *url,
return -1;
}
#ifdef WINDOWS
- for (int i = 0; i < doc_path_len; i++)
+ for (i = 0; i < doc_path_len; i++)
{
if (doc_path[i] == 0)
break;
@@ -316,7 +322,7 @@ gen_test_file_url (char *url,
"https://127.0.0.1",
port,
doc_path,
- "urlpath") >= url_len)
+ "urlpath") >= (long long)url_len)
ret = -1;
free (doc_path);
@@ -337,6 +343,7 @@ test_https_transfer (void *cls,
int ret = 0;
struct CBC cbc;
char url[255];
+ (void)cls; /* Unused. Silent compiler warning. */
len = strlen (test_data);
if (NULL == (cbc.buf = malloc (sizeof (char) * len)))
@@ -490,6 +497,7 @@ test_wrap (const char *test_name, int
int ret;
va_list arg_list;
struct MHD_Daemon *d;
+ (void)cls; /* Unused. Silent compiler warning. */
va_start (arg_list, proto_version);
port = setup_testcase (&d, port, daemon_flags, arg_list);