Compiler warning fix

This commit is contained in:
Yang Tse 2006-09-10 23:37:42 +00:00
parent 8d24c0212e
commit c30e908034
5 changed files with 37 additions and 37 deletions

View File

@ -2537,7 +2537,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
if(ftpcode/100 == 2) if(ftpcode/100 == 2)
/* We have enabled SSL for the data connection! */ /* We have enabled SSL for the data connection! */
conn->ssl[SECONDARYSOCKET].use = 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 /* FTP servers typically responds with 500 if they decide to reject
our 'P' request */ our 'P' request */
else if(data->set.ftp_ssl> CURLFTPSSL_CONTROL) else if(data->set.ftp_ssl> CURLFTPSSL_CONTROL)
@ -2768,7 +2768,7 @@ CURLcode Curl_ftp_multi_statemach(struct connectdata *conn,
} }
else if(rc != 0) { else if(rc != 0) {
result = ftp_statemach_act(conn); result = ftp_statemach_act(conn);
*done = (ftpc->state == FTP_STOP); *done = (bool)(ftpc->state == FTP_STOP);
} }
/* if rc == 0, then select() timed out */ /* 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 */ /* parse the URL path into separate path components */
while ((slash_pos = strchr(cur_pos, '/')) != NULL) { while ((slash_pos = strchr(cur_pos, '/')) != NULL) {
/* 1 or 0 to indicate absolute directory */ /* 1 or 0 to indicate absolute directory */
bool absolute_dir = (cur_pos - data->reqdata.path > 0) && bool absolute_dir = (bool)((cur_pos - data->reqdata.path > 0) &&
(ftpc->dirdepth == 0); (ftpc->dirdepth == 0));
/* seek out the next path component */ /* seek out the next path component */
if (slash_pos-cur_pos) { if (slash_pos-cur_pos) {

View File

@ -775,7 +775,7 @@ static size_t readmoredata(char *buffer,
return 0; return 0;
/* make sure that a HTTP request is never sent away chunked! */ /* 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) { if(http->postsize <= (curl_off_t)fullsize) {
memcpy(buffer, http->postdata, (size_t)http->postsize); memcpy(buffer, http->postdata, (size_t)http->postsize);

View File

@ -158,14 +158,14 @@ static int passwd_callback(char *buf, int num, int verify
#define seed_enough(x) rand_enough() #define seed_enough(x) rand_enough()
static bool rand_enough(void) static bool rand_enough(void)
{ {
return RAND_status()?TRUE:FALSE; return (bool)(0 != RAND_status());
} }
#else #else
#define seed_enough(x) rand_enough(x) #define seed_enough(x) rand_enough(x)
static bool rand_enough(int nread) static bool rand_enough(int nread)
{ {
/* this is a very silly decision to make */ /* this is a very silly decision to make */
return (nread > 500)?TRUE:FALSE; return (bool)(nread > 500);
} }
#endif #endif

View File

@ -343,7 +343,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
didwhat |= KEEP_READ; didwhat |= KEEP_READ;
/* indicates data of zero size, i.e. empty file */ /* 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 */ /* NULL terminate, allowing string ops to be used */
if (0 < nread || is_empty_data) { if (0 < nread || is_empty_data) {
@ -1484,7 +1484,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
} }
/* Now update the "done" boolean we return */ /* Now update the "done" boolean we return */
*done = !k->keepon; *done = (bool)(0 == k->keepon);
return CURLE_OK; return CURLE_OK;
} }

View File

@ -490,7 +490,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
Curl_global_host_cache_init(); Curl_global_host_cache_init();
} }
data->set.global_dns_cache = use_cache; data->set.global_dns_cache = (bool)(0 != use_cache);
} }
break; break;
case CURLOPT_SSL_CIPHER_LIST: 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 * When this transfer is done, it must not be left to be reused by a
* subsequent transfer but shall be closed immediately. * 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; break;
case CURLOPT_FRESH_CONNECT: case CURLOPT_FRESH_CONNECT:
/* /*
* This transfer shall not use a previously cached connection but * This transfer shall not use a previously cached connection but
* should be made with a fresh new connect! * 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; break;
case CURLOPT_VERBOSE: case CURLOPT_VERBOSE:
/* /*
* Verbose means infof() calls that give a lot of information about * Verbose means infof() calls that give a lot of information about
* the connection and transfer procedures as well as internal choices. * 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; break;
case CURLOPT_HEADER: case CURLOPT_HEADER:
/* /*
* Set to include the header in the general data output stream. * 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; break;
case CURLOPT_NOPROGRESS: case CURLOPT_NOPROGRESS:
/* /*
* Shut off the internal supported progress meter * 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) if(data->set.hide_progress)
data->progress.flags |= PGRS_HIDE; data->progress.flags |= PGRS_HIDE;
else else
@ -597,7 +597,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Do not include the body part in the output data stream. * 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) if(data->set.opt_no_body)
/* in HTTP lingo, this means using the HEAD request */ /* in HTTP lingo, this means using the HEAD request */
data->set.httpreq = HTTPREQ_HEAD; 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 * Don't output the >=300 error code HTML-page, but instead only
* return error. * 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; break;
case CURLOPT_UPLOAD: case CURLOPT_UPLOAD:
case CURLOPT_PUT: 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 * We want to sent data to the remote host. If this is HTTP, that equals
* using the PUT request. * 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(data->set.upload)
/* If this is HTTP, PUT is what's needed to "upload" */ /* If this is HTTP, PUT is what's needed to "upload" */
data->set.httpreq = HTTPREQ_PUT; 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 * Try to get the file time of the remote document. The time will
* later (possibly) become available using curl_easy_getinfo(). * 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; break;
case CURLOPT_FTP_CREATE_MISSING_DIRS: case CURLOPT_FTP_CREATE_MISSING_DIRS:
/* /*
* An FTP option that modifies an upload to create missing directories on * An FTP option that modifies an upload to create missing directories on
* the server. * 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; break;
case CURLOPT_FTP_RESPONSE_TIMEOUT: 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 * An FTP option that changes the command to one that asks for a list
* only, no file info details. * 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; break;
case CURLOPT_FTPAPPEND: case CURLOPT_FTPAPPEND:
/* /*
* We want to upload and append to an existing (FTP) file. * 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; break;
case CURLOPT_FTP_FILEMETHOD: case CURLOPT_FTP_FILEMETHOD:
/* /*
@ -679,7 +679,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* *
* Transfer using ASCII (instead of BINARY). * 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; break;
case CURLOPT_TIMECONDITION: 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. * 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; break;
case CURLOPT_ENCODING: case CURLOPT_ENCODING:
@ -730,7 +730,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Follow Location: header hints on a HTTP-server. * 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; break;
case CURLOPT_UNRESTRICTED_AUTH: case CURLOPT_UNRESTRICTED_AUTH:
@ -739,7 +739,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* hostname changed. * hostname changed.
*/ */
data->set.http_disable_hostname_check_before_authentication = data->set.http_disable_hostname_check_before_authentication =
va_arg(param, long)?TRUE:FALSE; (bool)(0 != va_arg(param, long));
break; break;
case CURLOPT_MAXREDIRS: 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 * We run mostly with the original cookie spec, as hardly anyone implements
* anything else. * anything else.
*/ */
data->set.cookiesession = (bool)va_arg(param, long); data->set.cookiesession = (bool)(0 != va_arg(param, long));
break; break;
case CURLOPT_COOKIELIST: 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 * 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; break;
case CURLOPT_CUSTOMREQUEST: case CURLOPT_CUSTOMREQUEST:
@ -1061,11 +1061,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break; break;
case CURLOPT_FTP_USE_EPRT: 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; break;
case CURLOPT_FTP_USE_EPSV: 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; break;
case CURLOPT_FTP_SKIP_PASV_IP: 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 * Enable or disable FTP_SKIP_PASV_IP, which will disable/enable the
* bypass of the IP address in PASV responses. * 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; break;
case CURLOPT_INFILE: case CURLOPT_INFILE:
@ -1353,7 +1353,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
/* /*
* Kludgy option to enable CRLF conversions. Subject for removal. * 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; break;
case CURLOPT_INTERFACE: 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, * The application asks not to set any signal() or alarm() handlers,
* even when using a timeout. * 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; break;
case CURLOPT_SHARE: 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 * Enable or disable TCP_NODELAY, which will disable/enable the Nagle
* algorithm * algorithm
*/ */
data->set.tcp_nodelay = (bool)va_arg(param, long); data->set.tcp_nodelay = (bool)(0 != va_arg(param, long));
break; break;
/*********** 3rd party transfer options ***********/ /*********** 3rd party transfer options ***********/
@ -1604,14 +1604,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
break; break;
case CURLOPT_IGNORE_CONTENT_LENGTH: case CURLOPT_IGNORE_CONTENT_LENGTH:
data->set.ignorecl = va_arg(param, long)?TRUE:FALSE; data->set.ignorecl = (bool)(0 != va_arg(param, long));
break; break;
case CURLOPT_CONNECT_ONLY: case CURLOPT_CONNECT_ONLY:
/* /*
* No data transfer, set up connection and let application use the socket * 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; break;
case CURLOPT_FTP_ALTERNATIVE_TO_USER: case CURLOPT_FTP_ALTERNATIVE_TO_USER:
@ -2788,7 +2788,7 @@ static bool tld_check_name(struct SessionHandle *data,
); );
if (uc_name) if (uc_name)
idn_free(uc_name); idn_free(uc_name);
return (rc == TLD_SUCCESS); return (bool)(rc == TLD_SUCCESS);
} }
#endif #endif