ERR: Remove warnings

This commit is contained in:
Andy Cedilnik 2003-05-01 11:29:15 -04:00
parent 6e143754be
commit 8174deb9e9
8 changed files with 54 additions and 47 deletions

View File

@ -145,10 +145,12 @@ int Curl_base64_encode(const void *inp, int insize, char **outptr)
ibuf[i] = 0; ibuf[i] = 0;
} }
obuf [0] = (ibuf [0] & 0xFC) >> 2; obuf [0] = (unsigned char)((ibuf [0] & 0xFC) >> 2);
obuf [1] = ((ibuf [0] & 0x03) << 4) | ((ibuf [1] & 0xF0) >> 4); obuf [1] = (unsigned char)(((ibuf [0] & 0x03) << 4) |
obuf [2] = ((ibuf [1] & 0x0F) << 2) | ((ibuf [2] & 0xC0) >> 6); ((ibuf [1] & 0xF0) >> 4));
obuf [3] = ibuf [2] & 0x3F; obuf [2] = (unsigned char)(((ibuf [1] & 0x0F) << 2) |
((ibuf [2] & 0xC0) >> 6));
obuf [3] = (unsigned char)(ibuf [2] & 0x3F);
switch(inputparts) { switch(inputparts) {
case 1: /* only one byte read */ case 1: /* only one byte read */

View File

@ -70,6 +70,7 @@
#define EINPROGRESS WSAEINPROGRESS #define EINPROGRESS WSAEINPROGRESS
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#define EISCONN WSAEISCONN #define EISCONN WSAEISCONN
#undef HAVE_DISABLED_NONBLOCKING
#endif #endif
#include "urldata.h" #include "urldata.h"
@ -124,7 +125,7 @@ int Curl_nonblock(int socket, /* operate on this */
#ifdef HAVE_IOCTLSOCKET #ifdef HAVE_IOCTLSOCKET
int flags; int flags;
flags = nonblock; flags = nonblock;
return ioctlsocket(socket, FIONBIO, &flags); return ioctlsocket(socket, FIONBIO, (unsigned long*)&flags);
#define SETBLOCK 3 #define SETBLOCK 3
#endif #endif
@ -326,6 +327,8 @@ static CURLcode bindlocal(struct connectdata *conn,
#endif /* end of HAVE_INET_NTOA */ #endif /* end of HAVE_INET_NTOA */
#endif /* end of not WIN32 */ #endif /* end of not WIN32 */
(void)conn;
(void)sockfd;
return CURLE_HTTP_PORT_FAILED; return CURLE_HTTP_PORT_FAILED;
} }

View File

@ -186,7 +186,7 @@ Curl_cookie_add(struct CookieInfo *c,
} }
else if(strequal("domain", name)) { else if(strequal("domain", name)) {
co->domain=strdup(whatptr); co->domain=strdup(whatptr);
co->field1= (whatptr[0]=='.')?2:1; co->field1= (char)((whatptr[0]=='.')?2:1);
} }
else if(strequal("version", name)) { else if(strequal("version", name)) {
co->version=strdup(whatptr); co->version=strdup(whatptr);
@ -314,7 +314,7 @@ Curl_cookie_add(struct CookieInfo *c,
We don't currently take advantage of this knowledge. We don't currently take advantage of this knowledge.
*/ */
co->field1=strequal(ptr, "TRUE")+1; /* store information */ co->field1=(char)(strequal(ptr, "TRUE")+1); /* store information */
break; break;
case 2: case 2:
/* It turns out, that sometimes the file format allows the path /* It turns out, that sometimes the file format allows the path
@ -330,7 +330,7 @@ Curl_cookie_add(struct CookieInfo *c,
fields++; /* add a field and fall down to secure */ fields++; /* add a field and fall down to secure */
/* FALLTHROUGH */ /* FALLTHROUGH */
case 3: case 3:
co->secure = strequal(ptr, "TRUE"); co->secure = (bool)strequal(ptr, "TRUE");
break; break;
case 4: case 4:
co->expires = atoi(ptr); co->expires = atoi(ptr);

View File

@ -96,7 +96,7 @@ char *curl_unescape(const char *string, int length)
if('%' == in) { if('%' == in) {
/* encoded part */ /* encoded part */
if(sscanf(string+1, "%02X", &hex)) { if(sscanf(string+1, "%02X", &hex)) {
in = hex; in = (unsigned char)hex;
string+=2; string+=2;
alloc-=2; alloc-=2;
} }

View File

@ -884,7 +884,7 @@ ftp_pasv_verbose(struct connectdata *conn,
int h_errnop; int h_errnop;
# endif # endif
char *hostent_buf = (char *)bigbuf; /* get a char * to the buffer */ char *hostent_buf = (char *)bigbuf; /* get a char * to the buffer */
(void)hostent_buf;
address = inet_addr(newhost); address = inet_addr(newhost);
# ifdef HAVE_GETHOSTBYADDR_R # ifdef HAVE_GETHOSTBYADDR_R
@ -1434,7 +1434,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
sprintf(newhost, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); sprintf(newhost, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
newhostp = newhost; newhostp = newhost;
newport = (port[0]<<8) + port[1]; newport = (unsigned short)((port[0]<<8) + port[1]);
} }
#if 1 #if 1
else if (229 == results[modeoff]) { else if (229 == results[modeoff]) {
@ -1450,7 +1450,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
&num, &num,
&separator[3])) { &separator[3])) {
/* the four separators should be identical */ /* the four separators should be identical */
newport = num; newport = (unsigned short)num;
/* we should use the same host we already are connected to */ /* we should use the same host we already are connected to */
newhostp = conn->name; newhostp = conn->name;
@ -2003,7 +2003,7 @@ CURLcode ftp_perform(struct connectdata *conn,
struct tm buffer; struct tm buffer;
tm = (struct tm *)localtime_r(&data->info.filetime, &buffer); tm = (struct tm *)localtime_r(&data->info.filetime, &buffer);
#else #else
tm = localtime((unsigned long *)&data->info.filetime); tm = localtime((time_t *)&data->info.filetime);
#endif #endif
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S %Z\r\n", strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S %Z\r\n",

View File

@ -113,7 +113,7 @@ static int 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)?TRUE:FALSE);
if(http->postsize <= fullsize) { if(http->postsize <= fullsize) {
memcpy(buffer, http->postdata, http->postsize); memcpy(buffer, http->postdata, http->postsize);
@ -716,7 +716,7 @@ CURLcode Curl_http(struct connectdata *conn)
if(data->cookies) { if(data->cookies) {
co = Curl_cookie_getlist(data->cookies, co = Curl_cookie_getlist(data->cookies,
host, ppath, host, ppath,
(conn->protocol&PROT_HTTPS?TRUE:FALSE)); (bool)(conn->protocol&PROT_HTTPS?TRUE:FALSE));
} }
if (data->change.proxy && *data->change.proxy && if (data->change.proxy && *data->change.proxy &&
!data->set.tunnel_thru_httpproxy && !data->set.tunnel_thru_httpproxy &&

View File

@ -108,6 +108,7 @@ static void DynaClose(void)
static void * DynaGetFunction(const char *name) static void * DynaGetFunction(const char *name)
{ {
void *func = NULL; void *func = NULL;
(void)name;
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) #if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
if (libldap) { if (libldap) {

View File

@ -336,7 +336,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)use_cache;
} }
break; break;
case CURLOPT_SSL_CIPHER_LIST: case CURLOPT_SSL_CIPHER_LIST:
@ -398,33 +398,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)(va_arg(param, long)?TRUE:FALSE);
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)(va_arg(param, long)?TRUE:FALSE);
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)(va_arg(param, long)?TRUE:FALSE);
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.http_include_header = va_arg(param, long)?TRUE:FALSE; data->set.http_include_header = (bool)(va_arg(param, long)?TRUE:FALSE);
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)(va_arg(param, long)?TRUE:FALSE);
if(data->set.hide_progress) if(data->set.hide_progress)
data->progress.flags |= PGRS_HIDE; data->progress.flags |= PGRS_HIDE;
else else
@ -434,20 +434,20 @@ 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.no_body = va_arg(param, long)?TRUE:FALSE; data->set.no_body = (bool)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_FAILONERROR: case CURLOPT_FAILONERROR:
/* /*
* 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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_UPLOAD: case CURLOPT_UPLOAD:
/* /*
* We want to sent data to the remote host * We want to sent data to the remote host
*/ */
data->set.upload = va_arg(param, long)?TRUE:FALSE; data->set.upload = (bool)(va_arg(param, long)?TRUE:FALSE);
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;
@ -457,20 +457,20 @@ 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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_FTPLISTONLY: case CURLOPT_FTPLISTONLY:
/* /*
* 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)(va_arg(param, long)?TRUE:FALSE);
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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_NETRC: case CURLOPT_NETRC:
/* /*
@ -482,7 +482,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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_HTTP_VERSION: case CURLOPT_HTTP_VERSION:
/* /*
@ -498,7 +498,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
* *
* Transfer using ASCII (instead of BINARY). * Transfer using ASCII (instead of BINARY).
*/ */
data->set.ftp_ascii = va_arg(param, long)?TRUE:FALSE; data->set.ftp_ascii = (bool)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_PUT: case CURLOPT_PUT:
/* /*
@ -607,11 +607,11 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
* Use FTP PORT, this also specifies which IP address to use * Use FTP PORT, this also specifies which IP address to use
*/ */
data->set.ftpport = va_arg(param, char *); data->set.ftpport = va_arg(param, char *);
data->set.ftp_use_port = data->set.ftpport?1:0; data->set.ftp_use_port = (bool)(data->set.ftpport?TRUE:FALSE);
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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_HTTPHEADER: case CURLOPT_HTTPHEADER:
@ -733,7 +733,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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_PROXY: case CURLOPT_PROXY:
/* /*
@ -759,7 +759,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)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_PROXYPORT: case CURLOPT_PROXYPORT:
/* /*
@ -1001,7 +1001,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
/* /*
* Kludgy option to enable CRLF convertions. Subject for removal. * Kludgy option to enable CRLF convertions. Subject for removal.
*/ */
data->set.crlf = va_arg(param, long)?TRUE:FALSE; data->set.crlf = (bool)(va_arg(param, long)?TRUE:FALSE);
break; break;
case CURLOPT_INTERFACE: case CURLOPT_INTERFACE:
/* /*
@ -1015,7 +1015,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
* A string that defines the krb4 security level. * A string that defines the krb4 security level.
*/ */
data->set.krb4_level = va_arg(param, char *); data->set.krb4_level = va_arg(param, char *);
data->set.krb4=data->set.krb4_level?TRUE:FALSE; data->set.krb4=(bool)(data->set.krb4_level?TRUE:FALSE);
break; break;
case CURLOPT_SSL_VERIFYPEER: case CURLOPT_SSL_VERIFYPEER:
/* /*
@ -1067,7 +1067,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)(va_arg(param, long) ? TRUE : FALSE);
break; break;
case CURLOPT_SHARE: case CURLOPT_SHARE:
@ -1766,21 +1766,22 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->firstsocket = -1; /* no file descriptor */ conn->firstsocket = -1; /* no file descriptor */
conn->secondarysocket = -1; /* no file descriptor */ conn->secondarysocket = -1; /* no file descriptor */
conn->connectindex = -1; /* no index */ conn->connectindex = -1; /* no index */
conn->bits.httpproxy = (data->change.proxy && *data->change.proxy && conn->bits.httpproxy = (bool)((data->change.proxy && *data->change.proxy &&
(data->set.proxytype == CURLPROXY_HTTP))? (data->set.proxytype == CURLPROXY_HTTP))?
TRUE:FALSE; /* http proxy or not */ TRUE:FALSE); /* http proxy or not */
conn->bits.use_range = data->set.set_range?TRUE:FALSE; /* range status */ conn->bits.use_range = (bool)(data->set.set_range?TRUE:FALSE);
/* range status */
conn->range = data->set.set_range; /* clone the range setting */ conn->range = data->set.set_range; /* clone the range setting */
conn->resume_from = data->set.set_resume_from; /* inherite resume_from */ conn->resume_from = data->set.set_resume_from; /* inherite resume_from */
/* Default protocol-independent behavior doesn't support persistant /* Default protocol-independent behavior doesn't support persistant
connections, so we set this to force-close. Protocols that support connections, so we set this to force-close. Protocols that support
this need to set this to FALSE in their "curl_do" functions. */ this need to set this to FALSE in their "curl_do" functions. */
conn->bits.close = TRUE; conn->bits.close = (bool)TRUE;
/* inherite initial knowledge from the data struct */ /* inherite initial knowledge from the data struct */
conn->bits.user_passwd = data->set.userpwd?1:0; conn->bits.user_passwd = (bool)(data->set.userpwd?TRUE:FALSE);
conn->bits.proxy_user_passwd = data->set.proxyuserpwd?1:0; conn->bits.proxy_user_passwd = (bool)(data->set.proxyuserpwd?TRUE:FALSE);
/* maxdownload must be -1 on init, as 0 is a valid value! */ /* maxdownload must be -1 on init, as 0 is a valid value! */
conn->maxdownload = -1; /* might have been used previously! */ conn->maxdownload = -1; /* might have been used previously! */
@ -1793,7 +1794,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
is later set "for real" using Curl_pgrsStartNow(). */ is later set "for real" using Curl_pgrsStartNow(). */
conn->data->progress.start = conn->created; conn->data->progress.start = conn->created;
conn->bits.upload_chunky = conn->bits.upload_chunky = (bool)(
((conn->protocol&PROT_HTTP) && ((conn->protocol&PROT_HTTP) &&
data->set.upload && data->set.upload &&
(data->set.infilesize == -1) && (data->set.infilesize == -1) &&
@ -1801,7 +1802,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
/* HTTP, upload, unknown file size and not HTTP 1.0 */ /* HTTP, upload, unknown file size and not HTTP 1.0 */
TRUE: TRUE:
/* else, no chunky upload */ /* else, no chunky upload */
FALSE; FALSE);
conn->fread = data->set.fread; conn->fread = data->set.fread;
conn->fread_in = data->set.in; conn->fread_in = data->set.in;
@ -2030,7 +2031,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
/* Now, build <protocol>_proxy and check for such a one to use */ /* Now, build <protocol>_proxy and check for such a one to use */
while(*protop) while(*protop)
*envp++ = tolower(*protop++); *envp++ = (char)tolower(*protop++);
/* append _proxy */ /* append _proxy */
strcpy(envp, "_proxy"); strcpy(envp, "_proxy");
@ -2053,7 +2054,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(!prox && !strequal("http_proxy", proxy_env)) { if(!prox && !strequal("http_proxy", proxy_env)) {
/* There was no lowercase variable, try the uppercase version: */ /* There was no lowercase variable, try the uppercase version: */
for(envp = proxy_env; *envp; envp++) for(envp = proxy_env; *envp; envp++)
*envp = toupper(*envp); *envp = (char)toupper(*envp);
prox=curl_getenv(proxy_env); prox=curl_getenv(proxy_env);
} }
@ -2236,7 +2237,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(type) { if(type) {
char command; char command;
*type=0; /* it was in the middle of the hostname */ *type=0; /* it was in the middle of the hostname */
command = toupper(type[6]); command = (char)toupper(type[6]);
switch(command) { switch(command) {
case 'A': /* ASCII mode */ case 'A': /* ASCII mode */
data->set.ftp_ascii = 1; data->set.ftp_ascii = 1;