From: Nick Ing-Simmons Date: Sun, 21 Apr 2002 08:10:07 +0000 (+0000) Subject: Integrate mainline X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3e952a8875b864d3a3699ca8a314a85daae5236c;p=p5sagit%2Fp5-mst-13.2.git Integrate mainline p4raw-id: //depot/perlio@16037 --- 3e952a8875b864d3a3699ca8a314a85daae5236c diff --cc ext/Encode/Encode.pm index 3b3fd97,4a4edfc..cd8f91a --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@@ -1,12 -1,12 +1,12 @@@ package Encode; use strict; - our $VERSION = do { my @r = (q$Revision: 1.50 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + our $VERSION = do { my @r = (q$Revision: 1.51 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our $DEBUG = 0; +use XSLoader (); +XSLoader::load 'Encode'; -require DynaLoader; require Exporter; - -our @ISA = qw(Exporter DynaLoader); +our @ISA = qw(Exporter); # Public, encouraged API is exported by default @@@ -259,8 -262,14 +259,18 @@@ sub predefine_encodings } require Encode::Encoding; +@Encode::XS::ISA = qw(Encode::Encoding); -eval { ++# This is very dodgy - PerlIO::encoding does "use Encode" and _BEFORE_ it gets a ++# chance to set its VERSION we potentially delete it from %INC so it will be re-loaded ++# NI-S ++eval { + require PerlIO::encoding; + unless (PerlIO::encoding->VERSION >= 0.02){ + delete $INC{"PerlIO/encoding.pm"}; + } + }; + # warn $@ if $@; 1; diff --cc ext/Encode/Encode.xs index 2796316,f7d871b..0d8f80e --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@@ -119,13 -119,14 +119,14 @@@ encode_method(pTHX_ encode_t * enc, enc } 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, UTF8_ALLOW_ANY|UTF8_CHECK_ONLY); - utf8n_to_uvuni(s+slen, (SvCUR(src)-slen), ++ 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){ @@@ -179,9 -180,9 +180,9 @@@ } } /* settle variables when fallback */ - d = (U8*)SvEND(dst); - dlen = SvLEN(dst)-ddone-1; - s = (U8*)SvPVX(src) + sdone; + d = (U8 *)SvEND(dst); + dlen = SvLEN(dst) - ddone - 1; - s = (U8*)SvPVX(src) + sdone; ++ s = (U8*)SvPVX(src) + sdone; slen = tlen - sdone; break;