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.

jan.nijtmans 2013-01-15 10:15 trunk
Commit 886e1bb2a8ed8e134f105ea66c37bf69ec671978
1 file changed +6 -10
+6 -10
--- src/file.c
+++ src/file.c
@@ -513,27 +513,23 @@
513513
}
514514
if( (c & 0xf0) == 0xe0 ) {
515515
/* This is a 3-byte UTF-8 character */
516516
if ( (c & 0xfe) == 0xee ){
517517
/* 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
+ }
526523
}
527524
if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){
528525
/* Unicode character in the range U+D800 - U+DFFF are for
529526
* surrogate pairs, they shouldn't occur in filenames. */
530527
return 0;
531528
}
532529
}
533
- }
534
- if( c=='\\' ){
530
+ }else if( c=='\\' ){
535531
return 0;
536532
}
537533
if( c=='/' ){
538534
if( z[i+1]=='/' ) return 0;
539535
if( z[i+1]=='.' ){
540536
--- 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

Keyboard Shortcuts

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