Web lists-archives.com

Re: [PATCH 2/9] Convert index-pack to size_t





On 12/08/17 09:47, Martin Koegler wrote:
> From: Martin Koegler <martin.koegler@xxxxxxxxx>
> 
> Signed-off-by: Martin Koegler <martin.koegler@xxxxxxxxx>
> ---
>  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;

Similar comment to previous patch.

ATB,
Ramsay Jones