Fossil SCM
Oops, make it work correct now.
Commit
7dabede3b38835601315188dd2cd2d530200f38f
Parent
011d5f692d3dc55…
1 file changed
+3
-3
+3
-3
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -517,11 +517,11 @@ | ||
| 517 | 517 | * Windows XP and earlier cannot handle them. |
| 518 | 518 | */ |
| 519 | 519 | return 0; |
| 520 | 520 | } |
| 521 | 521 | /* This is a 3-byte UTF-8 character */ |
| 522 | - unicode = ((c&0x0f)<<12) + ((c&0x3f)<<6) + (c&0x3f); | |
| 522 | + unicode = ((c&0x0f)<<12) + ((z[i+1]&0x3f)<<6) + (z[i+2]&0x3f); | |
| 523 | 523 | if( unicode <= 0x07ff ){ |
| 524 | 524 | /* overlong form */ |
| 525 | 525 | return 0; |
| 526 | 526 | }else if( unicode>=0xe000 ){ |
| 527 | 527 | /* U+E000..U+FFFF */ |
| @@ -537,17 +537,17 @@ | ||
| 537 | 537 | /* U+D800..U+DFFF are for surrogate pairs. */ |
| 538 | 538 | return 0; |
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | do{ |
| 542 | - if( (z[1]&0xc0)!=0x80 ){ | |
| 542 | + if( (z[i+1]&0xc0)!=0x80 ){ | |
| 543 | 543 | /* Invalid continuation byte (multi-byte UTF-8) */ |
| 544 | 544 | return 0; |
| 545 | 545 | } |
| 546 | 546 | /* The hi-bits of c are used to keep track of the number of expected |
| 547 | 547 | * continuation-bytes, so we don't need a separate counter. */ |
| 548 | - c<<=1; ++z; | |
| 548 | + c<<=1; ++i; | |
| 549 | 549 | }while( c>=0xc0 ); |
| 550 | 550 | }else if( c=='\\' ){ |
| 551 | 551 | return 0; |
| 552 | 552 | } |
| 553 | 553 | if( c=='/' ){ |
| 554 | 554 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -517,11 +517,11 @@ | |
| 517 | * Windows XP and earlier cannot handle them. |
| 518 | */ |
| 519 | return 0; |
| 520 | } |
| 521 | /* This is a 3-byte UTF-8 character */ |
| 522 | unicode = ((c&0x0f)<<12) + ((c&0x3f)<<6) + (c&0x3f); |
| 523 | if( unicode <= 0x07ff ){ |
| 524 | /* overlong form */ |
| 525 | return 0; |
| 526 | }else if( unicode>=0xe000 ){ |
| 527 | /* U+E000..U+FFFF */ |
| @@ -537,17 +537,17 @@ | |
| 537 | /* U+D800..U+DFFF are for surrogate pairs. */ |
| 538 | return 0; |
| 539 | } |
| 540 | } |
| 541 | do{ |
| 542 | if( (z[1]&0xc0)!=0x80 ){ |
| 543 | /* Invalid continuation byte (multi-byte UTF-8) */ |
| 544 | return 0; |
| 545 | } |
| 546 | /* The hi-bits of c are used to keep track of the number of expected |
| 547 | * continuation-bytes, so we don't need a separate counter. */ |
| 548 | c<<=1; ++z; |
| 549 | }while( c>=0xc0 ); |
| 550 | }else if( c=='\\' ){ |
| 551 | return 0; |
| 552 | } |
| 553 | if( c=='/' ){ |
| 554 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -517,11 +517,11 @@ | |
| 517 | * Windows XP and earlier cannot handle them. |
| 518 | */ |
| 519 | return 0; |
| 520 | } |
| 521 | /* This is a 3-byte UTF-8 character */ |
| 522 | unicode = ((c&0x0f)<<12) + ((z[i+1]&0x3f)<<6) + (z[i+2]&0x3f); |
| 523 | if( unicode <= 0x07ff ){ |
| 524 | /* overlong form */ |
| 525 | return 0; |
| 526 | }else if( unicode>=0xe000 ){ |
| 527 | /* U+E000..U+FFFF */ |
| @@ -537,17 +537,17 @@ | |
| 537 | /* U+D800..U+DFFF are for surrogate pairs. */ |
| 538 | return 0; |
| 539 | } |
| 540 | } |
| 541 | do{ |
| 542 | if( (z[i+1]&0xc0)!=0x80 ){ |
| 543 | /* Invalid continuation byte (multi-byte UTF-8) */ |
| 544 | return 0; |
| 545 | } |
| 546 | /* The hi-bits of c are used to keep track of the number of expected |
| 547 | * continuation-bytes, so we don't need a separate counter. */ |
| 548 | c<<=1; ++i; |
| 549 | }while( c>=0xc0 ); |
| 550 | }else if( c=='\\' ){ |
| 551 | return 0; |
| 552 | } |
| 553 | if( c=='/' ){ |
| 554 |