Re: [PATCH v2 1/1] zlib.c: use size_t for size
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Oct 12, 2018, 22:22 UTC
- Message-ID
- <20181012222234.GF19800@szeder.dev>
- In-Reply-To
- <20181012204229.11890-1-tboegi@web.de>
On Fri, Oct 12, 2018 at 10:42:29PM +0200, tboegi@web.de wrote:
Show 12 quoted lines
> From: Martin Koegler <martin.koegler@chello.at> > > Signed-off-by: Martin Koegler <martin.koegler@chello.at> > Signed-off-by: Junio C Hamano <gitster@pobox.com> > Signed-off-by: Torsten Bögershausen <tboegi@web.de> > --- > > After doing a review, I decided to send the result as a patch. > In general, the changes from off_t to size_t seem to be not really > motivated. > But if they are, they could and should go into an own patch. > For the moment, change only "unsigned long" into size_t, thats all
Neither v1 nor v2 of this patch compiles on 32 bit Linux; see
https://travis-ci.org/git/git/jobs/440514375#L628
The fixup patch below makes it compile on 32 bit and the test suite passes as well, but I didn't thoroughly review the changes; I only wanted to get 'pu' build again.
-- >8 --
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 23c4cd8c77..89fe1c5d46 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1966,7 +1966,8 @@ unsigned long oe_get_size_slow(struct packing_data *pack, struct pack_window *w_curs; unsigned char *buf; enum object_type type; - unsigned long used, avail, size; + unsigned long used, size; + size_t avail; if (e->type_ != OBJ_OFS_DELTA && e->type_ != OBJ_REF_DELTA) { read_lock(); diff --git a/packfile.c b/packfile.c index 841b36182f..9f50411ad3 100644 --- a/packfile.c +++ b/packfile.c @@ -579,7 +579,7 @@ static int in_window(struct pack_window *win, off_t offset) unsigned char *use_pack(struct packed_git *p, struct pack_window **w_cursor, off_t offset, - unsigned long *left) + size_t *left) { struct pack_window *win = *w_cursor; @@ -1098,7 +1098,7 @@ int unpack_object_header(struct packed_git *p, unsigned long *sizep) { unsigned char *base; - unsigned long left; + size_t left; unsigned long used; enum object_type type;