This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
RE: [PATCH] s/perl510/perl511/g
[perl5.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index e9e14fc..7bc2b09 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -2168,13 +2168,13 @@ Perl_pv_uni_display(pTHX_ SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV f
                 default: break;
                 }
                 if (ok) {
-                    const unsigned char string = (unsigned char) ok;
+                    const char string = ok;
                     sv_catpvn(dsv, &string, 1);
                 }
             }
             /* isPRINT() is the locale-blind version. */
             if (!ok && (flags & UNI_DISPLAY_ISPRINT) && isPRINT(c)) {
-                const unsigned char string = (unsigned char) c;
+                const char string = c;
                 sv_catpvn(dsv, &string, 1);
                 ok = 1;
             }
@@ -2254,13 +2254,18 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, char **pe1, register UV l1, bool u1, const
      
      if (pe1)
          e1 = *(U8**)pe1;
+     /* assert(e1 || l1); */
      if (e1 == 0 || (l1 && l1 < (UV)(e1 - (const U8*)s1)))
          f1 = (const U8*)s1 + l1;
      if (pe2)
          e2 = *(U8**)pe2;
+     /* assert(e2 || l2); */
      if (e2 == 0 || (l2 && l2 < (UV)(e2 - (const U8*)s2)))
          f2 = (const U8*)s2 + l2;
 
+     /* This shouldn't happen. However, putting an assert() there makes some
+      * tests fail. */
+     /* assert((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0)); */
      if ((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0))
          return 1; /* mismatch; possible infinite loop or false positive */