1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

more typecasts to please picky compilers

This commit is contained in:
Daniel Stenberg 2004-08-10 06:41:13 +00:00
parent 5ddad4cdb3
commit 9dbd6659dc
4 changed files with 12 additions and 6 deletions

View File

@ -1690,7 +1690,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
if(readthisamountnow > BUFSIZE) if(readthisamountnow > BUFSIZE)
readthisamountnow = BUFSIZE; readthisamountnow = BUFSIZE;
actuallyread = actuallyread = (curl_off_t)
conn->fread(data->state.buffer, 1, (size_t)readthisamountnow, conn->fread(data->state.buffer, 1, (size_t)readthisamountnow,
conn->fread_in); conn->fread_in);

View File

@ -332,7 +332,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* the 'amount' value is bigger than would fit in 32 bits if /* the 'amount' value is bigger than would fit in 32 bits if
multiplied with 1000, so we use the double math for this */ multiplied with 1000, so we use the double math for this */
data->progress.current_speed = (curl_off_t) data->progress.current_speed = (curl_off_t)
((double)amount/(span_ms/1000.0)); ((double)amount/((double)span_ms/1000.0));
else else
/* the 'amount' value is small enough to fit within 32 bits even /* the 'amount' value is small enough to fit within 32 bits even
when multiplied with 1000 */ when multiplied with 1000 */

View File

@ -137,7 +137,9 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
conn->upload_fromhere += 10; /* 32bit hex + CRLF */ conn->upload_fromhere += 10; /* 32bit hex + CRLF */
} }
nread = conn->fread(conn->upload_fromhere, 1, /* this function returns a size_t, so we typecast to int to prevent warnings
with picky compilers */
nread = (int)conn->fread(conn->upload_fromhere, 1,
buffersize, conn->fread_in); buffersize, conn->fread_in);
if(nread == CURL_READFUNC_ABORT) { if(nread == CURL_READFUNC_ABORT) {

View File

@ -2279,7 +2279,9 @@ static int my_fwrite(void *buffer, size_t sz, size_t nmemb, void *stream)
int rc; int rc;
struct OutStruct *out=(struct OutStruct *)stream; struct OutStruct *out=(struct OutStruct *)stream;
struct Configurable *config = out->config; struct Configurable *config = out->config;
curl_off_t size = sz * nmemb; curl_off_t size = (curl_off_t)(sz * nmemb); /* typecast to prevent
warnings when converting from
unsigned to signed */
if(out && !out->stream) { if(out && !out->stream) {
/* open file for writing */ /* open file for writing */
out->stream=fopen(out->filename, "wb"); out->stream=fopen(out->filename, "wb");
@ -2354,7 +2356,9 @@ static int my_fread(void *buffer, size_t sz, size_t nmemb, void *userp)
{ {
struct InStruct *in=(struct InStruct *)userp; struct InStruct *in=(struct InStruct *)userp;
struct Configurable *config = in->config; struct Configurable *config = in->config;
curl_off_t size = sz * nmemb; curl_off_t size = (curl_off_t)(sz * nmemb); /* typecast to prevent warnings
when converting from
unsigned to signed */
if(config->sendpersecond) { if(config->sendpersecond) {
/* /*