# New Ticket Created by  Matt Kraai 
# Please include the string:  [perl #51752]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=51752 >


Howdy,

t/codingstd/check_isxxx.t fails because
languages/perl6/src/pmc/perl6str.pmc contains some references to isxxx
functions in comments that it thinks are missing a cast to an unsigned
char and some isxxx calls that do not first cast their argument to an
unsigned char.  The attached patch fixes both of these problems, the
first by requiring that is isxxx accept an argument, the second by
adding the casts.

-- 
Matt
diff --git a/languages/perl6/src/pmc/perl6str.pmc 
b/languages/perl6/src/pmc/perl6str.pmc
index 864e425..c60c2b4 100644
--- a/languages/perl6/src/pmc/perl6str.pmc
+++ b/languages/perl6/src/pmc/perl6str.pmc
@@ -189,9 +189,9 @@ C<isdigit()> respectively.
 
         /* find the portion of the string to increment */
         while (s < end) {
-            while (!isalnum(*s) && s < end) s++;
+            while (!isalnum((unsigned char)*s) && s < end) s++;
             e = s;
-            while (isalnum(*e) && e < end) e++;
+            while (isalnum((unsigned char)*e) && e < end) e++;
             if (!(e < end))  break;
             ps = s; pe = e; s = e;
         }
@@ -206,7 +206,7 @@ C<isdigit()> respectively.
 
         /* Actual increment */
         for (i = len-1, carry = 1; i >= 0 && carry; i--) {
-            if (isdigit(substr[i])) {
+            if (isdigit((unsigned char)substr[i])) {
                 if (++substr[i] <= '9') {
                     carry = 0;
                 }
@@ -216,7 +216,7 @@ C<isdigit()> respectively.
                 }
             }
             else {
-                if (isalpha(++substr[i])) {
+                if (isalpha((unsigned char)++substr[i])) {
                     carry = 0;
                 }
                 else {
@@ -231,7 +231,7 @@ C<isdigit()> respectively.
             INTVAL b = str->strlen - a;   /* length to end of string */
             STRING* rep = string_substr(INTERP, str, a, b, NULL, 0);
             INTVAL c = '1';
-            if (isalpha(start[a])) c = start[a];
+            if (isalpha((unsigned char)start[a])) c = start[a];
             string_replace(INTERP, str, a+1, b, rep, 0);
             string_replace(INTERP, str, a, 1, string_chr(INTERP, c), 0);
         }
@@ -255,9 +255,9 @@ C<isdigit()> respectively.
 
         /* Find the portion of the string to decrement */
         while (s < end) {
-            while (!isalnum(*s) && s < end) s++;
+            while (!isalnum((unsigned char)*s) && s < end) s++;
             e = s;
-            while (isalnum(*e) && e < end) e++;
+            while (isalnum((unsigned char)*e) && e < end) e++;
             if (!(e < end))  break;
             ps = s; pe = e; s = e;
         }
@@ -278,7 +278,7 @@ C<isdigit()> respectively.
 
         /* Actual decrement */
         for (i = len-1, steal = 1; i >= 0 && steal; i--) {
-            if (isdigit(substr[i])) {
+            if (isdigit((unsigned char)substr[i])) {
                 if (--substr[i] >= '0') {
                     steal = 0;
                 }
@@ -288,7 +288,7 @@ C<isdigit()> respectively.
                 }
             }
             else {
-                if (isalpha(--substr[i])) {
+                if (isalpha((unsigned char)--substr[i])) {
                     steal = 0;
                 }
                 else {
diff --git a/t/codingstd/check_isxxx.t b/t/codingstd/check_isxxx.t
index 8ae6fe1..993749f 100644
--- a/t/codingstd/check_isxxx.t
+++ b/t/codingstd/check_isxxx.t
@@ -64,7 +64,7 @@ foreach my $file (@files) {
     my $i            = 1;
 
     # get the lines just matching isxxx
-    my @isxxx_lines  = grep { $_->[0] =~ /[^_]($isxxx_functions)\(/ }
+    my @isxxx_lines  = grep { $_->[0] =~ /[^_]($isxxx_functions)\([^)]/ }
         map { [ $_, $i++ ] } @buffer_lines;
 
     next unless @isxxx_lines;

Reply via email to