Re: [Patch size_t V3 13/19] Convert index-pack to size_t
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Aug 16, 2017, 21:42 UTC
- Message-ID
- <743056f2-da7b-5fe1-f0d7-2ee040479c69@ramsayjones.plus.com>
- In-Reply-To
- <1502914591-26215-14-git-send-email-martin@mail.zuhause>
On 16/08/17 21:16, Martin Koegler wrote:
Show 53 quoted lines
> From: Martin Koegler <martin.koegler@chello.at>
>
> Signed-off-by: Martin Koegler <martin.koegler@chello.at>
> ---
> builtin/index-pack.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/builtin/index-pack.c b/builtin/index-pack.c
> index 7f3ccd0..bf2d728 100644
> --- a/builtin/index-pack.c
> +++ b/builtin/index-pack.c
> @@ -435,7 +435,7 @@ static int is_delta_type(enum object_type type)
> return (type == OBJ_REF_DELTA || type == OBJ_OFS_DELTA);
> }
>
> -static void *unpack_entry_data(off_t offset, unsigned long size,
> +static void *unpack_entry_data(off_t offset, size_t size,
> enum object_type type, unsigned char *sha1)
> {
> static char fixed_buf[8192];
> @@ -444,10 +444,10 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
> void *buf;
> git_SHA_CTX c;
> char hdr[32];
> - int hdrlen;
> + size_t hdrlen;
>
> if (!is_delta_type(type)) {
> - hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
> + hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %" PRIuMAX, typename(type), (uintmax_t)size) + 1;
> git_SHA1_Init(&c);
> git_SHA1_Update(&c, hdr, hdrlen);
> } else
> @@ -489,7 +489,7 @@ static void *unpack_raw_entry(struct object_entry *obj,
> unsigned char *sha1)
> {
> unsigned char *p;
> - unsigned long size, c;
> + size_t size, c;
> off_t base_offset;
> unsigned shift;
> void *data;
> @@ -551,11 +551,11 @@ static void *unpack_raw_entry(struct object_entry *obj,
> }
>
> static void *unpack_data(struct object_entry *obj,
> - int (*consume)(const unsigned char *, unsigned long, void *),
> + int (*consume)(const unsigned char *, size_t, void *),
> void *cb_data)
> {
> off_t from = obj[0].idx.offset + obj[0].hdr_size;
> - off_t len = obj[1].idx.offset - from;
> + size_t len = obj[1].idx.offset - from;off_t -> size_t.
ATB, Ramsay Jones