git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Sep 21, 2017 at 17:46 UTC 73560c793a08b389cc8ad5930db2cebb858affcb
1 file changed +4 -2
git-compat-util.h
+4 -2
@@ -900,9 +900,11 @@ static inline char *xstrdup_or_null(const char *str)
900
901 static inline size_t xsize_t(off_t len)
902 {
903 - if (len > (size_t) len)
903 + size_t size = (size_t) len;
904 +
905 + if (len != (off_t) size)
906 die("Cannot handle files this big");
905 - return (size_t)len;
907 + return size;
908 }
909
910 __attribute__((format (printf, 3, 4)))