Subject: Re: [PATCH] diff: use 64-bit integers for diffstat calculations

From: Junio C Hamano <[email-masked]>
Date: Sat, 17 Apr 2010 10:00:44 -0700

Jeff King <[email-masked]> writes:

> Yuck, we use "unsigned int" for the actual storage, and then convert to
> a regular "int" in some other places. I think we should just do this:
>
> -- >8 --
> Subject: [PATCH] diff: use 64-bit integers for diffstat calculations
>
> The diffstat "added" and "changed" fields generally store
> line counts; however, for binary files, they store file
> sizes. Since we store and print these values as ints, a
> diffstat on a file larger than 2G can show a negative size.
> Instead, let's explicitly use 64-bit integers.
>
> Signed-off-by: Jeff King <[email-masked]>
> ---

Yes, but we would probably be better off using using uintmax_t for things
like this if the quantity a variable represents is not closely tied to
external file format (e.g. the offset field of pack idx file), nor the
code is only for a particular platform (e.g. compat/win32mmap.c), don't
you think?

That is the impression I am getting on the discipline expressed in the
current codebase, from browsing the output from "git grep uint64_t".