aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-11-30 00:24:32 +0100
committerJunio C Hamano <junkio@cox.net>2006-12-02 17:28:19 -0800
commit875b8ce47650d712c8f464cfedb9147673fe3ff7 (patch)
treed4f1965a16877e8b175a2c18444f2f43ed83fc97
parentc2b4faea4522b28a7611ddab5eb6a5c221cc3ee5 (diff)
downloadgit-875b8ce47650d712c8f464cfedb9147673fe3ff7.tar.gz
git-875b8ce47650d712c8f464cfedb9147673fe3ff7.tar.xz
xdl_merge(): fix an off-by-one bug
The line range is i1 .. (i1 + chg1 - 1), not i1 .. (i1 + chg1). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--xdiff/xmerge.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 286f177b5..3f5dc87fd 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -194,11 +194,11 @@ static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m,
* we have a very simple mmfile structure.
*/
t1.ptr = (char *)xe1->xdf2.recs[m->i1]->ptr;
- t1.size = xe1->xdf2.recs[m->i1 + m->chg1]->ptr
- + xe1->xdf2.recs[m->i1 + m->chg1]->size - t1.ptr;
- t2.ptr = (char *)xe2->xdf2.recs[m->i1]->ptr;
- t2.size = xe2->xdf2.recs[m->i1 + m->chg1]->ptr
- + xe2->xdf2.recs[m->i1 + m->chg1]->size - t2.ptr;
+ t1.size = xe1->xdf2.recs[m->i1 + m->chg1 - 1]->ptr
+ + xe1->xdf2.recs[m->i1 + m->chg1 - 1]->size - t1.ptr;
+ t2.ptr = (char *)xe2->xdf2.recs[m->i2]->ptr;
+ t2.size = xe2->xdf2.recs[m->i2 + m->chg2 - 1]->ptr
+ + xe2->xdf2.recs[m->i2 + m->chg2 - 1]->size - t2.ptr;
if (xdl_do_diff(&t1, &t2, xpp, &xe) < 0)
return -1;
if (xdl_change_compact(&xe.xdf1, &xe.xdf2, xpp->flags) < 0 ||