Fossil SCM
Eliminate "continue" statement, makes control flow easier to understand. If we already know a character is non-ASCII, don't need to check for '\\' any more.
Commit
886e1bb2a8ed8e134f105ea66c37bf69ec671978
Parent
8554d3e6569c434…
1 file changed
+6
-10
+6
-10
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -513,27 +513,23 @@ | ||
| 513 | 513 | } |
| 514 | 514 | if( (c & 0xf0) == 0xe0 ) { |
| 515 | 515 | /* This is a 3-byte UTF-8 character */ |
| 516 | 516 | if ( (c & 0xfe) == 0xee ){ |
| 517 | 517 | /* Range U+E000 - U+FFFF (Starting with 0xee or 0xef in UTF-8 ) */ |
| 518 | - if ( (c & 1) && ((z[i+1] & 0xff) >= 0xa4) ){ | |
| 519 | - /* But exclude U+F900 - U+FFFF (0xef followed by byte >= 0xa4), | |
| 520 | - * which contain valid characters. */ | |
| 521 | - continue; | |
| 522 | - } | |
| 523 | - /* Unicode character in the range U+E000 - U+F8FF are for | |
| 524 | - * private use, they shouldn't occur in filenames. */ | |
| 525 | - return 0; | |
| 518 | + if ( !(c & 1) || ((z[i+1] & 0xff) < 0xa4) ){ | |
| 519 | + /* Unicode character in the range U+E000 - U+F8FF are for | |
| 520 | + * private use, they shouldn't occur in filenames. */ | |
| 521 | + return 0; | |
| 522 | + } | |
| 526 | 523 | } |
| 527 | 524 | if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){ |
| 528 | 525 | /* Unicode character in the range U+D800 - U+DFFF are for |
| 529 | 526 | * surrogate pairs, they shouldn't occur in filenames. */ |
| 530 | 527 | return 0; |
| 531 | 528 | } |
| 532 | 529 | } |
| 533 | - } | |
| 534 | - if( c=='\\' ){ | |
| 530 | + }else if( c=='\\' ){ | |
| 535 | 531 | return 0; |
| 536 | 532 | } |
| 537 | 533 | if( c=='/' ){ |
| 538 | 534 | if( z[i+1]=='/' ) return 0; |
| 539 | 535 | if( z[i+1]=='.' ){ |
| 540 | 536 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -513,27 +513,23 @@ | |
| 513 | } |
| 514 | if( (c & 0xf0) == 0xe0 ) { |
| 515 | /* This is a 3-byte UTF-8 character */ |
| 516 | if ( (c & 0xfe) == 0xee ){ |
| 517 | /* Range U+E000 - U+FFFF (Starting with 0xee or 0xef in UTF-8 ) */ |
| 518 | if ( (c & 1) && ((z[i+1] & 0xff) >= 0xa4) ){ |
| 519 | /* But exclude U+F900 - U+FFFF (0xef followed by byte >= 0xa4), |
| 520 | * which contain valid characters. */ |
| 521 | continue; |
| 522 | } |
| 523 | /* Unicode character in the range U+E000 - U+F8FF are for |
| 524 | * private use, they shouldn't occur in filenames. */ |
| 525 | return 0; |
| 526 | } |
| 527 | if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){ |
| 528 | /* Unicode character in the range U+D800 - U+DFFF are for |
| 529 | * surrogate pairs, they shouldn't occur in filenames. */ |
| 530 | return 0; |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | if( c=='\\' ){ |
| 535 | return 0; |
| 536 | } |
| 537 | if( c=='/' ){ |
| 538 | if( z[i+1]=='/' ) return 0; |
| 539 | if( z[i+1]=='.' ){ |
| 540 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -513,27 +513,23 @@ | |
| 513 | } |
| 514 | if( (c & 0xf0) == 0xe0 ) { |
| 515 | /* This is a 3-byte UTF-8 character */ |
| 516 | if ( (c & 0xfe) == 0xee ){ |
| 517 | /* Range U+E000 - U+FFFF (Starting with 0xee or 0xef in UTF-8 ) */ |
| 518 | if ( !(c & 1) || ((z[i+1] & 0xff) < 0xa4) ){ |
| 519 | /* Unicode character in the range U+E000 - U+F8FF are for |
| 520 | * private use, they shouldn't occur in filenames. */ |
| 521 | return 0; |
| 522 | } |
| 523 | } |
| 524 | if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){ |
| 525 | /* Unicode character in the range U+D800 - U+DFFF are for |
| 526 | * surrogate pairs, they shouldn't occur in filenames. */ |
| 527 | return 0; |
| 528 | } |
| 529 | } |
| 530 | }else if( c=='\\' ){ |
| 531 | return 0; |
| 532 | } |
| 533 | if( c=='/' ){ |
| 534 | if( z[i+1]=='/' ) return 0; |
| 535 | if( z[i+1]=='.' ){ |
| 536 |