ERR: Remove warnings on Visual Studio 7

This commit is contained in:
Andy Cedilnik 2003-05-02 09:31:52 -04:00
parent 7cefbad8dc
commit 1bb8d8109e
16 changed files with 71 additions and 67 deletions

View File

@ -127,7 +127,7 @@ int Curl_base64_encode(const void *inp, int insize, char **outptr)
char *indata = (char *)inp; char *indata = (char *)inp;
if(0 == insize) if(0 == insize)
insize = strlen(indata); insize = (int)strlen(indata);
base64data = output = (char*)malloc(insize*4/3+4); base64data = output = (char*)malloc(insize*4/3+4);
if(NULL == output) if(NULL == output)
@ -177,7 +177,7 @@ int Curl_base64_encode(const void *inp, int insize, char **outptr)
*output=0; *output=0;
*outptr = base64data; /* make it return the actual data memory */ *outptr = base64data; /* make it return the actual data memory */
return strlen(base64data); /* return the length of the new data */ return (int)strlen(base64data); /* return the length of the new data */
} }
/* ---- End of Base64 Encoding ---- */ /* ---- End of Base64 Encoding ---- */

View File

@ -592,7 +592,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
/* create an IPv4 TCP socket */ /* create an IPv4 TCP socket */
sockfd = socket(AF_INET, SOCK_STREAM, 0); sockfd = (int)socket(AF_INET, SOCK_STREAM, 0);
if(-1 == sockfd) { if(-1 == sockfd) {
failf(data, "couldn't create socket"); failf(data, "couldn't create socket");
return CURLE_COULDNT_CONNECT; /* big time error */ return CURLE_COULDNT_CONNECT; /* big time error */

View File

@ -169,7 +169,7 @@ Curl_cookie_add(struct CookieInfo *c,
char *whatptr; char *whatptr;
/* Strip off trailing whitespace from the 'what' */ /* Strip off trailing whitespace from the 'what' */
int len=strlen(what); size_t len=strlen(what);
while(len && isspace((int)what[len-1])) { while(len && isspace((int)what[len-1])) {
what[len-1]=0; what[len-1]=0;
len--; len--;
@ -203,11 +203,11 @@ Curl_cookie_add(struct CookieInfo *c,
*/ */
co->maxage = strdup(whatptr); co->maxage = strdup(whatptr);
co->expires = co->expires =
atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]) + now; atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]) + (long)now;
} }
else if(strequal("expires", name)) { else if(strequal("expires", name)) {
co->expirestr=strdup(whatptr); co->expirestr=strdup(whatptr);
co->expires = curl_getdate(what, &now); co->expires = (long)curl_getdate(what, &now);
} }
else if(!co->name) { else if(!co->name) {
co->name = strdup(name); co->name = strdup(name);
@ -560,7 +560,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
struct Cookie *newco; struct Cookie *newco;
struct Cookie *co; struct Cookie *co;
time_t now = time(NULL); time_t now = time(NULL);
int hostlen=strlen(host); int hostlen=(int)strlen(host);
int domlen; int domlen;
struct Cookie *mainco=NULL; struct Cookie *mainco=NULL;
@ -578,7 +578,7 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
(co->secure?secure:TRUE) ) { (co->secure?secure:TRUE) ) {
/* now check if the domain is correct */ /* now check if the domain is correct */
domlen=co->domain?strlen(co->domain):0; domlen=co->domain?(int)strlen(co->domain):0;
if(!co->domain || if(!co->domain ||
((domlen<=hostlen) && ((domlen<=hostlen) &&
strequal(host+(hostlen-domlen), co->domain)) ) { strequal(host+(hostlen-domlen), co->domain)) ) {

View File

@ -563,7 +563,7 @@ static int AllocAndCopy (char **buffer, int buffer_length)
if (buffer_length) if (buffer_length)
length = buffer_length; length = buffer_length;
else { else {
length = strlen(*buffer); length = (int)strlen(*buffer);
add = 1; add = 1;
} }
*buffer = (char*)malloc(length+add); *buffer = (char*)malloc(length+add);
@ -1011,7 +1011,7 @@ static int AddFormData(struct FormData **formp,
/* we make it easier for plain strings: */ /* we make it easier for plain strings: */
if(!length) if(!length)
length = strlen((char *)line); length = (long)strlen((char *)line);
newform->line = (char *)malloc(length+1); newform->line = (char *)malloc(length+1);
memcpy(newform->line, line, length); memcpy(newform->line, line, length);
@ -1057,7 +1057,7 @@ char *Curl_FormBoundary(void)
if(!retstring) if(!retstring)
return NULL; /* failed */ return NULL; /* failed */
srand(time(NULL)+randomizer++); /* seed */ srand((unsigned int)(time(NULL)+randomizer++)); /* seed */
strcpy(retstring, "curl"); /* bonus commercials 8*) */ strcpy(retstring, "curl"); /* bonus commercials 8*) */
@ -1239,7 +1239,7 @@ CURLcode Curl_getFormData(struct FormData **finalform,
/*VMS?? Stream files are OK, as are FIXED & VAR files WITHOUT implied CC */ /*VMS?? Stream files are OK, as are FIXED & VAR files WITHOUT implied CC */
/*VMS?? For implied CC, every record needs to have a \n appended & 1 added to SIZE */ /*VMS?? For implied CC, every record needs to have a \n appended & 1 added to SIZE */
if(fileread) { if(fileread) {
while((nread = fread(buffer, 1, 1024, fileread))) while((nread = (int)fread(buffer, 1, 1024, fileread)))
size += AddFormData(&form, buffer, nread); size += AddFormData(&form, buffer, nread);
if(fileread != stdin) if(fileread != stdin)
@ -1316,7 +1316,7 @@ int Curl_FormReader(char *buffer,
form=(struct Form *)mydata; form=(struct Form *)mydata;
wantedsize = size * nitems; wantedsize = (int)(size * nitems);
if(!form->data) if(!form->data)
return 0; /* nothing, error, empty */ return 0; /* nothing, error, empty */
@ -1362,7 +1362,7 @@ int Curl_FormReadOneLine(char *buffer,
form=(struct Form *)mydata; form=(struct Form *)mydata;
wantedsize = size * nitems; wantedsize = (int)(size * nitems);
if(!form->data) if(!form->data)
return -1; /* nothing, error, empty */ return -1; /* nothing, error, empty */

View File

@ -146,7 +146,7 @@ static CURLcode AllowServerConnect(struct SessionHandle *data,
struct sockaddr_in add; struct sockaddr_in add;
getsockname(sock, (struct sockaddr *) &add, (socklen_t *)&size); getsockname(sock, (struct sockaddr *) &add, (socklen_t *)&size);
s=accept(sock, (struct sockaddr *) &add, (socklen_t *)&size); s=(int)accept(sock, (struct sockaddr *) &add, (socklen_t *)&size);
sclose(sock); /* close the first socket */ sclose(sock); /* close the first socket */
@ -263,7 +263,7 @@ CURLcode Curl_GetFTPResponse(int *nreadp, /* return number of bytes read */
/* we had data in the "cache", copy that instead of doing an actual /* we had data in the "cache", copy that instead of doing an actual
read */ read */
memcpy(ptr, ftp->cache, ftp->cache_size); memcpy(ptr, ftp->cache, ftp->cache_size);
gotbytes = ftp->cache_size; gotbytes = (int)ftp->cache_size;
free(ftp->cache); /* free the cache */ free(ftp->cache); /* free the cache */
ftp->cache = NULL; /* clear the pointer */ ftp->cache = NULL; /* clear the pointer */
ftp->cache_size = 0; /* zero the size just in case */ ftp->cache_size = 0; /* zero the size just in case */
@ -1210,7 +1210,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
h = Curl_resolv(data, myhost, 0); h = Curl_resolv(data, myhost, 0);
} }
else { else {
int len = strlen(data->set.ftpport); size_t len = strlen(data->set.ftpport);
if(len>1) if(len>1)
h = Curl_resolv(data, data->set.ftpport, 0); h = Curl_resolv(data, data->set.ftpport, 0);
if(h) if(h)
@ -1236,7 +1236,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
Curl_resolv_unlock(h); Curl_resolv_unlock(h);
if ( h || sa_filled_in) { if ( h || sa_filled_in) {
if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) { if( (portsock = (int)socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) {
int size; int size;
/* we set the secondary socket variable to this for now, it /* we set the secondary socket variable to this for now, it
@ -1592,17 +1592,17 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
input. If we knew it was a proper file we could've just input. If we knew it was a proper file we could've just
fseek()ed but we only have a stream here */ fseek()ed but we only have a stream here */
do { do {
int readthisamountnow = (conn->resume_from - passed); size_t readthisamountnow = (conn->resume_from - passed);
int actuallyread; size_t actuallyread;
if(readthisamountnow > BUFSIZE) if(readthisamountnow > BUFSIZE)
readthisamountnow = BUFSIZE; readthisamountnow = BUFSIZE;
actuallyread = actuallyread =
conn->fread(data->state.buffer, 1, readthisamountnow, conn->fread(data->state.buffer, 1, readthisamountnow,
conn->fread_in); conn->fread_in);
passed += actuallyread; passed += (int)actuallyread;
if(actuallyread != readthisamountnow) { if(actuallyread != readthisamountnow) {
failf(data, "Could only read %d bytes from the input", passed); failf(data, "Could only read %d bytes from the input", passed);
return CURLE_FTP_COULDNT_USE_REST; return CURLE_FTP_COULDNT_USE_REST;
@ -1867,7 +1867,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
char *bytes; char *bytes;
bytes=strstr(buf, " bytes"); bytes=strstr(buf, " bytes");
if(bytes--) { if(bytes--) {
int index=bytes-buf; int index=(int)(bytes-buf);
/* this is a hint there is size information in there! ;-) */ /* this is a hint there is size information in there! ;-) */
while(--index) { while(--index) {
/* scan for the parenthesis and break there */ /* scan for the parenthesis and break there */
@ -2066,7 +2066,8 @@ CURLcode Curl_ftp(struct connectdata *conn)
ftp->file = strrchr(conn->ppath, '/'); ftp->file = strrchr(conn->ppath, '/');
if(ftp->file) { if(ftp->file) {
if(ftp->file != conn->ppath) if(ftp->file != conn->ppath)
dirlength=ftp->file-conn->ppath; /* don't count the traling slash */ /* don't count the traling slash */
dirlength=(int)(ftp->file-conn->ppath);
ftp->file++; /* point to the first letter in the file name part or ftp->file++; /* point to the first letter in the file name part or
remain NULL */ remain NULL */
@ -2138,7 +2139,7 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
strcat(s, "\r\n"); /* append a trailing CRLF */ strcat(s, "\r\n"); /* append a trailing CRLF */
bytes_written=0; bytes_written=0;
write_len = strlen(s); write_len = (int)strlen(s);
do { do {
res = Curl_write(conn, conn->firstsocket, sptr, write_len, res = Curl_write(conn, conn->firstsocket, sptr, write_len,

View File

@ -728,7 +728,7 @@ yynewstate:
#endif #endif
/* Get the current used size of the three stacks, in elements. */ /* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1; int size = (int)(yyssp - yyss + 1);
#ifdef yyoverflow #ifdef yyoverflow
/* Each stack pointer address is followed by the size of /* Each stack pointer address is followed by the size of
@ -1855,7 +1855,7 @@ LookupWord (yylval, buff)
} }
/* Strip off any plural and try the units table again. */ /* Strip off any plural and try the units table again. */
i = strlen (buff) - 1; i = (int)strlen (buff) - 1;
if (buff[i] == 's') if (buff[i] == 's')
{ {
buff[i] = '\0'; buff[i] = '\0';

View File

@ -282,7 +282,7 @@ Curl_hash_clean_with_criterium(curl_hash *h, void *user,
int int
Curl_hash_count(curl_hash *h) Curl_hash_count(curl_hash *h)
{ {
return h->size; return (int)h->size;
} }
/* }}} */ /* }}} */

View File

@ -240,7 +240,7 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data,
#endif #endif
/* Create an entry id, based upon the hostname and port */ /* Create an entry id, based upon the hostname and port */
entry_len = strlen(hostname); entry_len = (int)strlen(hostname);
entry_id = create_hostcache_id(hostname, port, &entry_len); entry_id = create_hostcache_id(hostname, port, &entry_len);
/* If we can't create the entry id, fail */ /* If we can't create the entry id, fail */
if (!entry_id) if (!entry_id)
@ -279,7 +279,7 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data,
/* Remove outdated and unused entries from the hostcache */ /* Remove outdated and unused entries from the hostcache */
hostcache_prune(data->hostcache, hostcache_prune(data->hostcache,
data->set.dns_cache_timeout, data->set.dns_cache_timeout,
now); (int)now);
HOSTCACHE_RETURN(dns); HOSTCACHE_RETURN(dns);
} }
@ -412,7 +412,7 @@ static struct hostent* pack_hostent(char** buf, struct hostent* orig)
int i; int i;
char *str; char *str;
int len; size_t len;
bufptr = *buf; bufptr = *buf;
copy = (struct hostent*)bufptr; copy = (struct hostent*)bufptr;

View File

@ -106,7 +106,7 @@ static int readmoredata(char *buffer,
{ {
struct connectdata *conn = (struct connectdata *)userp; struct connectdata *conn = (struct connectdata *)userp;
struct HTTP *http = conn->proto.http; struct HTTP *http = conn->proto.http;
int fullsize = size * nitems; int fullsize = (int)(size * nitems);
if(0 == http->postsize) if(0 == http->postsize)
/* nothing to return */ /* nothing to return */
@ -195,7 +195,7 @@ CURLcode add_buffer_send(send_buffer *in,
to the circumstances we will just loop and try again and again etc */ to the circumstances we will just loop and try again and again etc */
ptr = in->buffer; ptr = in->buffer;
size = in->size_used; size = (int)in->size_used;
res = Curl_write(conn, sockfd, ptr, size, &amount); res = Curl_write(conn, sockfd, ptr, size, &amount);
@ -274,7 +274,7 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size)
if(!in->buffer || if(!in->buffer ||
((in->size_used + size) > (in->size_max - 1))) { ((in->size_used + size) > (in->size_max - 1))) {
new_size = (in->size_used+size)*2; new_size = (int)((in->size_used+size)*2);
if(in->buffer) if(in->buffer)
/* we have a buffer, enlarge the existing one */ /* we have a buffer, enlarge the existing one */
new_rb = (char *)realloc(in->buffer, new_size); new_rb = (char *)realloc(in->buffer, new_size);
@ -666,7 +666,8 @@ CURLcode Curl_http(struct connectdata *conn)
curl_strequal(data->state.auth_host, conn->hostname)) { curl_strequal(data->state.auth_host, conn->hostname)) {
sprintf(data->state.buffer, "%s:%s", sprintf(data->state.buffer, "%s:%s",
data->state.user, data->state.passwd); data->state.user, data->state.passwd);
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer), if(Curl_base64_encode(data->state.buffer,
(int)strlen(data->state.buffer),
&authorization) >= 0) { &authorization) >= 0) {
if(conn->allocptr.userpwd) if(conn->allocptr.userpwd)
free(conn->allocptr.userpwd); free(conn->allocptr.userpwd);
@ -804,7 +805,7 @@ CURLcode Curl_http(struct connectdata *conn)
if(readthisamountnow > BUFSIZE) if(readthisamountnow > BUFSIZE)
readthisamountnow = BUFSIZE; readthisamountnow = BUFSIZE;
actuallyread = actuallyread = (int)
data->set.fread(data->state.buffer, 1, readthisamountnow, data->set.fread(data->state.buffer, 1, readthisamountnow,
data->set.in); data->set.in);
@ -1125,9 +1126,9 @@ CURLcode Curl_http(struct connectdata *conn)
/* and here we setup the pointers to the actual data */ /* and here we setup the pointers to the actual data */
if(data->set.postfields) { if(data->set.postfields) {
if(data->set.postfieldsize) if(data->set.postfieldsize)
http->postsize = data->set.postfieldsize; http->postsize = (int)data->set.postfieldsize;
else else
http->postsize = strlen(data->set.postfields); http->postsize = (int)strlen(data->set.postfields);
http->postdata = data->set.postfields; http->postdata = data->set.postfields;
http->sending = HTTPSEND_BODY; http->sending = HTTPSEND_BODY;

View File

@ -171,7 +171,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
We expect another 'datasize' of data. We have 'length' right now, We expect another 'datasize' of data. We have 'length' right now,
it can be more or less than 'datasize'. Get the smallest piece. it can be more or less than 'datasize'. Get the smallest piece.
*/ */
piece = (ch->datasize >= length)?length:ch->datasize; piece = (int)((ch->datasize >= length)?length:ch->datasize);
/* Write the data portion available */ /* Write the data portion available */
/* Added content-encoding here; untested but almost identical to the /* Added content-encoding here; untested but almost identical to the

View File

@ -732,8 +732,8 @@ static int dprintf_formatf(
*w-- = digits[num % base]; *w-- = digits[num % base];
num /= base; num /= base;
} }
width -= workend - w; width -= (long)(workend - w);
prec -= workend - w; prec -= (long)(workend - w);
if (alt && base == 8 && prec <= 0) { if (alt && base == 8 && prec <= 0) {
*w-- = '0'; *w-- = '0';
@ -812,7 +812,7 @@ static int dprintf_formatf(
if (prec != -1 && (size_t) prec < len) if (prec != -1 && (size_t) prec < len)
len = prec; len = prec;
width -= len; width -= (long)len;
if (p->flags & FLAGS_ALT) if (p->flags & FLAGS_ALT)
OUTCHAR('"'); OUTCHAR('"');
@ -933,9 +933,9 @@ static int dprintf_formatf(
else else
#endif #endif
if (p->flags & FLAGS_LONG) if (p->flags & FLAGS_LONG)
*(long int *) p->data.ptr = done; *(long int *) p->data.ptr = (long int)done;
else if (!(p->flags & FLAGS_SHORT)) else if (!(p->flags & FLAGS_SHORT))
*(int *) p->data.ptr = done; *(int *) p->data.ptr = (int)done;
else else
*(short int *) p->data.ptr = (short int)done; *(short int *) p->data.ptr = (short int)done;
break; break;
@ -946,7 +946,7 @@ static int dprintf_formatf(
f = *end++; /* goto end of %-code */ f = *end++; /* goto end of %-code */
} }
return done; return (int)done;
} }
/* fputc() look-alike */ /* fputc() look-alike */

View File

@ -155,7 +155,7 @@ void Curl_failf(struct SessionHandle *data, const char *fmt, ...)
data->state.errorbuf = TRUE; /* wrote error string */ data->state.errorbuf = TRUE; /* wrote error string */
if(data->set.verbose) { if(data->set.verbose) {
int len = strlen(data->set.errorbuffer); int len = (int)strlen(data->set.errorbuffer);
bool doneit=FALSE; bool doneit=FALSE;
if(len < CURL_ERROR_SIZE) { if(len < CURL_ERROR_SIZE) {
doneit = TRUE; doneit = TRUE;
@ -189,7 +189,7 @@ CURLcode Curl_sendf(int sockfd, struct connectdata *conn,
return CURLE_OUT_OF_MEMORY; /* failure */ return CURLE_OUT_OF_MEMORY; /* failure */
bytes_written=0; bytes_written=0;
write_len = strlen(s); write_len = (int)strlen(s);
sptr = s; sptr = s;
do { do {
@ -265,7 +265,7 @@ CURLcode Curl_write(struct connectdata *conn, int sockfd,
else else
#endif /* KRB4 */ #endif /* KRB4 */
{ {
bytes_written = swrite(sockfd, mem, len); bytes_written = (int)swrite(sockfd, mem, (int)len);
} }
if(-1 == bytes_written) { if(-1 == bytes_written) {
#ifdef WIN32 #ifdef WIN32
@ -374,7 +374,7 @@ int Curl_read(struct connectdata *conn,
nread = Curl_sec_read(conn, sockfd, buf, buffersize); nread = Curl_sec_read(conn, sockfd, buf, buffersize);
else else
#endif #endif
nread = sread (sockfd, buf, buffersize); nread = sread (sockfd, buf, (int)buffersize);
if(-1 == nread) { if(-1 == nread) {
#ifdef WIN32 #ifdef WIN32

View File

@ -129,6 +129,8 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
#pragma warning ( disable : 4706 ) #pragma warning ( disable : 4706 )
#pragma warning ( disable : 4131 ) /* Old style declaration */ #pragma warning ( disable : 4131 ) /* Old style declaration */
#pragma warning ( disable : 4055 ) /* Cast void*(*)() to void* */ #pragma warning ( disable : 4055 ) /* Cast void*(*)() to void* */
#pragma warning ( disable : 4311 ) /* Allow cast from void* to long/int */
#pragma warning ( disable : 4312 ) /* Allow cast from long to char* */
struct _RPC_ASYNC_STATE; struct _RPC_ASYNC_STATE;
#endif #endif
#if !defined(__GNUC__) || defined(__MINGW32__) #if !defined(__GNUC__) || defined(__MINGW32__)

View File

@ -826,10 +826,10 @@ static void suboption(struct connectdata *conn)
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
struct TELNET *tn = (struct TELNET *)conn->proto.telnet; struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
printsub(data, '<', (unsigned char *)tn->subbuffer, SB_LEN(tn)+2); printsub(data, '<', (unsigned char *)tn->subbuffer, (int)SB_LEN(tn)+2);
switch (subchar = (unsigned char)SB_GET(tn)) { switch (subchar = (unsigned char)SB_GET(tn)) {
case TELOPT_TTYPE: case TELOPT_TTYPE:
len = strlen(tn->subopt_ttype) + 4 + 2; len = (int)strlen(tn->subopt_ttype) + 4 + 2;
snprintf((char *)temp, sizeof(temp), snprintf((char *)temp, sizeof(temp),
"%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE,
TELQUAL_IS, tn->subopt_ttype, IAC, SE); TELQUAL_IS, tn->subopt_ttype, IAC, SE);
@ -837,7 +837,7 @@ static void suboption(struct connectdata *conn)
printsub(data, '>', &temp[2], len-2); printsub(data, '>', &temp[2], len-2);
break; break;
case TELOPT_XDISPLOC: case TELOPT_XDISPLOC:
len = strlen(tn->subopt_xdisploc) + 4 + 2; len = (int)strlen(tn->subopt_xdisploc) + 4 + 2;
snprintf((char *)temp, sizeof(temp), snprintf((char *)temp, sizeof(temp),
"%c%c%c%c%s%c%c", IAC, SB, TELOPT_XDISPLOC, "%c%c%c%c%s%c%c", IAC, SB, TELOPT_XDISPLOC,
TELQUAL_IS, tn->subopt_xdisploc, IAC, SE); TELQUAL_IS, tn->subopt_xdisploc, IAC, SE);
@ -850,7 +850,7 @@ static void suboption(struct connectdata *conn)
len = 4; len = 4;
for(v = tn->telnet_vars;v;v = v->next) { for(v = tn->telnet_vars;v;v = v->next) {
tmplen = (strlen(v->data) + 1); tmplen = (int)(strlen(v->data) + 1);
/* Add the variable only if it fits */ /* Add the variable only if it fits */
if(len + tmplen < (int)sizeof(temp)-6) { if(len + tmplen < (int)sizeof(temp)-6) {
sscanf(v->data, "%127[^,],%s", varname, varval); sscanf(v->data, "%127[^,],%s", varname, varval);

View File

@ -134,8 +134,8 @@ static int fillbuffer(struct connectdata *conn,
conn->upload_fromhere += 10; /* 32bit hex + CRLF */ conn->upload_fromhere += 10; /* 32bit hex + CRLF */
} }
nread = conn->fread(conn->upload_fromhere, 1, nread = (int)conn->fread(conn->upload_fromhere, 1,
buffersize, conn->fread_in); buffersize, conn->fread_in);
if(!conn->bits.forbidchunk && conn->bits.upload_chunky) { if(!conn->bits.forbidchunk && conn->bits.upload_chunky) {
/* if chunked Transfer-Encoding */ /* if chunked Transfer-Encoding */
@ -294,7 +294,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
char *newbuff; char *newbuff;
long newsize=MAX((k->hbuflen+nread)*3/2, long newsize=MAX((k->hbuflen+nread)*3/2,
data->state.headersize*2); data->state.headersize*2);
hbufp_index = k->hbufp - data->state.headerbuff; hbufp_index = (int)(k->hbufp - data->state.headerbuff);
newbuff = (char *)realloc(data->state.headerbuff, newsize); newbuff = (char *)realloc(data->state.headerbuff, newsize);
if(!newbuff) { if(!newbuff) {
failf (data, "Failed to alloc memory for big header!"); failf (data, "Failed to alloc memory for big header!");
@ -321,7 +321,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
} }
/* decrease the size of the remaining buffer */ /* decrease the size of the remaining buffer */
nread -= (k->end_ptr - k->str)+1; nread -= (int)((k->end_ptr - k->str)+1);
k->str = k->end_ptr + 1; /* move past new line */ k->str = k->end_ptr + 1; /* move past new line */
@ -334,10 +334,10 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if (k->hbuflen + (k->str - k->str_start) >= if (k->hbuflen + (k->str - k->str_start) >=
data->state.headersize) { data->state.headersize) {
char *newbuff; char *newbuff;
long newsize=MAX((k->hbuflen+ long newsize=(long)MAX((k->hbuflen+
(k->str-k->str_start))*3/2, (k->str-k->str_start))*3/2,
data->state.headersize*2); data->state.headersize*2);
hbufp_index = k->hbufp - data->state.headerbuff; hbufp_index = (int)(k->hbufp - data->state.headerbuff);
newbuff = (char *)realloc(data->state.headerbuff, newsize); newbuff = (char *)realloc(data->state.headerbuff, newsize);
if(!newbuff) { if(!newbuff) {
failf (data, "Failed to alloc memory for big header!"); failf (data, "Failed to alloc memory for big header!");
@ -351,7 +351,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* copy to end of line */ /* copy to end of line */
strncpy (k->hbufp, k->str_start, k->str - k->str_start); strncpy (k->hbufp, k->str_start, k->str - k->str_start);
k->hbufp += k->str - k->str_start; k->hbufp += k->str - k->str_start;
k->hbuflen += k->str - k->str_start; k->hbuflen += (int)(k->str - k->str_start);
*k->hbufp = 0; *k->hbufp = 0;
k->p = data->state.headerbuff; k->p = data->state.headerbuff;
@ -420,7 +420,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if (data->set.http_include_header) if (data->set.http_include_header)
k->writetype |= CLIENTWRITE_BODY; k->writetype |= CLIENTWRITE_BODY;
headerlen = k->p - data->state.headerbuff; headerlen = (int)(k->p - data->state.headerbuff);
result = Curl_client_write(data, k->writetype, result = Curl_client_write(data, k->writetype,
data->state.headerbuff, data->state.headerbuff,

View File

@ -1426,8 +1426,8 @@ static int handleSock5Proxy(
/* Needs user name and password */ /* Needs user name and password */
int userlen, pwlen, len; int userlen, pwlen, len;
userlen = strlen(proxy_name); userlen = (int)strlen(proxy_name);
pwlen = strlen(proxy_password); pwlen = (int)strlen(proxy_password);
/* username/password request looks like /* username/password request looks like
* +----+------+----------+------+----------+ * +----+------+----------+------+----------+
@ -1813,7 +1813,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
* other parts of the code will rely on this fact * other parts of the code will rely on this fact
***********************************************************/ ***********************************************************/
#define LEAST_PATH_ALLOC 256 #define LEAST_PATH_ALLOC 256
urllen=strlen(data->change.url); urllen=(int)strlen(data->change.url);
if(urllen < LEAST_PATH_ALLOC) if(urllen < LEAST_PATH_ALLOC)
urllen=LEAST_PATH_ALLOC; urllen=LEAST_PATH_ALLOC;
@ -2009,9 +2009,9 @@ static CURLcode CreateConnection(struct SessionHandle *data,
unsigned int namelen; unsigned int namelen;
char *endptr = strchr(conn->name, ':'); char *endptr = strchr(conn->name, ':');
if(endptr) if(endptr)
namelen=endptr-conn->name; namelen=(unsigned int)(endptr-conn->name);
else else
namelen=strlen(conn->name); namelen=(unsigned int)strlen(conn->name);
if(strlen(nope) <= namelen) { if(strlen(nope) <= namelen) {
char *checkn= char *checkn=
@ -2779,7 +2779,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
char *authorization; char *authorization;
snprintf(data->state.buffer, BUFSIZE, "%s:%s", snprintf(data->state.buffer, BUFSIZE, "%s:%s",
data->state.proxyuser, data->state.proxypasswd); data->state.proxyuser, data->state.proxypasswd);
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer), if(Curl_base64_encode(data->state.buffer, (int)strlen(data->state.buffer),
&authorization) >= 0) { &authorization) >= 0) {
if(conn->allocptr.proxyuserpwd) if(conn->allocptr.proxyuserpwd)
free(conn->allocptr.proxyuserpwd); free(conn->allocptr.proxyuserpwd);