From: tboegi@web.de
To: git@vger.kernel.org
Cc: "Torsten Bögershausen" <tboegi@web.de>
Subject: [PATCH v1 2/2] curl_off_t xcurl_off_t is not portable
Date: Thu, 25 Oct 2018 18:13:10 +0200 [thread overview]
Message-ID: <20181025161310.29249-1-tboegi@web.de> (raw)
From: Torsten Bögershausen <tboegi@web.de>
Comparing signed and unsigned values is not always portable.
When setting
DEVELOPER = 1
DEVOPTS = extra-all
"gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516" errors out with
"comparison is always false due to limited range of data type"
"[-Werror=type-limits]"
Solution:
Use a valid cast & compare, similar to xsize_t()
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
remote-curl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/remote-curl.c b/remote-curl.c
index 762a55a75f..c89fd6d1c3 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -618,9 +618,10 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
}
static curl_off_t xcurl_off_t(ssize_t len) {
- if (len > maximum_signed_value_of_type(curl_off_t))
+ curl_off_t size = (curl_off_t) len;
+ if (len != (ssize_t) size)
die("cannot handle pushes this big");
- return (curl_off_t) len;
+ return size;
}
static int post_rpc(struct rpc_state *rpc)
--
2.11.0
next reply other threads:[~2018-10-25 16:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-25 16:13 tboegi [this message]
2018-10-26 2:48 ` [PATCH v1 2/2] curl_off_t xcurl_off_t is not portable Junio C Hamano
2018-10-26 15:15 ` Torsten Bögershausen
2018-10-29 16:59 ` [PATCH v2 1/1] remote-curl.c: xcurl_off_t is not portable (on 32 bit platfoms) tboegi
2018-11-09 17:41 ` tboegi
2018-11-12 3:50 ` Junio C Hamano
2018-11-12 5:20 ` Torsten Bögershausen
2018-11-12 8:03 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181025161310.29249-1-tboegi@web.de \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).