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.

drh 2016-10-04 02:02 trunk
Commit 47d1256cd8fee0cdb11eb374a2b2437a8bf2588a
1 file changed +5 -2
+5 -2
--- src/diff.c
+++ src/diff.c
@@ -146,12 +146,15 @@
146146
147147
/* Count the number of lines in the input file. Include the last line
148148
** in the count even if it lacks the \n terminator
149149
*/
150150
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
+ }
153156
154157
a = fossil_malloc( sizeof(a[0])*nLine );
155158
memset(a, 0, sizeof(a[0])*nLine);
156159
if( nLine==0 ){
157160
*pnLine = 0;
158161
--- 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

Keyboard Shortcuts

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