summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regexec.c4
-rw-r--r--toke.c2
-rw-r--r--utf8.c6
-rw-r--r--utf8.h20
-rw-r--r--utfebcdic.h4
5 files changed, 18 insertions, 18 deletions
diff --git a/regexec.c b/regexec.c
index a21e71a2cb..dbc0156fe5 100644
--- a/regexec.c
+++ b/regexec.c
@@ -5810,8 +5810,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
}
else if (UTF8_IS_DOWNGRADEABLE_START(nextchr)) {
if (! (to_complement ^ cBOOL(isFOO_lc(FLAGS(scan),
- (U8) EIGHT_BIT_UTF8_TO_NATIVE(nextchr,
- *(locinput + 1))))))
+ EIGHT_BIT_UTF8_TO_NATIVE(nextchr,
+ *(locinput + 1))))))
{
sayNO;
}
diff --git a/toke.c b/toke.c
index b9fe9aea5a..7f45f1b0e9 100644
--- a/toke.c
+++ b/toke.c
@@ -3593,7 +3593,7 @@ S_scan_const(pTHX_ char *start)
/* The regex compiler is
* expecting Unicode, not
* native */
- (U8) NATIVE_TO_LATIN1(*str));
+ NATIVE_TO_LATIN1(*str));
PERL_MY_SNPRINTF_POST_GUARD(len,
sizeof(hex_string));
Copy(hex_string, d, 3, char);
diff --git a/utf8.c b/utf8.c
index 91af0bd7ab..5185dd4d3a 100644
--- a/utf8.c
+++ b/utf8.c
@@ -109,7 +109,7 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS;
if (OFFUNI_IS_INVARIANT(uv)) {
- *d++ = (U8) LATIN1_TO_NATIVE(uv);
+ *d++ = LATIN1_TO_NATIVE(uv);
return d;
}
@@ -165,10 +165,10 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
STRLEN len = OFFUNISKIP(uv);
U8 *p = d+len-1;
while (p > d) {
- *p-- = (U8) I8_TO_NATIVE_UTF8((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK);
+ *p-- = I8_TO_NATIVE_UTF8((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK);
uv >>= UTF_ACCUMULATION_SHIFT;
}
- *p = (U8) I8_TO_NATIVE_UTF8((uv & UTF_START_MASK(len)) | UTF_START_MARK(len));
+ *p = I8_TO_NATIVE_UTF8((uv & UTF_START_MASK(len)) | UTF_START_MARK(len));
return d+len;
}
#else /* Non loop style */
diff --git a/utf8.h b/utf8.h
index 277ed52a8b..464cf09d3e 100644
--- a/utf8.h
+++ b/utf8.h
@@ -136,8 +136,8 @@ END_EXTERN_C
/* Native character to/from iso-8859-1. Are the identity functions on ASCII
* platforms */
-#define NATIVE_TO_LATIN1(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) (ch))
-#define LATIN1_TO_NATIVE(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) (ch))
+#define NATIVE_TO_LATIN1(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))
+#define LATIN1_TO_NATIVE(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))
/* I8 is an intermediate version of UTF-8 used only in UTF-EBCDIC. We thus
* consider it to be identical to UTF-8 on ASCII platforms. Strictly speaking
@@ -145,12 +145,12 @@ END_EXTERN_C
* because they are 8-bit encodings that serve the same purpose in Perl, and
* rarely do we need to distinguish them. The term "NATIVE_UTF8" applies to
* whichever one is applicable on the current platform */
-#define NATIVE_UTF8_TO_I8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) (ch))
-#define I8_TO_NATIVE_UTF8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) (ch))
+#define NATIVE_UTF8_TO_I8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))
+#define I8_TO_NATIVE_UTF8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch)))
/* Transforms in wide UV chars */
-#define UNI_TO_NATIVE(ch) (ch)
-#define NATIVE_TO_UNI(ch) (ch)
+#define UNI_TO_NATIVE(ch) ((UV) (ch))
+#define NATIVE_TO_UNI(ch) ((UV) (ch))
/*
@@ -446,9 +446,9 @@ only) byte is pointed to by C<s>.
/* The next two macros are used when the source should be a single byte
* character; checked for under DEBUGGING */
#define UTF8_EIGHT_BIT_HI(c) (__ASSERT_(FITS_IN_8_BITS(c)) \
- ((U8) __BASE_TWO_BYTE_HI(c, NATIVE_TO_LATIN1)))
+ ( __BASE_TWO_BYTE_HI(c, NATIVE_TO_LATIN1)))
#define UTF8_EIGHT_BIT_LO(c) (__ASSERT_(FITS_IN_8_BITS(c)) \
- ((U8) __BASE_TWO_BYTE_LO(c, NATIVE_TO_LATIN1)))
+ (__BASE_TWO_BYTE_LO(c, NATIVE_TO_LATIN1)))
/* These final two macros in the series are used when the source can be any
* code point whose UTF-8 is known to occupy 2 bytes; they are less efficient
@@ -459,11 +459,11 @@ only) byte is pointed to by C<s>.
#define UTF8_TWO_BYTE_HI(c) \
(__ASSERT_((sizeof(c) == 1) \
|| !(((WIDEST_UTYPE)(c)) & ~MAX_UTF8_TWO_BYTE)) \
- ((U8) __BASE_TWO_BYTE_HI(c, NATIVE_TO_UNI)))
+ (__BASE_TWO_BYTE_HI(c, NATIVE_TO_UNI)))
#define UTF8_TWO_BYTE_LO(c) \
(__ASSERT_((sizeof(c) == 1) \
|| !(((WIDEST_UTYPE)(c)) & ~MAX_UTF8_TWO_BYTE)) \
- ((U8) __BASE_TWO_BYTE_LO(c, NATIVE_TO_UNI)))
+ (__BASE_TWO_BYTE_LO(c, NATIVE_TO_UNI)))
/* This is illegal in any well-formed UTF-8 in both EBCDIC and ASCII
* as it is only in overlongs. */
diff --git a/utfebcdic.h b/utfebcdic.h
index 09defa9bd0..9ab6de4728 100644
--- a/utfebcdic.h
+++ b/utfebcdic.h
@@ -146,8 +146,8 @@ END_EXTERN_C
#define I8_TO_NATIVE_UTF8(b) (__ASSERT_(FITS_IN_8_BITS(b)) PL_utf2e[(U8)(b)])
/* Transforms in wide UV chars */
-#define NATIVE_TO_UNI(ch) (FITS_IN_8_BITS(ch) ? NATIVE_TO_LATIN1(ch) : (ch))
-#define UNI_TO_NATIVE(ch) (FITS_IN_8_BITS(ch) ? LATIN1_TO_NATIVE(ch) : (ch))
+#define NATIVE_TO_UNI(ch) (FITS_IN_8_BITS(ch) ? NATIVE_TO_LATIN1(ch) : (UV) (ch))
+#define UNI_TO_NATIVE(ch) (FITS_IN_8_BITS(ch) ? LATIN1_TO_NATIVE(ch) : (UV) (ch))
/* How wide can a single UTF-8 encoded character become in bytes. */
/* NOTE: Strictly speaking Perl's UTF-8 should not be called UTF-8 since UTF-8