diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-04-19 17:45:53 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-04-19 17:45:53 +0000 |
commit | c6a7db43c3667911196e8ad7c6a3ad53333f3cf3 (patch) | |
tree | fe2d1daa3f9c071b3130bbf5692f91f52756b9ac /ext | |
parent | 36930015f9a88b89b721b1f86ffd13c06232dddf (diff) | |
download | perl-c6a7db43c3667911196e8ad7c6a3ad53333f3cf3.tar.gz |
Silence warning generating warning message for U+FFFF does not map etc.
p4raw-id: //depot/perlio@16007
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Encode/Encode.xs | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 9806d59621..1725db98ca 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -11,11 +11,11 @@ /* set 1 or more to profile. t/encoding.t dumps core because of Perl_warner and PerlIO don't work well */ -#define ENCODE_XS_PROFILE 0 +#define ENCODE_XS_PROFILE 0 /* set 0 to disable floating point to calculate buffer size for encode_method(). 1 is recommended. 2 restores NI-S original */ -#define ENCODE_XS_USEFP 1 +#define ENCODE_XS_USEFP 1 #define UNIMPLEMENTED(x,y) y x (SV *sv, char *encoding) {dTHX; \ Perl_croak(aTHX_ "panic_unimplemented"); \ @@ -119,39 +119,39 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, } case ENCODE_NOREP: /* encoding */ - if (dir == enc->f_utf8) { + if (dir == enc->f_utf8) { STRLEN clen; UV ch = - utf8n_to_uvuni(s+slen, (SvCUR(src)-slen), &clen, 0); + utf8n_to_uvuni(s+slen, (SvCUR(src)-slen), &clen, UTF8_ALLOW_ANY|UTF8_CHECK_ONLY); if (check & ENCODE_DIE_ON_ERR) { Perl_croak( - aTHX_ "\"\\N{U+%" UVxf "}\" does not map to %s, %d", + aTHX_ "\"\\N{U+%" UVxf "}\" does not map to %s, %d", ch, enc->name[0], __LINE__); }else{ if (check & ENCODE_RETURN_ON_ERR){ if (check & ENCODE_WARN_ON_ERR){ Perl_warner( aTHX_ packWARN(WARN_UTF8), - "\"\\N{U+%" UVxf "}\" does not map to %s", + "\"\\N{U+%" UVxf "}\" does not map to %s", ch,enc->name[0]); } goto ENCODE_SET_SRC; }else if (check & ENCODE_PERLQQ){ - SV* perlqq = + SV* perlqq = sv_2mortal(newSVpvf("\\x{%04x}", ch)); sdone += slen + clen; ddone += dlen + SvCUR(perlqq); sv_catsv(dst, perlqq); - } 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)", @@ -166,22 +166,22 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, } goto ENCODE_SET_SRC; }else if (check & ENCODE_PERLQQ){ - SV* perlqq = + SV* perlqq = sv_2mortal(newSVpvf("\\x%02X", s[slen])); sdone += slen + 1; ddone += dlen + SvCUR(perlqq); sv_catsv(dst, perlqq); } else { sdone += slen + 1; - ddone += dlen + strlen(FBCHAR_UTF8); - sv_catpv(dst, FBCHAR_UTF8); + ddone += dlen + strlen(FBCHAR_UTF8); + sv_catpv(dst, FBCHAR_UTF8); } } } /* settle variables when fallback */ - dlen = SvCUR(dst); - d = (U8*)SvPVX(dst) + dlen; - s = (U8*)SvPVX(src) + sdone; + dlen = SvCUR(dst); + d = (U8*)SvPVX(dst) + dlen; + s = (U8*)SvPVX(src) + sdone; slen = tlen - sdone; break; @@ -193,7 +193,7 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, } } ENCODE_SET_SRC: - if (check & ~ENCODE_LEAVE_SRC){ + if (check & ~ENCODE_LEAVE_SRC){ sdone = SvCUR(src) - (slen+sdone); if (sdone) { sv_setpvn(src, (char*)s+slen, sdone); @@ -204,10 +204,10 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, 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_ @@ -216,7 +216,7 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, (SvLEN(dst) - SvCUR(dst))*1.0/SvLEN(dst)*100.0); } #endif - + ENCODE_END: *SvEND(dst) = '\0'; return dst; @@ -272,7 +272,7 @@ SV * sv CODE: { SV * encoding = items == 2 ? ST(1) : Nullsv; - + if (encoding) RETVAL = _encoded_bytes_to_utf8(sv, SvPV_nolen(encoding)); else { @@ -309,7 +309,7 @@ CODE: /* Must do things the slow way */ U8 *dest; /* We need a copy to pass to check() */ - U8 *src = (U8*)savepv((char *)s); + U8 *src = (U8*)savepv((char *)s); U8 *send = s + len; New(83, dest, len, U8); /* I think */ @@ -334,8 +334,8 @@ CODE: /* Note change to utf8.c variable naming, for variety */ while (ulen--) { - if ((*s & 0xc0) != 0x80){ - goto failure; + if ((*s & 0xc0) != 0x80){ + goto failure; } else { uv = (uv << 6) | (*s++ & 0x3f); } @@ -421,7 +421,7 @@ CODE: OUTPUT: RETVAL -int +int WARN_ON_ERR() CODE: RETVAL = ENCODE_WARN_ON_ERR; |