Skip to content

Commit 502fe43

Browse files
committed
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)
2 parents dc7accd + cb8010b commit 502fe43

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

remote-curl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,11 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
617617
return err;
618618
}
619619

620-
static curl_off_t xcurl_off_t(ssize_t len) {
621-
if (len > maximum_signed_value_of_type(curl_off_t))
620+
static curl_off_t xcurl_off_t(size_t len) {
621+
uintmax_t size = len;
622+
if (size > maximum_signed_value_of_type(curl_off_t))
622623
die("cannot handle pushes this big");
623-
return (curl_off_t) len;
624+
return (curl_off_t)size;
624625
}
625626

626627
static int post_rpc(struct rpc_state *rpc)

0 commit comments

Comments
 (0)