From c30e908034dec008990d58759dd28d3cdbef536b Mon Sep 17 00:00:00 2001
From: Yang Tse <yangsita@gmail.com>
Date: Sun, 10 Sep 2006 23:37:42 +0000
Subject: Compiler warning fix

---
 lib/ftp.c      |  8 ++++----
 lib/http.c     |  2 +-
 lib/ssluse.c   |  4 ++--
 lib/transfer.c |  4 ++--
 lib/url.c      | 56 ++++++++++++++++++++++++++++----------------------------
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/lib/ftp.c b/lib/ftp.c
index ed441412e..439fa8bf5 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2537,7 +2537,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
       if(ftpcode/100 == 2)
         /* We have enabled SSL for the data connection! */
         conn->ssl[SECONDARYSOCKET].use =
-          data->set.ftp_ssl != CURLFTPSSL_CONTROL;
+          (bool)(data->set.ftp_ssl != CURLFTPSSL_CONTROL);
       /* FTP servers typically responds with 500 if they decide to reject
          our 'P' request */
       else if(data->set.ftp_ssl> CURLFTPSSL_CONTROL)
@@ -2768,7 +2768,7 @@ CURLcode Curl_ftp_multi_statemach(struct connectdata *conn,
   }
   else if(rc != 0) {
     result = ftp_statemach_act(conn);
-    *done = (ftpc->state == FTP_STOP);
+    *done = (bool)(ftpc->state == FTP_STOP);
   }
   /* if rc == 0, then select() timed out */
 
