summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-12-23 19:04:30 -0700
committerKarl Williamson <public@khwilliamson.com>2012-12-23 19:39:05 -0700
commit0404c92ac7141fbf9f7d1acd7509f4b2e229cc9b (patch)
tree250879fe8769102268aa732a40ee0e52fb5f3a9c /utf8.h
parent559c7f10ed871fab06296b9297b9273240599eee (diff)
downloadperl-0404c92ac7141fbf9f7d1acd7509f4b2e229cc9b.tar.gz
utf8.h: Make sure char* is cast to U8* for unsigned comparison
If a char* is passed prior to this commit, an above-ASCII char could have been considered negative instead of positive, and thus screwed up these tests
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/utf8.h b/utf8.h
index 5aac9043f6..5be352e590 100644
--- a/utf8.h
+++ b/utf8.h
@@ -375,11 +375,12 @@ Perl's extended UTF-8 means we can have start bytes up to FF.
* U+110001: \xF4\x90\x80\x81 \xF9\xA2\xA0\xA0\xA1
*/
#ifdef EBCDIC /* Both versions assume well-formed UTF8 */
-# define UTF8_IS_SUPER(s) (NATIVE_TO_I8(*(s)) >= 0xF9 \
- && (NATIVE_TO_I8(*(s)) > 0xF9) || (NATIVE_TO_I8(*((s)) + 1 >= 0xA2)))
+# define UTF8_IS_SUPER(s) (NATIVE_TO_I8(* (U8*) (s)) >= 0xF9 \
+ && (NATIVE_TO_I8(* (U8*) (s)) > 0xF9 \
+ || (NATIVE_TO_I8(* (U8*) ((s)) + 1 >= 0xA2))))
#else
-# define UTF8_IS_SUPER(s) (*(s) >= 0xF4 \
- && (*(s) > 0xF4 || (*((s) + 1) >= 0x90)))
+# define UTF8_IS_SUPER(s) (*(U8*) (s) >= 0xF4 \
+ && (*(U8*) (s) > 0xF4 || (*((U8*) (s) + 1) >= 0x90)))
#endif
/* These are now machine generated, and the 'given' clause is no longer