]> granicus.if.org Git - curl/commitdiff
Compiler warning fix
authorYang Tse <yangsita@gmail.com>
Tue, 12 Sep 2006 23:51:01 +0000 (23:51 +0000)
committerYang Tse <yangsita@gmail.com>
Tue, 12 Sep 2006 23:51:01 +0000 (23:51 +0000)
lib/ftp.c
lib/http.c
lib/multi.c
lib/sendf.c
lib/sslgen.c
lib/url.c
src/main.c

index 439fa8bf568765155169ac2769643b01471680a9..f50918694bddbec31f784dc8e48e6951ccfca6ce 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -173,7 +173,7 @@ static void freedirs(struct connectdata *conn)
 */
 static bool isBadFtpString(const char *string)
 {
-  return strchr(string, '\r') != NULL || strchr(string, '\n') != NULL;
+  return (bool)((NULL != strchr(string, '\r')) || (NULL != strchr(string, '\n')));
 }
 
 /***********************************************************************
index e69eb74b31c77c302733ec23ffbb9f17b8532f13..809f20ca91c130ddbe01be8f4a2b5be1a401f86d 100644 (file)
@@ -455,7 +455,7 @@ Curl_http_output_auth(struct connectdata *conn,
       if(auth) {
         infof(data, "Proxy auth using %s with user '%s'\n",
               auth, conn->proxyuser?conn->proxyuser:"");
-        authproxy->multi = !authproxy->done;
+        authproxy->multi = (bool)(!authproxy->done);
       }
       else
         authproxy->multi = FALSE;
@@ -525,7 +525,7 @@ Curl_http_output_auth(struct connectdata *conn,
         infof(data, "Server auth using %s with user '%s'\n",
               auth, conn->user);
 
-        authhost->multi = !authhost->done;
+        authhost->multi = (bool)(!authhost->done);
       }
       else
         authhost->multi = FALSE;
index 312e577d78e6c096cd0eea3104466136d8c87d05..77c6a9fb4e2303c47a0e20643e1c8ffb8a0f3a84 100644 (file)
@@ -706,7 +706,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
   do {
 
     if(!GOOD_EASY_HANDLE(easy->easy_handle))
-      return CURLE_BAD_FUNCTION_ARGUMENT;
+      return CURLM_BAD_EASY_HANDLE;
 
     if (easy->easy_handle->state.pipe_broke) {
       infof(easy->easy_handle, "Pipe broke: handle 0x%x\n", easy);
index 74b5d35f713b259157c8501f96d759a408527165..7988d767dafeb50922b2043df52e5536a8eb2383 100644 (file)
@@ -477,7 +477,7 @@ int Curl_read(struct connectdata *conn, /* connection data */
 
   conn->bits.stream_was_rewound = FALSE;
 
