Fossil SCM
minor cut/paste error
Commit
b163569a8c6143c490e959d0929b4ea298a0b91f
Parent
3a74f9fe52c3a6b…
1 file changed
+2
-4
+2
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -225,14 +225,12 @@ | ||
| 225 | 225 | |
| 226 | 226 | /* Check individual lines. |
| 227 | 227 | */ |
| 228 | 228 | if( n==0 ) return 1; /* Empty file -> text */ |
| 229 | 229 | c = *z; |
| 230 | + if( c==0 ) return 0; /* Zero byte in a file -> binary */ | |
| 230 | 231 | j = (c!='\n'); |
| 231 | - if( c==0 ){ | |
| 232 | - return 0; /* Zero byte in a file -> binary */ | |
| 233 | - } | |
| 234 | 232 | while( --n>0 ){ |
| 235 | 233 | c = *++z; ++j; |
| 236 | 234 | if( c==0 ) return 0; /* Zero byte in a file -> binary */ |
| 237 | 235 | if( c=='\n' ){ |
| 238 | 236 | if( z[-1]=='\r' ){ |
| @@ -337,11 +335,11 @@ | ||
| 337 | 335 | flags |= 1; /* Very long line, continue */ |
| 338 | 336 | } |
| 339 | 337 | j = 0; |
| 340 | 338 | } |
| 341 | 339 | } |
| 342 | - if( (flags&1) || (j>LENGTH_MASK) ){ | |
| 340 | + if( (flags&1) || (j>UTF16_LENGTH_MASK) ){ | |
| 343 | 341 | return -4; /* Very long line -> binary */ |
| 344 | 342 | } |
| 345 | 343 | return 1-flags; /* No problems seen -> not binary */ |
| 346 | 344 | } |
| 347 | 345 | |
| 348 | 346 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -225,14 +225,12 @@ | |
| 225 | |
| 226 | /* Check individual lines. |
| 227 | */ |
| 228 | if( n==0 ) return 1; /* Empty file -> text */ |
| 229 | c = *z; |
| 230 | j = (c!='\n'); |
| 231 | if( c==0 ){ |
| 232 | return 0; /* Zero byte in a file -> binary */ |
| 233 | } |
| 234 | while( --n>0 ){ |
| 235 | c = *++z; ++j; |
| 236 | if( c==0 ) return 0; /* Zero byte in a file -> binary */ |
| 237 | if( c=='\n' ){ |
| 238 | if( z[-1]=='\r' ){ |
| @@ -337,11 +335,11 @@ | |
| 337 | flags |= 1; /* Very long line, continue */ |
| 338 | } |
| 339 | j = 0; |
| 340 | } |
| 341 | } |
| 342 | if( (flags&1) || (j>LENGTH_MASK) ){ |
| 343 | return -4; /* Very long line -> binary */ |
| 344 | } |
| 345 | return 1-flags; /* No problems seen -> not binary */ |
| 346 | } |
| 347 | |
| 348 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -225,14 +225,12 @@ | |
| 225 | |
| 226 | /* Check individual lines. |
| 227 | */ |
| 228 | if( n==0 ) return 1; /* Empty file -> text */ |
| 229 | c = *z; |
| 230 | if( c==0 ) return 0; /* Zero byte in a file -> binary */ |
| 231 | j = (c!='\n'); |
| 232 | while( --n>0 ){ |
| 233 | c = *++z; ++j; |
| 234 | if( c==0 ) return 0; /* Zero byte in a file -> binary */ |
| 235 | if( c=='\n' ){ |
| 236 | if( z[-1]=='\r' ){ |
| @@ -337,11 +335,11 @@ | |
| 335 | flags |= 1; /* Very long line, continue */ |
| 336 | } |
| 337 | j = 0; |
| 338 | } |
| 339 | } |
| 340 | if( (flags&1) || (j>UTF16_LENGTH_MASK) ){ |
| 341 | return -4; /* Very long line -> binary */ |
| 342 | } |
| 343 | return 1-flags; /* No problems seen -> not binary */ |
| 344 | } |
| 345 | |
| 346 |