Nguyễn Thái Ngọc Duy  <pclo...@gmail.com> writes:

> This field, filled by sha1_object_info() contains the on-disk size of
> an object, which could go over 4GB limit of unsigned long on 32-bit
> systems. Use off_t for it instead and update all callers.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
> ---
>  builtin/cat-file.c | 4 ++--
>  cache.h            | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/cat-file.c b/builtin/cat-file.c
> index 618103f..5b34bd0 100644
> --- a/builtin/cat-file.c
> +++ b/builtin/cat-file.c
> @@ -131,7 +131,7 @@ struct expand_data {
>       unsigned char sha1[20];
>       enum object_type type;
>       unsigned long size;
> -     unsigned long disk_size;
> +     off_t disk_size;
>       const char *rest;
>       unsigned char delta_base_sha1[20];
>  
> @@ -191,7 +191,7 @@ static void expand_atom(struct strbuf *sb, const char 
> *atom, int len,
>               if (data->mark_query)
>                       data->info.disk_sizep = &data->disk_size;
>               else
> -                     strbuf_addf(sb, "%lu", data->disk_size);
> +                     strbuf_addf(sb, "%"PRIuMAX, data->disk_size);

Doesn't this now need a cast?

>       } else if (is_atom("rest", atom, len)) {
>               if (data->mark_query)
>                       data->split_on_whitespace = 1;
> diff --git a/cache.h b/cache.h
> index c73becb..a4465cb 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -1508,7 +1508,7 @@ struct object_info {
>       /* Request */
>       enum object_type *typep;
>       unsigned long *sizep;
> -     unsigned long *disk_sizep;
> +     off_t *disk_sizep;
>       unsigned char *delta_base_sha1;
>       struct strbuf *typename;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to