aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-12-04 05:53:07 +0100
committerYang Tse <yangsita@gmail.com>2010-12-04 05:53:07 +0100
commitc1901f7ed0dc43a92e611ff4cfc00ad97425318f (patch)
tree394c83122f62518080a923494fe5411afccded97 /lib/ssh.c
parent9c4ff4874e0df1c16d10674ec418cd23c263ec3f (diff)
fix compiler warning: conversion may lose significant bits
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 52cf5ad98..d432b4ec4 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -101,6 +101,7 @@
#include "strtoofft.h"
#include "multiif.h"
#include "select.h"
+#include "warnless.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -1541,21 +1542,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
- curl_off_t readthisamountnow;
- curl_off_t actuallyread;
do {
- readthisamountnow = (data->state.resume_from - passed);
+ size_t readthisamountnow =
+ (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
+ BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
- if(readthisamountnow > BUFSIZE)
- readthisamountnow = BUFSIZE;
-
- actuallyread =
- (curl_off_t) conn->fread_func(data->state.buffer, 1,
- (size_t)readthisamountnow,
- conn->fread_in);
+ size_t actuallyread =
+ conn->fread_func(data->state.buffer, 1, readthisamountnow,
+ conn->fread_in);
passed += actuallyread;
- if((actuallyread <= 0) || (actuallyread > readthisamountnow)) {
+ if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
/* this checks for greater-than only to make sure that the
CURL_READFUNC_ABORT return code still aborts */
failf(data, "Failed to read data");