diff options
author | David Mitchell <davem@iabyn.com> | 2013-11-29 17:44:12 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-11-29 17:44:12 +0000 |
commit | 68067e4e501e2ae1c0fb44558b6aa5c0a80a4143 (patch) | |
tree | a2432a1db7ff1c94fccdf6ba0fbb10f043ea9481 /utf8.c | |
parent | 1534c6f5c3ecc70066a03d0b7df074bcd2e6f48c (diff) | |
download | perl-68067e4e501e2ae1c0fb44558b6aa5c0a80a4143.tar.gz |
fix -Wsign-compare in core
There were a few places that were doing
unsigned_var = cond ? signed_val : unsigned_val;
or similar. Fixed by suitable casts etc.
The four in utf8.c were fixed by assigning to an intermediate
unsigned var; this has the happy side-effect of collapsing
a large macro expansion, where toUPPER_LC() etc evaluate their arg
multiple times.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -2587,7 +2587,8 @@ Perl__to_utf8_upper_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags) { - result = toUPPER_LC(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1))); + UV c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toUPPER_LC(c); } else { return _to_upper_title_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), @@ -2653,7 +2654,8 @@ Perl__to_utf8_title_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags) { - result = toUPPER_LC(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1))); + UV c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toUPPER_LC(c); } else { return _to_upper_title_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), @@ -2717,7 +2719,8 @@ Perl__to_utf8_lower_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags) { - result = toLOWER_LC(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1))); + UV c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toLOWER_LC(c); } else { return to_lower_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), @@ -2795,7 +2798,8 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags, b } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags & FOLD_FLAGS_LOCALE) { - result = toFOLD_LC(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1))); + UV c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toFOLD_LC(c); } else { return _to_fold_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), |