511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
|
*/
return 0;
}
if( (c & 0xf0) == 0xe0 ) {
/* This is a 3-byte UTF-8 character */
if ( (c & 0xfe) == 0xee ){
/* Range U+E000 - U+FFFF (Starting with 0xee or 0xef in UTF-8 ) */
if ( (c & 1) && ((z[i+1] & 0xff) >= 0xa4) ){
/* But exclude U+F900 - U+FFFF (0xef followed by byte >= 0xa4),
* which contain valid characters. */
continue;
}
/* Unicode character in the range U+E000 - U+F8FF are for
* private use, they shouldn't occur in filenames. */
return 0;
}
if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){
/* Unicode character in the range U+D800 - U+DFFF are for
* surrogate pairs, they shouldn't occur in filenames. */
return 0;
}
}
}
if( c=='\\' ){
return 0;
}
if( c=='/' ){
if( z[i+1]=='/' ) return 0;
if( z[i+1]=='.' ){
if( z[i+2]=='/' || z[i+2]==0 ) return 0;
if( z[i+2]=='.' && (z[i+3]=='/' || z[i+3]==0) ) return 0;
|
|
<
<
<
<
|
|
|
>
<
|
|
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
|
*/
return 0;
}
if( (c & 0xf0) == 0xe0 ) {
/* This is a 3-byte UTF-8 character */
if ( (c & 0xfe) == 0xee ){
/* Range U+E000 - U+FFFF (Starting with 0xee or 0xef in UTF-8 ) */
if ( !(c & 1) || ((z[i+1] & 0xff) < 0xa4) ){
/* Unicode character in the range U+E000 - U+F8FF are for
* private use, they shouldn't occur in filenames. */
return 0;
}
}
if( ((c & 0xff) == 0xed) && ((z[i+1] & 0xe0) == 0xa0) ){
/* Unicode character in the range U+D800 - U+DFFF are for
* surrogate pairs, they shouldn't occur in filenames. */
return 0;
}
}
}else if( c=='\\' ){
return 0;
}
if( c=='/' ){
if( z[i+1]=='/' ) return 0;
if( z[i+1]=='.' ){
if( z[i+2]=='/' || z[i+2]==0 ) return 0;
if( z[i+2]=='.' && (z[i+3]=='/' || z[i+3]==0) ) return 0;
|