Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-PPPort CPAN distribution.

Report information
The Basics
Id: 56749
Status: resolved
Priority: 0/
Queue: Devel-PPPort

People
Owner: Nobody in particular
Requestors: khw [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: isASCII and isCNTRL macros are buggy
In hacking the Perl core, I noticed bugs in isASCII and isCNTRL. If these macros are called with a signed char, as the documentation says, they fail for non-ASCII characters, returning true always for those. That means that isASCII always returns true when the parameter has type 'char'! The attached file fixes these by casting the parameter to U8 before testing if it is less than something. Note that if they are called with something like a U16 instead, they can still fail as the modulo is taken when casting.
Subject: misc.patch
diff --git a/home/khw/perl/blead/cpan/Devel-PPPort/parts/inc/misc b/cpan/Devel-PPPort/parts/inc/misc index 3844bbb..c262610 100644 --- a/home/khw/perl/blead/cpan/Devel-PPPort/parts/inc/misc +++ b/cpan/Devel-PPPort/parts/inc/misc @@ -275,8 +275,8 @@ __UNDEFINED__ isXDIGIT(c) isxdigit(c) # undef isPRINT # endif __UNDEFINED__ isALNUMC(c) (isALPHA(c) || isDIGIT(c)) -__UNDEFINED__ isASCII(c) ((c) <= 127) -__UNDEFINED__ isCNTRL(c) ((c) < ' ' || (c) == 127) +__UNDEFINED__ isASCII(c) ((U8) (c) <= 127) +__UNDEFINED__ isCNTRL(c) ((U8) (c) < ' ' || (c) == 127) __UNDEFINED__ isGRAPH(c) (isALNUM(c) || isPUNCT(c)) __UNDEFINED__ isPRINT(c) (((c) >= 32 && (c) < 127)) __UNDEFINED__ isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126))
Fixed (finally!) in 3.20.