-  *n = bytestocopy;
+  *n = (ssize_t)bytestocopy;
 
   if (bytesremaining == 0) {
       return CURLE_OK;
index fec358c5154322cbd8aade623b7c8cc86e04c959..7d264b0deb26e8c758b706417fb9fb816d2a975d 100644 (file)
@@ -68,10 +68,10 @@ static bool safe_strequal(char* str1, char* str2)
 {
   if(str1 && str2)
     /* both pointers point to something then compare them */
-    return strequal(str1, str2);
+    return (bool)(0 != strequal(str1, str2));
   else
     /* if both pointers are NULL then treat them as equal */
-    return (!str1 && !str2);
+    return (bool)(!str1 && !str2);
 }
 
 bool
index e014c8ee4cd31b5e08ee8bea65487841d547914f..641d3bf301361c719a2dc755ef98b471b9f9de7e 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1060,7 +1060,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * Use FTP PORT, this also specifies which IP address to use
      */
     data->set.ftpport = va_arg(param, char *);
-    data->set.ftp_use_port = data->set.ftpport?1:0;
+    data->set.ftp_use_port = (bool)(NULL != data->set.ftpport);
     break;
 
   case CURLOPT_FTP_USE_EPRT:
@@ -1383,7 +1383,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * A string that defines the krb4 security level.
      */
     data->set.krb4_level = va_arg(param, char *);
-    data->set.krb4=data->set.krb4_level?TRUE:FALSE;
+    data->set.krb4 = (bool)(NULL != data->set.krb4_level);
     break;
   case CURLOPT_SSL_VERIFYPEER:
     /*
@@ -1571,7 +1571,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
      * SOURCE URL
      */
     data->set.source_url = va_arg(param, char *);
-    data->set.printhost = (data->set.source_url != NULL);
+    data->set.printhost = (bool)(NULL != data->set.source_url);
     break;
 
   case CURLOPT_SOURCE_USERPWD:
@@ -1636,7 +1636,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
     break;
 
   case CURLOPT_SSL_SESSIONID_CACHE:
-    data->set.ssl.sessionid = va_arg(param, long)?TRUE:FALSE;
+    data->set.ssl.sessionid = (bool)(0 != va_arg(param, long));
     break;
 
   default:
@@ -1842,7 +1842,7 @@ bool Curl_isHandleAtHead(struct SessionHandle *handle,
 {
   struct curl_llist_element *curr = pipe->head;
   if (curr) {
-    return curr->ptr == handle ? TRUE : FALSE;
+    return (bool)(curr->ptr == handle);
   }
 
   return FALSE;
@@ -3111,9 +3111,10 @@ static CURLcode CreateConnection(struct SessionHandle *data,
   conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD;     /* no file descriptor */
   conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
   conn->connectindex = -1;    /* no index */
-  conn->bits.httpproxy = (data->change.proxy && *data->change.proxy &&
-                          (data->set.proxytype == CURLPROXY_HTTP))?
-    TRUE:FALSE; /* http proxy or not */
+
+  conn->bits.httpproxy = (bool)(data->change.proxy  /* http proxy or not */
+                             && *data->change.proxy 
+                             && (data->set.proxytype == CURLPROXY_HTTP));
 
   /* Default protocol-independent behavior doesn't support persistent
      connections, so we set this to force-close. Protocols that support
@@ -3130,13 +3131,14 @@ static CURLcode CreateConnection(struct SessionHandle *data,
   /* Store creation time to help future close decision making */
   conn->created = Curl_tvnow();
 
-  data->reqdata.use_range = data->set.set_range?TRUE:FALSE; /* range status */
+  /* range status */
+  data->reqdata.use_range = (bool)(NULL != data->set.set_range);
 
   data->reqdata.range = data->set.set_range; /* clone the range setting */
   data->reqdata.resume_from = data->set.set_resume_from;
 
-  conn->bits.user_passwd = data->set.userpwd?1:0;
-  conn->bits.proxy_user_passwd = data->set.proxyuserpwd?1:0;
+  conn->bits.user_passwd = (bool)(NULL != data->set.userpwd);
+  conn->bits.proxy_user_passwd = (bool)(NULL != data->set.proxyuserpwd);
   conn->bits.no_body = data->set.opt_no_body;
   conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
   conn->bits.ftp_use_epsv = data->set.ftp_use_epsv;
index 6d48202685bde14a473c9d287d029f97147bc1cb..98bba1afc281a3840f308805f898781ba50a0a7c 100644 (file)
@@ -1462,7 +1462,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
     /* we can loop here if we have multiple single-letters */
 
     if(!longopt) {
-      letter = parse?(char)*parse:'\0';
+      if(NULL != parse) {
+        letter = (char)*parse;
+      else {
+        letter = '\0';
+      }
       subletter='\0';
     }
     else {
@@ -3048,7 +3052,7 @@ int my_trace(CURL *handle, curl_infotype type,
       break;
     }
 
-    newl = (size && (data[size-1] != '\n'));
+    newl = (bool)(size && (data[size-1] != '\n'));
 
     return 0;
   }