1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

fix compiler warning

This commit is contained in:
Yang Tse 2007-03-25 01:59:52 +00:00
parent 2bd1d7e996
commit d6eca89229
3 changed files with 42 additions and 18 deletions

View File

@ -655,7 +655,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
static void state(struct connectdata *conn, static void state(struct connectdata *conn,
ftpstate state) ftpstate state)
{ {
#ifdef CURLDEBUG #if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
/* for debug purposes */ /* for debug purposes */
const char *names[]={ const char *names[]={
"STOP", "STOP",
@ -693,7 +693,7 @@ static void state(struct connectdata *conn,
}; };
#endif #endif
struct ftp_conn *ftpc = &conn->proto.ftpc; struct ftp_conn *ftpc = &conn->proto.ftpc;
#ifdef CURLDEBUG #if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
if(ftpc->state != state) if(ftpc->state != state)
infof(conn->data, "FTP %p state change from %s to %s\n", infof(conn->data, "FTP %p state change from %s to %s\n",
ftpc, names[ftpc->state], names[state]); ftpc, names[ftpc->state], names[state]);
@ -3244,9 +3244,16 @@ ftp_pasv_verbose(struct connectdata *conn,
char *newhost, /* ascii version */ char *newhost, /* ascii version */
int port) int port)
{ {
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)conn;
(void)ai;
(void)newhost;
(void)port;
#else
char buf[256]; char buf[256];
Curl_printable_address(ai, buf, sizeof(buf)); Curl_printable_address(ai, buf, sizeof(buf));
infof(conn->data, "Connecting to %s (%s) port %d\n", newhost, buf, port); infof(conn->data, "Connecting to %s (%s) port %d\n", newhost, buf, port);
#endif
} }
/* /*

View File

@ -129,6 +129,10 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
in_addr_t in; in_addr_t in;
struct hostent *buf = NULL; struct hostent *buf = NULL;
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)conn;
#endif
(void)port; /* unused in IPv4 code */ (void)port; /* unused in IPv4 code */
*waitp = 0; /* don't wait, we act synchronously */ *waitp = 0; /* don't wait, we act synchronously */

View File

@ -195,6 +195,10 @@ RETSIGTYPE alarmfunc(int sig)
#endif /* WIN32 */ #endif /* WIN32 */
#endif /* USE_ARES */ #endif /* USE_ARES */
#ifdef CURL_DISABLE_VERBOSE_STRINGS
#define verboseconnect(x) do { } while (0)
#endif
void Curl_safefree(void *ptr) void Curl_safefree(void *ptr)
{ {
if(ptr) if(ptr)
@ -2289,11 +2293,13 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
{ {
CURLcode result; CURLcode result;
Curl_addrinfo *addr; Curl_addrinfo *addr;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
char *hostname = conn->bits.proxy?conn->proxy.name:conn->host.name; char *hostname = conn->bits.proxy?conn->proxy.name:conn->host.name;
infof(data, "About to connect() to %s%s port %d (#%d)\n", infof(data, "About to connect() to %s%s port %d (#%d)\n",
conn->bits.proxy?"proxy ":"", conn->bits.proxy?"proxy ":"",
hostname, conn->port, conn->connectindex); hostname, conn->port, conn->connectindex);
#endif
/************************************************************* /*************************************************************
* Connect to server/proxy * Connect to server/proxy
@ -2335,12 +2341,14 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
/* /*
* verboseconnect() displays verbose information after a connect * verboseconnect() displays verbose information after a connect
*/ */
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void verboseconnect(struct connectdata *conn) static void verboseconnect(struct connectdata *conn)
{ {
infof(conn->data, "Connected to %s (%s) port %d (#%d)\n", infof(conn->data, "Connected to %s (%s) port %d (#%d)\n",
conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname, conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname,
conn->ip_addr_str, conn->port, conn->connectindex); conn->ip_addr_str, conn->port, conn->connectindex);
} }
#endif
int Curl_protocol_getsock(struct connectdata *conn, int Curl_protocol_getsock(struct connectdata *conn,
curl_socket_t *socks, curl_socket_t *socks,
@ -2481,6 +2489,14 @@ static bool tld_check_name(struct SessionHandle *data,
size_t err_pos; size_t err_pos;
char *uc_name = NULL; char *uc_name = NULL;
int rc; int rc;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
char *tld_errmsg;
#ifndef HAVE_TLD_STRERROR
char no_msg[] = "<no msg>";
#endif
#else
(void)data;
#endif
/* Convert (and downcase) ACE-name back into locale's character set */ /* Convert (and downcase) ACE-name back into locale's character set */
rc = idna_to_unicode_lzlz(ace_hostname, &uc_name, 0); rc = idna_to_unicode_lzlz(ace_hostname, &uc_name, 0);
@ -2488,24 +2504,21 @@ static bool tld_check_name(struct SessionHandle *data,
return (FALSE); return (FALSE);
rc = tld_check_lz(uc_name, &err_pos, NULL); rc = tld_check_lz(uc_name, &err_pos, NULL);
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if (rc != TLD_SUCCESS)
#ifdef HAVE_TLD_STRERROR
tld_errmsg = tld_strerror((Tld_rc)rc);
#else
tld_errmsg = no_msg;
#endif
if (rc == TLD_INVALID) if (rc == TLD_INVALID)
infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n", infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n",
#ifdef HAVE_TLD_STRERROR tld_errmsg, err_pos, uc_name[err_pos],
tld_strerror((Tld_rc)rc), uc_name[err_pos] & 255);
#else
"<no msg>",
#endif
err_pos, uc_name[err_pos],
uc_name[err_pos] & 255);
else if (rc != TLD_SUCCESS) else if (rc != TLD_SUCCESS)
infof(data, "WARNING: TLD check for %s failed; %s\n", infof(data, "WARNING: TLD check for %s failed; %s\n",
uc_name, uc_name, tld_errmsg);
#ifdef HAVE_TLD_STRERROR #endif /* CURL_DISABLE_VERBOSE_STRINGS */
tld_strerror((Tld_rc)rc)
#else
"<no msg>"
#endif
);
if (uc_name) if (uc_name)
idn_free(uc_name); idn_free(uc_name);
return (bool)(rc == TLD_SUCCESS); return (bool)(rc == TLD_SUCCESS);