From: Ramsay Jones Date: Thu, 21 Sep 2017 16:46:24 GMT Subject: [PATCH 1/4] git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings Message-ID: <15367a04-754c-f6b8-a89b-2c1ff65dedf5@ramsayjones.plus.com> Signed-off-by: Ramsay Jones --- git-compat-util.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index 9bc15b036..cedad4d58 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -898,9 +898,11 @@ static inline char *xstrdup_or_null(const char *str) static inline size_t xsize_t(off_t len) { - if (len > (size_t) len) + size_t size = (size_t) len; + + if (len != (off_t) size) die("Cannot handle files this big"); - return (size_t)len; + return size; } __attribute__((format (printf, 3, 4))) -- 2.14.0