summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-05-18 14:05:00 -0600
committerKarl Williamson <public@khwilliamson.com>2013-05-20 11:01:53 -0600
commitb2bf251fd850e281217ec1d042c1839e3ed4a09c (patch)
tree80f066a5e9860cf78bcb86af932169d1a60ab6e0 /handy.h
parentcfe934daf72e37a0980ac3183d678e49a26726b3 (diff)
downloadperl-b2bf251fd850e281217ec1d042c1839e3ed4a09c.tar.gz
handy.h: Change the error return of two macros
These two undocumented macros returned the REPLACEMENT CHARACTER if the input was outside the Latin1 range. This was contrary to all other similar macros, which return their input if it is invalid. It caused warnings in some (dumber than average) compilers. These macros are undocumented; this changes the behavior only of illegal inputs to them.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/handy.h b/handy.h
index d12f572eed..10154792b5 100644
--- a/handy.h
+++ b/handy.h
@@ -1168,19 +1168,19 @@ EXTCONST U32 PL_charclass[];
/* Use table lookup for speed; return error character for input
* out-of-range */
-#define toLOWER_LATIN1(c) (FITS_IN_8_BITS(c) \
- ? UNI_TO_NATIVE(PL_latin1_lc[ \
- NATIVE_TO_UNI( (U8) (c)) ]) \
- : UNICODE_REPLACEMENT)
+#define toLOWER_LATIN1(c) ((! FITS_IN_8_BITS(c)) \
+ ? (c) \
+ : UNI_TO_NATIVE(PL_latin1_lc[ \
+ NATIVE_TO_UNI( (U8) (c)) ]))
#define toLOWER_L1(c) toLOWER_LATIN1(c) /* Synonym for consistency */
/* Modified uc. Is correct uc except for three non-ascii chars which are
* all mapped to one of them, and these need special handling; error
* character for input out-of-range */
-#define toUPPER_LATIN1_MOD(c) (FITS_IN_8_BITS(c) \
- ? UNI_TO_NATIVE(PL_mod_latin1_uc[ \
- NATIVE_TO_UNI( (U8) (c)) ]) \
- : UNICODE_REPLACEMENT)
+#define toUPPER_LATIN1_MOD(c) ((! FITS_IN_8_BITS(c)) \
+ ? (c) \
+ : UNI_TO_NATIVE(PL_mod_latin1_uc[ \
+ NATIVE_TO_UNI( (U8) (c)) ]))
#ifdef USE_NEXT_CTYPE