Fossil SCM
The previous check-in was interpreting any file that did not end in \n as binary. This check-in should fix the problem.
Commit
47d1256cd8fee0cdb11eb374a2b2437a8bf2588a
Parent
334ab15270b814a…
1 file changed
+5
-2
+5
-2
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -146,12 +146,15 @@ | ||
| 146 | 146 | |
| 147 | 147 | /* Count the number of lines in the input file. Include the last line |
| 148 | 148 | ** in the count even if it lacks the \n terminator |
| 149 | 149 | */ |
| 150 | 150 | for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){} |
| 151 | - if( z2[0]!=0 ) nLine++; | |
| 152 | - if( n!=(int)(z2-z) ) return 0; | |
| 151 | + if( z2[0]!=0 ){ | |
| 152 | + nLine++; | |
| 153 | + do{ z2++; }while( z2[0] ); | |
| 154 | + if( n!=(int)(z2-z) ) return 0; | |
| 155 | + } | |
| 153 | 156 | |
| 154 | 157 | a = fossil_malloc( sizeof(a[0])*nLine ); |
| 155 | 158 | memset(a, 0, sizeof(a[0])*nLine); |
| 156 | 159 | if( nLine==0 ){ |
| 157 | 160 | *pnLine = 0; |
| 158 | 161 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -146,12 +146,15 @@ | |
| 146 | |
| 147 | /* Count the number of lines in the input file. Include the last line |
| 148 | ** in the count even if it lacks the \n terminator |
| 149 | */ |
| 150 | for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){} |
| 151 | if( z2[0]!=0 ) nLine++; |
| 152 | if( n!=(int)(z2-z) ) return 0; |
| 153 | |
| 154 | a = fossil_malloc( sizeof(a[0])*nLine ); |
| 155 | memset(a, 0, sizeof(a[0])*nLine); |
| 156 | if( nLine==0 ){ |
| 157 | *pnLine = 0; |
| 158 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -146,12 +146,15 @@ | |
| 146 | |
| 147 | /* Count the number of lines in the input file. Include the last line |
| 148 | ** in the count even if it lacks the \n terminator |
| 149 | */ |
| 150 | for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){} |
| 151 | if( z2[0]!=0 ){ |
| 152 | nLine++; |
| 153 | do{ z2++; }while( z2[0] ); |
| 154 | if( n!=(int)(z2-z) ) return 0; |
| 155 | } |
| 156 | |
| 157 | a = fossil_malloc( sizeof(a[0])*nLine ); |
| 158 | memset(a, 0, sizeof(a[0])*nLine); |
| 159 | if( nLine==0 ){ |
| 160 | *pnLine = 0; |
| 161 |