This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toLOWER_LC(), toUPPER_LC(): fix signedness
authorDavid Mitchell <davem@iabyn.com>
Thu, 21 Nov 2013 17:10:04 +0000 (17:10 +0000)
committerDavid Mitchell <davem@iabyn.com>
Thu, 21 Nov 2013 17:12:42 +0000 (17:12 +0000)
The are documented to return UV, but in one definition they return
tolower()/toupper(), which on Linux return a signed value. So
cast away the compiler warnings.

handy.h

diff --git a/handy.h b/handy.h
index 78e5284..e7e8ca3 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -1278,8 +1278,8 @@ EXTCONST U32 PL_charclass[];
 #    define isWORDCHAR_LC(c) (FITS_IN_8_BITS(c)                                \
                             && (isalnum((unsigned char)(c)) || (char)(c) == '_'))
 #    define isXDIGIT_LC(c)   (FITS_IN_8_BITS(c) && isxdigit((unsigned char)(c)))
-#    define toLOWER_LC(c) (FITS_IN_8_BITS(c) ? tolower((unsigned char)(c)) : (c))
-#    define toUPPER_LC(c) (FITS_IN_8_BITS(c) ? toupper((unsigned char)(c)) : (c))
+#    define toLOWER_LC(c) (FITS_IN_8_BITS(c) ? (UV)tolower((unsigned char)(c)) : (c))
+#    define toUPPER_LC(c) (FITS_IN_8_BITS(c) ? (UV)toupper((unsigned char)(c)) : (c))
 
 #  else