1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 10:16:08 +02:00

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>
This commit is contained in:
Ramsay Jones 2017-09-21 17:46:24 +01:00 committed by Junio C Hamano
parent 94c9fd268d
commit 73560c793a

View File

@ -900,9 +900,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)))