]> granicus.if.org Git - curl/commitdiff
fix compiler warning
authorYang Tse <yangsita@gmail.com>
Sun, 25 Mar 2007 01:59:52 +0000 (01:59 +0000)
committerYang Tse <yangsita@gmail.com>
Sun, 25 Mar 2007 01:59:52 +0000 (01:59 +0000)
lib/ftp.c
lib/hostip4.c
lib/url.c

index 8c54f727414e97393a6caaf30e776ec96aa708c8..d0c69f243a3685caf195876eb8b6ec06e9814c32 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -655,7 +655,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
 static void state(struct connectdata *conn,
                   ftpstate state)
 {
-#ifdef CURLDEBUG
+#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
   /* for debug purposes */
   const char *names[]={
     "STOP",
@@ -693,7 +693,7 @@ static void state(struct connectdata *conn,
   };
 #endif
   struct ftp_conn *ftpc = &conn->proto.ftpc;
-#ifdef CURLDEBUG
+#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
   if(ftpc->state != state)
     infof(conn->data, "FTP %p state change from %s to %s\n",
           ftpc, names[ftpc->state], names[state]);
@@ -3244,9 +3244,16 @@ ftp_pasv_verbose(struct connectdata *conn,
                  char *newhost, /* ascii version */
                  int port)
 {
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+  (void)conn;
+  (void)ai;
+  (void)newhost;
+  (void)port;
+#else
   char buf[256];
   Curl_printable_address(ai, buf, sizeof(buf));
   infof(conn->data, "Connecting to %s (%s) port %d\n", newhost, buf, port);
+#endif
 }
 
 /*
index d2cd81911e9d00d7e194ea76e69780d64a167965..d092d271853935ea1e29fd272f07e5446784e9cc 100644 (file)
@@ -129,6 +129,10 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
   in_addr_t in;
   struct hostent *buf = NULL;
 
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+  (void)conn;
+#endif
+
   (void)port; /* unused in IPv4 code */
 
   *waitp = 0; /* don't wait, we act synchronously */
index d11ebd3a03043c1ec01f0e7879ec0e3499c40b72..04f1aa49780bd7930eccd258bd88b3d23a520764 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -195,6 +195,10 @@ RETSIGTYPE alarmfunc(int sig)
 #endif /* WIN32 */
 #endif /* USE_ARES */
 
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+#define verboseconnect(x)  do { } while (0)
+#endif
+
 void Curl_safefree(void *ptr)
 {
   if(ptr)
@@ -2289,11 +2293,13 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
 {
   CURLcode result;
   Curl_addrinfo *addr;
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
   char *hostname = conn->bits.proxy?conn->proxy.name:conn->host.name;
 
   infof(data, "About to connect() to %s%s port %d (#%d)\n",
         conn->bits.proxy?"proxy ":"",
         hostname, conn->port, conn->connectindex);
+#endif
 
   /*************************************************************
    * Connect to server/proxy
@@ -2335,12 +2341,14 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
 /*
  * verboseconnect() displays verbose information after a connect
  */
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
 static void verboseconnect(struct connectdata *conn)
 {
   infof(conn->data, "Connected to %s (%s) port %d (#%d)\n",
         conn->bits.proxy ? conn->proxy.dispname : conn->host.dispname,
         conn->ip_addr_str, conn->port, conn->connectindex);
 }
+#endif
 
 int Curl_protocol_getsock(struct connectdata *conn,
                           curl_socket_t *socks,
@@ -2481,6 +2489,14 @@ static bool tld_check_name(struct SessionHandle *data,
   size_t err_pos;
   char *uc_name = NULL;
   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 */
   rc = idna_to_unicode_lzlz(ace_hostname, &uc_name, 0);
@@ -2488,24 +2504,21 @@ static bool tld_check_name(struct SessionHandle *data,
     return (FALSE);
 
   rc = tld_check_lz(uc_name, &err_pos, NULL);
-  if (rc == TLD_INVALID)
-     infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n",
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+  if (rc != TLD_SUCCESS)
 #ifdef HAVE_TLD_STRERROR
-           tld_strerror((Tld_rc)rc),
+    tld_errmsg = tld_strerror((Tld_rc)rc);
 #else
-           "<no msg>",
+    tld_errmsg = no_msg;
 #endif
-           err_pos, uc_name[err_pos],
-           uc_name[err_pos] & 255);
+  if (rc == TLD_INVALID)
+    infof(data, "WARNING: %s; pos %u = `%c'/0x%02X\n",
+          tld_errmsg, err_pos, uc_name[err_pos],
+          uc_name[err_pos] & 255);
   else if (rc != TLD_SUCCESS)
-       infof(data, "WARNING: TLD check for %s failed; %s\n",
-             uc_name,
-#ifdef HAVE_TLD_STRERROR
-             tld_strerror((Tld_rc)rc)
-#else
-             "<no msg>"
-#endif
-         );
+    infof(data, "WARNING: TLD check for %s failed; %s\n",
+          uc_name, tld_errmsg);
+#endif /* CURL_DISABLE_VERBOSE_STRINGS */
   if (uc_name)
      idn_free(uc_name);
   return (bool)(rc == TLD_SUCCESS);