forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3c7b4ef
committed
Fix some wide-character bugs in the text-search parser.
In p_isdigit and other character class test functions generated by thep_iswhat macro, the code path for non-C locales with multibyte encodingscontained a bogus pointer cast that would accidentally fail to malfunctionif types wchar_t and wint_t have the same width. Apparently that is trueon most platforms, but not on recent Cygwin releases. Remove the cast,as it seems completely unnecessary (I think it arose from a false analogyto the need to cast to unsigned char when dealing with the <ctype.h>functions). Per bug #8970 from Marco Atzeri.In the same functions, the code path for C locale with a multibyte encodingsimply ANDed each wide character with 0xFF before passing it to thecorresponding <ctype.h> function. This could result in false positiveanswers for some non-ASCII characters, so use a range test instead.Noted by me while investigating Marco's complaint.Also, remove some useless though not actually buggy maskings and castsin the hand-coded p_isalnum and p_isalpha functions, which evidentlygot tested a bit more carefully than the macro-generated functions.1 parentcfebd60 commit3c7b4ef
1 file changed
+12
-8
lines changedLines changed: 12 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
426 | 426 |
| |
427 | 427 |
| |
428 | 428 |
| |
429 |
| - | |
| 429 | + | |
430 | 430 |
| |
431 | 431 |
| |
432 | 432 |
| |
| |||
438 | 438 |
| |
439 | 439 |
| |
440 | 440 |
| |
441 |
| - | |
442 |
| - | |
443 |
| - | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
444 | 448 |
| |
445 | 449 |
| |
446 | 450 |
| |
| |||
469 | 473 |
| |
470 | 474 |
| |
471 | 475 |
| |
472 |
| - | |
| 476 | + | |
473 | 477 |
| |
474 | 478 |
| |
475 |
| - | |
| 479 | + | |
476 | 480 |
| |
477 | 481 |
| |
478 | 482 |
| |
| |||
501 | 505 |
| |
502 | 506 |
| |
503 | 507 |
| |
504 |
| - | |
| 508 | + | |
505 | 509 |
| |
506 | 510 |
| |
507 |
| - | |
| 511 | + | |
508 | 512 |
| |
509 | 513 |
| |
510 | 514 |
| |
|
0 commit comments
Comments
(0)