Fossil SCM

Looping over too many triples also seems theoretically possible in contextDiff().

preben 2023-11-14 19:11 long-diff-fix
Commit 8ba47b1cc96062b76dc9970c3390b2ef2f89dcd9dff48d537bedb7b2923e0167
1 file changed +1 -1
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -422,11 +422,11 @@
422422
R = p->aEdit;
423423
mxr = p->nEdit;
424424
while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }
425425
for(r=0; r<mxr; r += 3*nr){
426426
/* Figure out how many triples to show in a single block */
427
- for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<nContext*2; nr++){}
427
+ for(nr=1; 3*nr<mxr && R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){}
428428
/* printf("r=%d nr=%d\n", r, nr); */
429429
430430
/* For the current block comprising nr triples, figure out
431431
** how many lines of A and B are to be displayed
432432
*/
433433
--- src/diff.c
+++ src/diff.c
@@ -422,11 +422,11 @@
422 R = p->aEdit;
423 mxr = p->nEdit;
424 while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }
425 for(r=0; r<mxr; r += 3*nr){
426 /* Figure out how many triples to show in a single block */
427 for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<nContext*2; nr++){}
428 /* printf("r=%d nr=%d\n", r, nr); */
429
430 /* For the current block comprising nr triples, figure out
431 ** how many lines of A and B are to be displayed
432 */
433
--- src/diff.c
+++ src/diff.c
@@ -422,11 +422,11 @@
422 R = p->aEdit;
423 mxr = p->nEdit;
424 while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }
425 for(r=0; r<mxr; r += 3*nr){
426 /* Figure out how many triples to show in a single block */
427 for(nr=1; 3*nr<mxr && R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){}
428 /* printf("r=%d nr=%d\n", r, nr); */
429
430 /* For the current block comprising nr triples, figure out
431 ** how many lines of A and B are to be displayed
432 */
433

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button