From: Nick Ing-Simmons Date: Sun, 28 Apr 2002 07:19:01 +0000 (+0000) Subject: Integrate mainline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e80e6293390a61a8964f30fb88fd0d7e37c49e0e;p=p5sagit%2Fp5-mst-13.2.git Integrate mainline p4raw-id: //depot/perlio@16243 --- e80e6293390a61a8964f30fb88fd0d7e37c49e0e diff --cc ext/Encode/Encode.xs index 1311d8d,65cf137..8971476 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@@ -157,33 -159,35 +159,35 @@@ encode_method(pTHX_ encode_t * enc, enc sdone += slen + clen; ddone += dlen + SvCUR(xmlcref); sv_catsv(dst, xmlcref); - } else { + } else { /* fallback char */ sdone += slen + clen; - ddone += dlen + enc->replen; - sv_catpvn(dst, (char*)enc->rep, enc->replen); + ddone += dlen + enc->replen; + sv_catpvn(dst, (char*)enc->rep, enc->replen); } - } + } } /* decoding */ - else { + else { if (check & ENCODE_DIE_ON_ERR){ Perl_croak( - aTHX_ "%s \"\\x%02X\" does not map to Unicode (%d)", - aTHX_ "%s \"\\x%02" UVXf ++ aTHX_ "%s \"\\x%02" UVXf + "\" does not map to Unicode (%d)", enc->name[0], (U8) s[slen], code); }else{ if (check & ENCODE_RETURN_ON_ERR){ if (check & ENCODE_WARN_ON_ERR){ Perl_warner( aTHX_ packWARN(WARN_UTF8), - "%s \"\\x%02X\" does not map to Unicode (%d)", - "%s \"\\x%02" UVXf ++ "%s \"\\x%02" UVXf + "\" does not map to Unicode (%d)", enc->name[0], (U8) s[slen], code); } goto ENCODE_SET_SRC; - }else if (check & + }else if (check & (ENCODE_PERLQQ|ENCODE_HTMLCREF|ENCODE_XMLCREF)){ - SV* perlqq = + SV* perlqq = - sv_2mortal(newSVpvf("\\x%02X", s[slen])); + sv_2mortal(newSVpvf("\\x%02" UVXf, s[slen])); sdone += slen + 1; ddone += dlen + SvCUR(perlqq); sv_catsv(dst, perlqq); @@@ -217,13 -221,10 +221,10 @@@ SvCUR_set(src, sdone); } /* warn("check = 0x%X, code = 0x%d\n", check, code); */ - if (code && !(check & ENCODE_RETURN_ON_ERR)) { - return &PL_sv_undef; - } - + SvCUR_set(dst, dlen+ddone); SvPOK_only(dst); - + #if ENCODE_XS_PROFILE if (SvCUR(dst) > SvCUR(src)){ Perl_warn(aTHX_