In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/75763b3aeee4912655f280922a10857e88d74104?hp=75697d6e4ef98ece405210de48e7529d01b619bf>

- Log -----------------------------------------------------------------
commit 75763b3aeee4912655f280922a10857e88d74104
Author: Karl Williamson <[email protected]>
Date:   Sun Dec 14 10:39:14 2014 -0700

    handy.h Cast to unsigned before doing xor
    
    It occurred to me that these macros could have an xor applied to a
    signed value if the argument is signed, whereas the xor is expecting
    unsigned.
-----------------------------------------------------------------------

Summary of changes:
 handy.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/handy.h b/handy.h
index f2bd6a8..1256ea1 100644
--- a/handy.h
+++ b/handy.h
@@ -1719,16 +1719,16 @@ EXTCONST U32 PL_charclass[];
  * The conversion works both ways, so toCTRL('D') is 4, and toCTRL(4) is D,
  * etc. */
 #ifndef EBCDIC
-#  define toCTRL(c)    (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(c) ^ 64)
+#  define toCTRL(c)    (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(((U8)(c))) ^ 64)
 #else
-#  define toCTRL(c)   (__ASSERT_(FITS_IN_8_BITS(c))              \
-                      ((isPRINT_A(c))                            \
-                       ? (UNLIKELY((c) == '?')                   \
-                         ? QUESTION_MARK_CTRL                    \
-                         : (NATIVE_TO_LATIN1(toUPPER(c)) ^ 64))  \
-                       : (UNLIKELY((c) == QUESTION_MARK_CTRL)    \
-                         ? '?'                                   \
-                         : (LATIN1_TO_NATIVE((c) ^ 64)))))
+#  define toCTRL(c)   (__ASSERT_(FITS_IN_8_BITS(c))                     \
+                      ((isPRINT_A(c))                                   \
+                       ? (UNLIKELY((c) == '?')                          \
+                         ? QUESTION_MARK_CTRL                           \
+                         : (NATIVE_TO_LATIN1(toUPPER((U8) (c))) ^ 64))  \
+                       : (UNLIKELY((c) == QUESTION_MARK_CTRL)           \
+                         ? '?'                                          \
+                         : (LATIN1_TO_NATIVE(((U8) (c)) ^ 64)))))
 #endif
 
 /* Line numbers are unsigned, 32 bits. */

--
Perl5 Master Repository

Reply via email to