build: fix compiler warnings

For when CURL_DISABLE_VERBOSE_STRINGS and DEBUGBUILD flags are both
active.

- socks.c : warning C4100: 'lineno': unreferenced formal parameter
  (co-authored by Daniel Stenberg)

- mbedtls.c: warning C4189: 'port': local variable is initialized but
  not referenced

- schannel.c: warning C4189: 'hostname': local variable is initialized
  but not referenced

Cloes #7528
This commit is contained in:
MAntoniak 2021-07-17 22:43:52 +02:00 committed by Daniel Stenberg
parent 7698a365ae
commit fd84db600d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 10 additions and 8 deletions

View File

@ -99,24 +99,24 @@ int Curl_blockread_all(struct Curl_easy *data, /* transfer */
} }
#endif #endif
#ifndef DEBUGBUILD #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
#define sxstate(x,y) socksstate(x,y) #define DEBUG_AND_VERBOSE
#else
#define sxstate(x,y) socksstate(x,y, __LINE__) #define sxstate(x,y) socksstate(x,y, __LINE__)
#else
#define sxstate(x,y) socksstate(x,y)
#endif #endif
/* always use this function to change state, to make debugging easier */ /* always use this function to change state, to make debugging easier */
static void socksstate(struct Curl_easy *data, static void socksstate(struct Curl_easy *data,
enum connect_t state enum connect_t state
#ifdef DEBUGBUILD #ifdef DEBUG_AND_VERBOSE
, int lineno , int lineno
#endif #endif
) )
{ {
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
enum connect_t oldstate = conn->cnnct.state; enum connect_t oldstate = conn->cnnct.state;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #ifdef DEBUG_AND_VERBOSE
/* synced with the state list in urldata.h */ /* synced with the state list in urldata.h */
static const char * const statename[] = { static const char * const statename[] = {
"INIT", "INIT",
@ -146,7 +146,7 @@ static void socksstate(struct Curl_easy *data,
conn->cnnct.state = state; conn->cnnct.state = state;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #ifdef DEBUG_AND_VERBOSE
infof(data, infof(data,
"SXSTATE: %s => %s conn %p; line %d", "SXSTATE: %s => %s conn %p; line %d",
statename[oldstate], statename[conn->cnnct.state], conn, statename[oldstate], statename[conn->cnnct.state], conn,

View File

@ -277,7 +277,9 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob); const struct curl_blob *ssl_cert_blob = SSL_SET_OPTION(primary.cert_blob);
const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile); const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
const char * const hostname = SSL_HOST_NAME(); const char * const hostname = SSL_HOST_NAME();
#ifndef CURL_DISABLE_VERBOSE_STRINGS
const long int port = SSL_HOST_PORT(); const long int port = SSL_HOST_PORT();
#endif
int ret = -1; int ret = -1;
char errorbuf[128]; char errorbuf[128];

View File

@ -1364,7 +1364,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
SECURITY_STATUS sspi_status = SEC_E_OK; SECURITY_STATUS sspi_status = SEC_E_OK;
CERT_CONTEXT *ccert_context = NULL; CERT_CONTEXT *ccert_context = NULL;
bool isproxy = SSL_IS_PROXY(); bool isproxy = SSL_IS_PROXY();
#ifdef DEBUGBUILD #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
const char * const hostname = SSL_HOST_NAME(); const char * const hostname = SSL_HOST_NAME();
#endif #endif
#ifdef HAS_ALPN #ifdef HAS_ALPN