From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] index-pack: fix truncation of off_t in comparison
Date: Thu, 04 Jun 2015 10:28:12 -0700 [thread overview]
Message-ID: <xmqqlhfzv0wj.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150604123541.GA8888@peff.net> (Jeff King's message of "Thu, 4 Jun 2015 08:35:42 -0400")
Jeff King <peff@peff.net> writes:
> On top of nd/slim-index-pack-memory-usage, which introduced the bug (but
> it is already in master).
Thanks.
In this round, I decided to deliberately merge more iffy and larger
topics to 'master' in early part of the cycle, and it seems to be
paying off nicely ;-).
Will queue.
> builtin/index-pack.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/index-pack.c b/builtin/index-pack.c
> index 3ed53e3..06dd973 100644
> --- a/builtin/index-pack.c
> +++ b/builtin/index-pack.c
> @@ -616,7 +616,9 @@ static int compare_ofs_delta_bases(off_t offset1, off_t offset2,
> int cmp = type1 - type2;
> if (cmp)
> return cmp;
> - return offset1 - offset2;
> + return offset1 < offset2 ? -1 :
> + offset1 > offset2 ? 1 :
> + 0;
> }
>
> static int find_ofs_delta(const off_t offset, enum object_type type)
> @@ -1051,7 +1053,9 @@ static int compare_ofs_delta_entry(const void *a, const void *b)
> const struct ofs_delta_entry *delta_a = a;
> const struct ofs_delta_entry *delta_b = b;
>
> - return delta_a->offset - delta_b->offset;
> + return delta_a->offset < delta_b->offset ? -1 :
> + delta_a->offset > delta_b->offset ? 1 :
> + 0;
> }
>
> static int compare_ref_delta_entry(const void *a, const void *b)
prev parent reply other threads:[~2015-06-04 17:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 12:35 [PATCH] index-pack: fix truncation of off_t in comparison Jeff King
2015-06-04 13:10 ` Duy Nguyen
2015-06-04 17:28 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqlhfzv0wj.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox