Re: [PULL REQUEST] initial pack v4 support
- From
Nicolas Pitre <nico@fluxnic.net>
- Date
- Sep 10, 2013, 22:31 UTC
- Message-ID
- <alpine.LFD.2.03.1309101829330.20709@syhkavp.arg>
- In-Reply-To
- <xmqqtxhswexg.fsf@gitster.dls.corp.google.com>
On Tue, 10 Sep 2013, Junio C Hamano wrote:
Show 21 quoted lines
> > packv4-parse.c: allow tree entry copying from a canonical tree object
>
> This one needed a small fix-up to make it compile.
>
> I do not particularly like reusing that "size" variable, but it
> seemed to be dead at that point, so...
>
> packv4-parse.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/packv4-parse.c b/packv4-parse.c
> index f96acc1..3f95ed4 100644
> --- a/packv4-parse.c
> +++ b/packv4-parse.c
> @@ -365,13 +365,14 @@ static int copy_canonical_tree_entries(struct packed_git *p, off_t offset,
> update_tree_entry(&desc);
> end = desc.buffer;
>
> - if (end - from > *sizep) {
> + size = (const char *)end - (const char *)from;
> + if (size > *sizep) {BTW, a simpler fix might simply involve declaring those 2 variables as const char * up front which would remove the need for any cast.
Nicolas