Browse Source

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>
maint
Ramsay Jones 7 years ago committed by Junio C Hamano
parent
commit
73560c793a
  1. 6
      git-compat-util.h

6
git-compat-util.h

@ -900,9 +900,11 @@ static inline char *xstrdup_or_null(const char *str) @@ -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)))

Loading…
Cancel
Save