@@ -3955,8 +3955,8 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
     /* parse the URL path into separate path components */
     while ((slash_pos = strchr(cur_pos, '/')) != NULL) {
       /* 1 or 0 to indicate absolute directory */
-      bool absolute_dir = (cur_pos - data->reqdata.path > 0) &&
-        (ftpc->dirdepth == 0);
+      bool absolute_dir = (bool)((cur_pos - data->reqdata.path > 0) &&
+        (ftpc->dirdepth == 0));
 
       /* seek out the next path component */
       if (slash_pos-cur_pos) {
diff --git a/lib/http.c b/lib/http.c
index f4b642bd1..e69eb74b3 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -775,7 +775,7 @@ static size_t readmoredata(char *buffer,
     return 0;
 
   /* make sure that a HTTP request is never sent away chunked! */
-  conn->bits.forbidchunk= (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE;
+  conn->bits.forbidchunk = (bool)(http->sending == HTTPSEND_REQUEST);
 
   if(http->postsize <= (curl_off_t)fullsize) {
     memcpy(buffer, http->postdata, (size_t)http->postsize);
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 90b8afe20..a0a16f005 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -158,14 +158,14 @@ static int passwd_callback(char *buf, int num, int verify
 #define seed_enough(x) rand_enough()
 static bool rand_enough(void)
 {
-  return RAND_status()?TRUE:FALSE;
+  return (bool)(0 != RAND_status());
 }
 #else
 #define seed_enough(x) rand_enough(x)
 static bool rand_enough(int nread)
 {
   /* this is a very silly decision to make */
-  return (nread > 500)?TRUE:FALSE;
+  return (bool)(nread > 500);
 }
 #endif
 
diff --git a/lib/transfer.c b/lib/transfer.c
index a476352d3..7436a9c66 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -343,7 +343,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
 
         didwhat |= KEEP_READ;
         /* indicates data of zero size, i.e. empty file */
-        is_empty_data = (nread == 0 && k->bodywrites == 0);
+        is_empty_data = (bool)((nread == 0) && (k->bodywrites == 0));
 
         /* NULL terminate, allowing string ops to be used */
         if (0 < nread || is_empty_data) {
@@ -1484,7 +1484,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
   }
 
   /* Now update the "done" boolean we return */
-  *done = !k->keepon;
+  *done = (bool)(0 == k->keepon);
 
   return CURLE_OK;
 }
diff --git a/lib/url.c b/lib/url.c
index 46aee6650..6e170d3ef 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -490,7 +490,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
         Curl_global_host_cache_init();
       }
 
-      data->set.global_dns_cache = use_cache;
+      data->set.global_dns_cache = (bool)(0 != use_cache);
     }
     break;
   case CURLOPT_SSL_CIPHER_LIST:
@@ -561,33 +561,33 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * When this transfer is done, it must not be left to be reused by a
      * subsequent transfer but shall be closed immediately.
      */
-    data->set.reuse_forbid = va_arg(param, long)?TRUE:FALSE;
+    data->set.reuse_forbid = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_FRESH_CONNECT:
     /*
      * This transfer shall not use a previously cached connection but
      * should be made with a fresh new connect!
      */
-    data->set.reuse_fresh = va_arg(param, long)?TRUE:FALSE;
+    data->set.reuse_fresh = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_VERBOSE:
     /*
      * Verbose means infof() calls that give a lot of information about
      * the connection and transfer procedures as well as internal choices.
      */
-    data->set.verbose = va_arg(param, long)?TRUE:FALSE;
+    data->set.verbose = = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_HEADER:
     /*
      * Set to include the header in the general data output stream.
      */
-    data->set.include_header = va_arg(param, long)?TRUE:FALSE;
+    data->set.include_header = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_NOPROGRESS:
     /*
      * Shut off the internal supported progress meter
      */
-    data->set.hide_progress = va_arg(param, long)?TRUE:FALSE;
+    data->set.hide_progress = (bool)(0 != va_arg(param, long));
     if(data->set.hide_progress)
       data->progress.flags |= PGRS_HIDE;
     else
@@ -597,7 +597,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     /*
      * Do not include the body part in the output data stream.
      */
-    data->set.opt_no_body = va_arg(param, long)?TRUE:FALSE;
+    data->set.opt_no_body = (bool)(0 != va_arg(param, long));
     if(data->set.opt_no_body)
       /* in HTTP lingo, this means using the HEAD request */
       data->set.httpreq = HTTPREQ_HEAD;
@@ -607,7 +607,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * Don't output the >=300 error code HTML-page, but instead only
      * return error.
      */
-    data->set.http_fail_on_error = va_arg(param, long)?TRUE:FALSE;
+    data->set.http_fail_on_error = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_UPLOAD:
   case CURLOPT_PUT:
@@ -615,7 +615,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * We want to sent data to the remote host. If this is HTTP, that equals
      * using the PUT request.
      */
-    data->set.upload = va_arg(param, long)?TRUE:FALSE;
+    data->set.upload = (bool)(0 != va_arg(param, long));
     if(data->set.upload)
       /* If this is HTTP, PUT is what's needed to "upload" */
       data->set.httpreq = HTTPREQ_PUT;
@@ -625,14 +625,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * Try to get the file time of the remote document. The time will
      * later (possibly) become available using curl_easy_getinfo().
      */
-    data->set.get_filetime = va_arg(param, long)?TRUE:FALSE;
+    data->set.get_filetime = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_FTP_CREATE_MISSING_DIRS:
     /*
      * An FTP option that modifies an upload to create missing directories on
      * the server.
      */
-    data->set.ftp_create_missing_dirs = va_arg( param , long )?TRUE:FALSE;
+    data->set.ftp_create_missing_dirs = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_FTP_RESPONSE_TIMEOUT:
     /*
@@ -646,13 +646,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * An FTP option that changes the command to one that asks for a list
      * only, no file info details.
      */
-    data->set.ftp_list_only = va_arg(param, long)?TRUE:FALSE;
+    data->set.ftp_list_only = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_FTPAPPEND:
     /*
      * We want to upload and append to an existing (FTP) file.
      */
-    data->set.ftp_append = va_arg(param, long)?TRUE:FALSE;
+    data->set.ftp_append = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_FTP_FILEMETHOD:
     /*
@@ -679,7 +679,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      *
      * Transfer using ASCII (instead of BINARY).
      */
-    data->set.prefer_ascii = va_arg(param, long)?TRUE:FALSE;
+    data->set.prefer_ascii = (bool)(0 != va_arg(param, long));
     break;
   case CURLOPT_TIMECONDITION:
     /*
@@ -708,7 +708,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     /*
      * Switch on automatic referer that gets set if curl follows locations.
      */
-    data->set.http_auto_referer = va_arg(param, long)?1:0;
+    data->set.http_auto_referer = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_ENCODING:
@@ -730,7 +730,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     /*
      * Follow Location: header hints on a HTTP-server.
      */
-    data->set.http_follow_location = va_arg(param, long)?TRUE:FALSE;
+    data->set.http_follow_location = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_UNRESTRICTED_AUTH:
@@ -739,7 +739,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * hostname changed.
      */
     data->set.http_disable_hostname_check_before_authentication =
-      va_arg(param, long)?TRUE:FALSE;
+      (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_MAXREDIRS:
@@ -884,7 +884,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * We run mostly with the original cookie spec, as hardly anyone implements
      * anything else.
      */
-    data->set.cookiesession = (bool)va_arg(param, long);
+    data->set.cookiesession = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_COOKIELIST:
@@ -949,7 +949,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     /*
      * Tunnel operations through the proxy instead of normal proxy use
      */
-    data->set.tunnel_thru_httpproxy = va_arg(param, long)?TRUE:FALSE;
+    data->set.tunnel_thru_httpproxy = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_CUSTOMREQUEST:
@@ -1061,11 +1061,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     break;
 
   case CURLOPT_FTP_USE_EPRT:
-    data->set.ftp_use_eprt = va_arg(param, long)?TRUE:FALSE;
+    data->set.ftp_use_eprt = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_FTP_USE_EPSV:
-    data->set.ftp_use_epsv = va_arg(param, long)?TRUE:FALSE;
+    data->set.ftp_use_epsv = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_FTP_SKIP_PASV_IP:
@@ -1073,7 +1073,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * Enable or disable FTP_SKIP_PASV_IP, which will disable/enable the
      * bypass of the IP address in PASV responses.
      */
-    data->set.ftp_skip_ip = (bool)va_arg(param, long);
+    data->set.ftp_skip_ip = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_INFILE:
@@ -1353,7 +1353,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     /*
      * Kludgy option to enable CRLF conversions. Subject for removal.
      */
-    data->set.crlf = va_arg(param, long)?TRUE:FALSE;
+    data->set.crlf = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_INTERFACE:
@@ -1445,7 +1445,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * The application asks not to set any signal() or alarm() handlers,
      * even when using a timeout.
      */
-    data->set.no_signal = va_arg(param, long) ? TRUE : FALSE;
+    data->set.no_signal = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_SHARE:
@@ -1559,7 +1559,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * Enable or disable TCP_NODELAY, which will disable/enable the Nagle
      * algorithm
      */
-    data->set.tcp_nodelay = (bool)va_arg(param, long);
+    data->set.tcp_nodelay = (bool)(0 != va_arg(param, long));
     break;
 
   /*********** 3rd party transfer options ***********/
@@ -1604,14 +1604,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     break;
 
   case CURLOPT_IGNORE_CONTENT_LENGTH:
-    data->set.ignorecl = va_arg(param, long)?TRUE:FALSE;
+    data->set.ignorecl = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_CONNECT_ONLY:
     /*
      * No data transfer, set up connection and let application use the socket
      */
-    data->set.connect_only = va_arg(param, long)?TRUE:FALSE;
+    data->set.connect_only = (bool)(0 != va_arg(param, long));
     break;
 
   case CURLOPT_FTP_ALTERNATIVE_TO_USER:
@@ -2788,7 +2788,7 @@ static bool tld_check_name(struct SessionHandle *data,
          );
   if (uc_name)
      idn_free(uc_name);
-  return (rc == TLD_SUCCESS);
+  return (bool)(rc == TLD_SUCCESS);
 }
 #endif
 
-- 
cgit v1.2.3