lib: fix compiler warnings with `CURL_DISABLE_VERBOSE_STRINGS`

Closes https://github.com/curl/curl/pull/4775
This commit is contained in:
Marcel Raad 2020-01-03 13:30:34 +01:00
parent e24ea706fb
commit 291ed52122
No known key found for this signature in database
GPG Key ID: FE4D8BC5EE1701DD
4 changed files with 15 additions and 10 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -932,9 +932,11 @@ CURLcode Curl_is_connected(struct connectdata *conn,
SET_SOCKERRNO(error); SET_SOCKERRNO(error);
if(conn->tempaddr[i]) { if(conn->tempaddr[i]) {
CURLcode status; CURLcode status;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
char ipaddress[MAX_IPADR_LEN]; char ipaddress[MAX_IPADR_LEN];
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
Curl_printable_address(conn->tempaddr[i], ipaddress, MAX_IPADR_LEN); Curl_printable_address(conn->tempaddr[i], ipaddress, MAX_IPADR_LEN);
#endif
infof(data, "connect to %s port %ld failed: %s\n", infof(data, "connect to %s port %ld failed: %s\n",
ipaddress, conn->port, ipaddress, conn->port,
Curl_strerror(error, buffer, sizeof(buffer))); Curl_strerror(error, buffer, sizeof(buffer)));
@ -992,14 +994,12 @@ CURLcode Curl_is_connected(struct connectdata *conn,
static void tcpnodelay(struct connectdata *conn, curl_socket_t sockfd) static void tcpnodelay(struct connectdata *conn, curl_socket_t sockfd)
{ {
#if defined(TCP_NODELAY) #if defined(TCP_NODELAY)
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
struct Curl_easy *data = conn->data;
#endif
curl_socklen_t onoff = (curl_socklen_t) 1; curl_socklen_t onoff = (curl_socklen_t) 1;
int level = IPPROTO_TCP; int level = IPPROTO_TCP;
#if !defined(CURL_DISABLE_VERBOSE_STRINGS)
struct Curl_easy *data = conn->data;
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
#else
#if defined(CURL_DISABLE_VERBOSE_STRINGS)
(void) conn; (void) conn;
#endif #endif

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -641,7 +641,7 @@ output_auth_headers(struct connectdata *conn,
{ {
const char *auth = NULL; const char *auth = NULL;
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
#if !defined(CURL_DISABLE_VERBOSE_STRINGS) || defined(USE_SPNEGO) #if !defined(CURL_DISABLE_VERBOSE_STRINGS)
struct Curl_easy *data = conn->data; struct Curl_easy *data = conn->data;
#endif #endif

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2004 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2004 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -449,7 +449,9 @@ curl_share_strerror(CURLSHcode error)
static const char * static const char *
get_winsock_error (int err, char *buf, size_t len) get_winsock_error (int err, char *buf, size_t len)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
const char *p; const char *p;
#endif
if(!len) if(!len)
return NULL; return NULL;
@ -457,6 +459,7 @@ get_winsock_error (int err, char *buf, size_t len)
*buf = '\0'; *buf = '\0';
#ifdef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)err;
return NULL; return NULL;
#else #else
switch(err) { switch(err) {

View File

@ -7,7 +7,7 @@
* *
* Copyright (C) 2012 - 2016, Marc Hoersken, <info@marc-hoersken.de> * Copyright (C) 2012 - 2016, Marc Hoersken, <info@marc-hoersken.de>
* Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com> * Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com>
* Copyright (C) 2012 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -1855,7 +1855,9 @@ schannel_recv(struct connectdata *conn, int sockindex,
goto cleanup; goto cleanup;
} }
else { else {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
#endif
*err = CURLE_RECV_ERROR; *err = CURLE_RECV_ERROR;
infof(data, "schannel: failed to read data from server: %s\n", infof(data, "schannel: failed to read data from server: %s\n",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer))); Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));