summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-19 07:24:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-19 07:24:40 (GMT)
commit502fe438bf83f5db6026c278767decf2ce6395b0 (patch)
tree991e1ad6e31fcc8595b33489bac98c63d40d6177
parentdc7accd7554795bf094ca43518d52fffae502ea3 (diff)
parentcb8010bbffaa680968ed0301a5da5b55ed399a56 (diff)
downloadgit-502fe438bf83f5db6026c278767decf2ce6395b0.zip
git-502fe438bf83f5db6026c278767decf2ce6395b0.tar.gz
git-502fe438bf83f5db6026c278767decf2ce6395b0.tar.bz2
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)
-rw-r--r--remote-curl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 762a55a..1220dff 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -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)