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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> 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 <peff@xxxxxxxx>
> ---

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".
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]