aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-01-11 16:49:35 +0000
committerYang Tse <yangsita@gmail.com>2008-01-11 16:49:35 +0000
commita0420904678c3f084790a19ce8cc8cbce76cb353 (patch)
tree68a5c07409e4262829df810d0824f3f737d45ec6
parent148d7275255dc449e1146f2526a0e1d7afd839ed (diff)
fix compiler warning
-rw-r--r--lib/file.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/file.c b/lib/file.c
index cbc9f4ce8..bfc2b015e 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -373,7 +373,7 @@ static CURLcode file_upload(struct connectdata *conn)
}
else {
buf2 = buf + data->state.resume_from;
- nread -= data->state.resume_from;
+ nread -= (size_t)data->state.resume_from;
data->state.resume_from = 0;
}
}
@@ -426,6 +426,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
curl_off_t expected_size=0;
bool fstated=FALSE;
ssize_t nread;
+ size_t bytestoread;
struct SessionHandle *data = conn->data;
char *buf = data->state.buffer;
curl_off_t bytecount = 0;
@@ -535,10 +536,8 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
while(res == CURLE_OK) {
/* Don't fill a whole buffer if we want less than all data */
- if (expected_size < BUFSIZE-1)
- nread = read(fd, buf, expected_size);
- else
- nread = read(fd, buf, BUFSIZE-1);
+ bytestoread = (expected_size < BUFSIZE-1)?(size_t)expected_size:BUFSIZE-1;
+ nread = read(fd, buf, bytestoread);
if( nread > 0)
buf[nread] = 0;