Re: [PATCH] Add Locale::Maketext::Simple to the core
[p5sagit/p5-mst-13.2.git] / dump.c
diff --git a/dump.c b/dump.c
index f9cd28d..ce2c7ca 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -121,7 +121,7 @@ Perl_dump_eval(pTHX)
 
 
 /*
-=for apidoc Apd|char*|pv_escape|NN SV *dsv|NN const U8 const *str\
+=for apidoc Apd|char*|pv_escape|NN SV *dsv|NN const char const *str\
                |const STRLEN count|const STRLEN max
                |STRLEN const *escaped, const U32 flags
 
@@ -158,28 +158,29 @@ Returns a pointer to the escaped text as held by dsv.
 =cut
 */
 #define PV_ESCAPE_OCTBUFSIZE 32
+
 char *
-Perl_pv_escape( pTHX_ SV *dsv, U8 const * const str, 
+Perl_pv_escape( pTHX_ SV *dsv, char const * const str, 
                 const STRLEN count, const STRLEN max, 
                 STRLEN * const escaped, const U32 flags ) 
 {
-    U8 dq = (flags & PERL_PV_ESCAPE_QUOTE) ? '"' : '\\';
-    U8 octbuf[PV_ESCAPE_OCTBUFSIZE] = "\\123456789ABCDF";
+    char dq = (flags & PERL_PV_ESCAPE_QUOTE) ? '"' : '\\';
+    char octbuf[PV_ESCAPE_OCTBUFSIZE] = "\\123456789ABCDF";
     STRLEN wrote = 0;    /* chars written so far */
     STRLEN chsize = 0;   /* size of data to be written */
     STRLEN readsize = 1; /* size of data just read */
     bool isuni= flags & PERL_PV_ESCAPE_UNI ? 1 : 0; /* is this unicode */
-    const U8 *pv  = str;
-    const U8 *end = pv + count; /* end of string */
+    const char *pv  = str;
+    const char *end = pv + count; /* end of string */
 
     if (!flags & PERL_PV_ESCAPE_NOCLEAR) 
            sv_setpvn(dsv, "", 0);
     
-    if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string(pv, count))
+    if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count))
         isuni = 1;
     
     for ( ; (pv < end && (!max || (wrote < max))) ; pv += readsize ) {
-        const UV u= (isuni) ? utf8_to_uvchr(pv, &readsize) : *pv;            
+        const UV u= (isuni) ? utf8_to_uvchr((U8*)pv, &readsize) : (U8)*pv;            
         const U8 c = (U8)u & 0xFF;
         
         if ( ( u > 255 ) || (flags & PERL_PV_ESCAPE_ALL)) {
@@ -208,7 +209,7 @@ Perl_pv_escape( pTHX_ SV *dsv, U8 const * const str,
                             chsize = 1;
                                break;
                default:
-                        if ( (pv < end) && isDIGIT(*(pv+readsize)) )
+                        if ( (pv < end) && isDIGIT((U8)*(pv+readsize)) )
                             chsize = my_snprintf( octbuf, PV_ESCAPE_OCTBUFSIZE, 
                                                   "\\%03o", c);
                            else
@@ -236,9 +237,9 @@ Perl_pv_escape( pTHX_ SV *dsv, U8 const * const str,
     return SvPVX(dsv);
 }
 /*
-=for apidoc Apd|char *|pv_pretty|NN SV *dsv|NN const U8 const *str\
+=for apidoc Apd|char *|pv_pretty|NN SV *dsv|NN const char const *str\
            |const STRLEN count|const STRLEN max\
-           |const U8 const *start_color| const U8 const *end_color\
+           |const char const *start_color| const char const *end_color\
            |const U32 flags
 
 Converts a string into something presentable, handling escaping via
@@ -264,8 +265,8 @@ Returns a pointer to the prettified text as held by dsv.
 */
 
 char *
-Perl_pv_pretty( pTHX_ SV *dsv, U8 const * const str, const STRLEN count, 
-  const STRLEN max, U8 const * const start_color, U8 const * const end_color, 
+Perl_pv_pretty( pTHX_ SV *dsv, char const * const str, const STRLEN count, 
+  const STRLEN max, char const * const start_color, char const * const end_color, 
   const U32 flags ) 
 {
     U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '\\';
@@ -318,7 +319,7 @@ Note that the final string may be up to 7 chars longer than pvlim.
 char *
 Perl_pv_display(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
 {
-    pv_pretty( dsv, pv, cur, pvlim, 0, 0, PERL_PV_PRETTY_DUMP);
+    pv_pretty( dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP);
     if (len > cur && pv[cur] == '\0')
             sv_catpvn( dsv, "\\0", 2 );
     return SvPVX(dsv);
@@ -710,14 +711,14 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
     level++;
     seq = sequence_num(o);
     if (seq)
-       PerlIO_printf(file, "%-4"UVf, seq);
+       PerlIO_printf(file, "%-4"UVuf, seq);
     else
        PerlIO_printf(file, "    ");
     PerlIO_printf(file,
                  "%*sTYPE = %s  ===> ",
                  (int)(PL_dumpindent*level-4), "", OP_NAME(o));
     if (o->op_next)
-       PerlIO_printf(file, seq ? "%"UVf"\n" : "(%"UVf")\n",
+       PerlIO_printf(file, seq ? "%"UVuf"\n" : "(%"UVuf")\n",
                                sequence_num(o->op_next));
     else
        PerlIO_printf(file, "DONE\n");
@@ -726,7 +727,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
            Perl_dump_indent(aTHX_ level, file, "  (was %s)\n", PL_op_name[o->op_targ]);
            if (o->op_targ == OP_NEXTSTATE) {
                if (CopLINE(cCOPo))
-                   Perl_dump_indent(aTHX_ level, file, "LINE = %"UVf"\n",
+                   Perl_dump_indent(aTHX_ level, file, "LINE = %"UVuf"\n",
                                     (UV)CopLINE(cCOPo));
                if (CopSTASHPV(cCOPo))
                    Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
@@ -1026,7 +1027,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
     case OP_NEXTSTATE:
     case OP_DBSTATE:
        if (CopLINE(cCOPo))
-           Perl_dump_indent(aTHX_ level, file, "LINE = %"UVf"\n",
+           Perl_dump_indent(aTHX_ level, file, "LINE = %"UVuf"\n",
                             (UV)CopLINE(cCOPo));
        if (CopSTASHPV(cCOPo))
            Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n",
@@ -1038,17 +1039,17 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
     case OP_ENTERLOOP:
        Perl_dump_indent(aTHX_ level, file, "REDO ===> ");
        if (cLOOPo->op_redoop)
-           PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOOPo->op_redoop));
+           PerlIO_printf(file, "%"UVuf"\n", sequence_num(cLOOPo->op_redoop));
        else
            PerlIO_printf(file, "DONE\n");
        Perl_dump_indent(aTHX_ level, file, "NEXT ===> ");
        if (cLOOPo->op_nextop)
-           PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOOPo->op_nextop));
+           PerlIO_printf(file, "%"UVuf"\n", sequence_num(cLOOPo->op_nextop));
        else
            PerlIO_printf(file, "DONE\n");
        Perl_dump_indent(aTHX_ level, file, "LAST ===> ");
        if (cLOOPo->op_lastop)
-           PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOOPo->op_lastop));
+           PerlIO_printf(file, "%"UVuf"\n", sequence_num(cLOOPo->op_lastop));
        else
            PerlIO_printf(file, "DONE\n");
        break;
@@ -1060,7 +1061,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
     case OP_AND:
        Perl_dump_indent(aTHX_ level, file, "OTHER ===> ");
        if (cLOGOPo->op_other)
-           PerlIO_printf(file, "%"UVf"\n", sequence_num(cLOGOPo->op_other));
+           PerlIO_printf(file, "%"UVuf"\n", sequence_num(cLOGOPo->op_other));
        else
            PerlIO_printf(file, "DONE\n");
        break;
@@ -2491,7 +2492,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o)
            if (o->op_targ == OP_NEXTSTATE)
            {
                if (CopLINE(cCOPo))
-                   PerlIO_printf(file, " line=\"%"UVf"\"",
+                   PerlIO_printf(file, " line=\"%"UVuf"\"",
                                     (UV)CopLINE(cCOPo));
                if (CopSTASHPV(cCOPo))
                    PerlIO_printf(file, " package=\"%s\"",
@@ -2758,7 +2759,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o)
     case OP_NEXTSTATE:
     case OP_DBSTATE:
        if (CopLINE(cCOPo))
-           S_xmldump_attr(aTHX_ level, file, "line=\"%"UVf"\"",
+           S_xmldump_attr(aTHX_ level, file, "line=\"%"UVuf"\"",
                             (UV)CopLINE(cCOPo));
        if (CopSTASHPV(cCOPo))
            S_xmldump_attr(aTHX_ level, file, "package=\"%s\"",