Fossil SCM

Fix the longestCommonSequence() routine so that it works even with very large negative scores that can result from files with hundreds of thousands of lines of text. [forum/forumpost/27e77558ad21ffed|forum thread 27e77558ad21ffed].

drh 2024-10-31 23:09 trunk
Commit f214aba4f5c4846de0e15cc81f70e574babc040c36389a5e95711cb875045bf3
1 file changed +1 -1
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -2462,11 +2462,11 @@
24622462
int span; /* combined width of the input sequences */
24632463
int cutoff = 4; /* Max hash chain entries to follow */
24642464
int nextCutoff = -1; /* Value of cutoff for next iteration */
24652465
24662466
span = (iE1 - iS1) + (iE2 - iS2);
2467
- bestScore = -10000;
2467
+ bestScore = -9223300000*(sqlite3_int64)1000000000;
24682468
score = 0;
24692469
iSXb = iSXp = iS1;
24702470
iEXb = iEXp = iS1;
24712471
iSYb = iSYp = iS2;
24722472
iEYb = iEYp = iS2;
24732473
--- src/diff.c
+++ src/diff.c
@@ -2462,11 +2462,11 @@
2462 int span; /* combined width of the input sequences */
2463 int cutoff = 4; /* Max hash chain entries to follow */
2464 int nextCutoff = -1; /* Value of cutoff for next iteration */
2465
2466 span = (iE1 - iS1) + (iE2 - iS2);
2467 bestScore = -10000;
2468 score = 0;
2469 iSXb = iSXp = iS1;
2470 iEXb = iEXp = iS1;
2471 iSYb = iSYp = iS2;
2472 iEYb = iEYp = iS2;
2473
--- src/diff.c
+++ src/diff.c
@@ -2462,11 +2462,11 @@
2462 int span; /* combined width of the input sequences */
2463 int cutoff = 4; /* Max hash chain entries to follow */
2464 int nextCutoff = -1; /* Value of cutoff for next iteration */
2465
2466 span = (iE1 - iS1) + (iE2 - iS2);
2467 bestScore = -9223300000*(sqlite3_int64)1000000000;
2468 score = 0;
2469 iSXb = iSXp = iS1;
2470 iEXb = iEXp = iS1;
2471 iSYb = iSYp = iS2;
2472 iEYb = iEYp = iS2;
2473

Keyboard Shortcuts

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