Skip to content

Commit 73560c7

Browse files
ramsay-jonesgitster
authored andcommitted
git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings
Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 94c9fd2 commit 73560c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

git-compat-util.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,9 +900,11 @@ static inline char *xstrdup_or_null(const char *str)
900900

901901
static inline size_t xsize_t(off_t len)
902902
{
903-
if (len > (size_t) len)
903+
size_t size = (size_t) len;
904+
905+
if (len != (off_t) size)
904906
die("Cannot handle files this big");
905-
return (size_t)len;
907+
return size;
906908
}
907909

908910
__attribute__((format (printf, 3, 4)))

0 commit comments

Comments
 (0)