Merge branch 'tb/xcurl-off-t'

The xcurl_off_t() helper function is used to cast size_t to
curl_off_t, but some compilers gave warnings against the code to
ensure the casting is done without wraparound, when size_t is
narrower than curl_off_t.  This warning has been squelched.

* tb/xcurl-off-t:
  remote-curl.c: xcurl_off_t is not portable (on 32 bit platfoms)
This commit is contained in:
Junio C Hamano 2018-11-19 16:24:40 +09:00
commit 502fe438bf

View File

@ -617,10 +617,11 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
return err;
}
static curl_off_t xcurl_off_t(ssize_t len) {
if (len > maximum_signed_value_of_type(curl_off_t))
static curl_off_t xcurl_off_t(size_t len) {
uintmax_t size = len;
if (size > maximum_signed_value_of_type(curl_off_t))
die("cannot handle pushes this big");
return (curl_off_t) len;
return (curl_off_t)size;
}
static int post_rpc(struct rpc_state *rpc)