From 733a184ce0747c65fbc634e066cfac0ffae43d80 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 12 Sep 2006 23:51:01 +0000 Subject: Compiler warning fix --- lib/ftp.c | 2 +- lib/http.c | 4 ++-- lib/multi.c | 2 +- lib/sendf.c | 2 +- lib/sslgen.c | 4 ++-- lib/url.c | 24 +++++++++++++----------- src/main.c | 8 ++++++-- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index 439fa8bf5..f50918694 100644 --- 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'))); } /*********************************************************************** diff --git a/lib/http.c b/lib/http.c index e69eb74b3..809f20ca9 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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; diff --git a/lib/multi.c b/lib/multi.c index 312e577d7..77c6a9fb4 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -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); diff --git a/lib/sendf.c b/lib/sendf.c index 74b5d35f7..7988d767d 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -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; diff --git a/lib/sslgen.c b/lib/sslgen.c index fec358c51..7d264b0de 100644 --- a/lib/sslgen.c +++ b/lib/sslgen.c @@ -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 diff --git a/lib/url.c b/lib/url.c index e014c8ee4..641d3bf30 100644 --- 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; diff --git a/src/main.c b/src/main.c index 6d4820268..98bba1afc 100644 --- a/src/main.c +++ b/src/main.c @@ -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; } -- cgit v1.2.3