forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9beffdc
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 parentd7b5a31 commit9beffdc
1 file changed
+12
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | | - | |
449 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
450 | 454 | | |
451 | 455 | | |
452 | 456 | | |
| |||
475 | 479 | | |
476 | 480 | | |
477 | 481 | | |
478 | | - | |
| 482 | + | |
479 | 483 | | |
480 | 484 | | |
481 | | - | |
| 485 | + | |
482 | 486 | | |
483 | 487 | | |
484 | 488 | | |
| |||
507 | 511 | | |
508 | 512 | | |
509 | 513 | | |
510 | | - | |
| 514 | + | |
511 | 515 | | |
512 | 516 | | |
513 | | - | |
| 517 | + | |
514 | 518 | | |
515 | 519 | | |
516 | 520 | | |
| |||
0 commit comments
Comments
(0)