From: Jarkko Hietaniemi Date: Mon, 13 Jan 2003 23:10:55 +0000 (+0000) Subject: Upgrade to Encode 1.84. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f7c507f688c1f7ff05ce69abb8332c23e7ec07d;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Encode 1.84. p4raw-id: //depot/perl@18478 --- diff --git a/ext/Encode/Changes b/ext/Encode/Changes index 60452d8..cc1615a 100644 --- a/ext/Encode/Changes +++ b/ext/Encode/Changes @@ -1,9 +1,26 @@ # Revision history for Perl extension Encode. # -# $Id: Changes,v 1.83 2002/11/18 17:28:49 dankogai Exp dankogai $ +# $Id: Changes,v 1.84 2003/01/10 12:00:16 dankogai Exp dankogai $ # -$Revision: 1.83 $ $Date: 2002/11/18 17:28:49 $ +$Revision: 1.84 $ $Date: 2003/01/10 12:00:16 $ +! encoding.pm + ${^ENCODING} is no longer set for utf so encoding is no longer fun :) + (That is to prevent duplicate encoding first by IO then ${^ENCODING}) + Message-Id: <20030108213737.GK331043@lyta.hut.fi> +! Unicode/Unicode.xs + %_ fixes saves the resulting .so .05% smaller, by NC + Message-Id: <20021226225709.GF284@Bagpuss.unfortu.net> +! Encode.pm + Silence Encode on undef, by Andreas + Message-Id: + Message-Id: +! Unicode/Unicode.xs + s/regognised/recognised/ . British spelling left intact to pay + respect to two British Nicks :) + Message-Id: <20021203020454.GK2274@kosh.hut.fi> + +1.83 2002/11/18 17:28:49 ! Encode.xs lib/Encode/JIS7.pm Even more patches from Inaba-san has been applied. With this patch t/uni/tr_7jis.t and t/uni/t_utf8.t of bleedperl will work. diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index 01dc8ff..4bf30e1 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -1,9 +1,9 @@ # -# $Id: Encode.pm,v 1.83 2002/11/18 17:28:29 dankogai Exp $ +# $Id: Encode.pm,v 1.84 2003/01/10 12:00:16 dankogai Exp dankogai $ # package Encode; use strict; -our $VERSION = do { my @r = (q$Revision: 1.83 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.84 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; our $DEBUG = 0; use XSLoader (); XSLoader::load(__PACKAGE__, $VERSION); @@ -131,6 +131,7 @@ sub resolve_alias { sub encode($$;$) { my ($name, $string, $check) = @_; + return undef unless defined $string; $check ||=0; my $enc = find_encoding($name); unless(defined $enc){ @@ -145,6 +146,7 @@ sub encode($$;$) sub decode($$;$) { my ($name,$octets,$check) = @_; + return undef unless defined $octets; $check ||=0; my $enc = find_encoding($name); unless(defined $enc){ @@ -159,6 +161,7 @@ sub decode($$;$) sub from_to($$$;$) { my ($string,$from,$to,$check) = @_; + return undef unless defined $string; $check ||=0; my $f = find_encoding($from); unless (defined $f){ diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 4d30914..0461690 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -1,5 +1,5 @@ /* - $Id: Encode.xs,v 1.52 2002/11/18 17:28:49 dankogai Exp dankogai $ + $Id: Encode.xs,v 1.52 2002/11/18 17:28:49 dankogai Exp $ */ #define PERL_NO_GET_CONTEXT diff --git a/ext/Encode/Unicode/Unicode.xs b/ext/Encode/Unicode/Unicode.xs index 7c79d4a..616401a 100644 --- a/ext/Encode/Unicode/Unicode.xs +++ b/ext/Encode/Unicode/Unicode.xs @@ -1,5 +1,5 @@ /* - $Id: Unicode.xs,v 1.5 2002/05/20 15:25:44 dankogai Exp $ + $Id: Unicode.xs,v 1.6 2003/01/10 12:00:16 dankogai Exp dankogai $ */ #define PERL_NO_GET_CONTEXT @@ -113,8 +113,8 @@ CODE: endian = 'V'; } else { - croak("%s:Unregognised BOM %"UVxf, - SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)), + croak("%"SVf":Unregognised BOM %"UVxf, + *hv_fetch((HV *)SvRV(obj),"Name",4,0), bom); } } @@ -129,8 +129,8 @@ CODE: if (size != 4 && invalid_ucs2(ord)) { if (ucs2) { if (check) { - croak("%s:no surrogates allowed %"UVxf, - SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)), + croak("%"SVf":no surrogates allowed %"UVxf, + *hv_fetch((HV *)SvRV(obj),"Name",4,0), ord); } if (s+size <= e) { @@ -142,8 +142,8 @@ CODE: else { UV lo; if (!isHiSurrogate(ord)) { - croak("%s:Malformed HI surrogate %"UVxf, - SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)), + croak("%"SVf":Malformed HI surrogate %"UVxf, + *hv_fetch((HV *)SvRV(obj),"Name",4,0), ord); } if (s+size > e) { @@ -153,8 +153,8 @@ CODE: } lo = enc_unpack(aTHX_ &s,e,size,endian); if (!isLoSurrogate(lo)){ - croak("%s:Malformed LO surrogate %"UVxf, - SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0)), + croak("%"SVf":Malformed LO surrogate %"UVxf, + *hv_fetch((HV *)SvRV(obj),"Name",4,0), ord); } ord = 0x10000 + ((ord - 0xD800) << 10) + (lo - 0xDC00); @@ -165,8 +165,8 @@ CODE: SvCUR_set(result,d - (U8 *)SvPVX(result)); } if (s < e) { - Perl_warner(aTHX_ packWARN(WARN_UTF8),"%s:Partial character", - SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0))); + Perl_warner(aTHX_ packWARN(WARN_UTF8),"%"SVf":Partial character", + *hv_fetch((HV *)SvRV(obj),"Name",4,0)); } if (check && !(check & ENCODE_LEAVE_SRC)){ if (s < e) { @@ -212,10 +212,8 @@ CODE: if (!issurrogate(ord)){ if (ucs2) { if (check) { - croak("%s:code point \"\\x{%"UVxf"}\" too high", - SvPV_nolen( - *hv_fetch((HV *)SvRV(obj),"Name",4,0)) - ,ord); + croak("%"SVf":code point \"\\x{%"UVxf"}\" too high", + *hv_fetch((HV *)SvRV(obj),"Name",4,0),ord); } enc_pack(aTHX_ result,size,endian,FBCHAR); }else{ @@ -235,8 +233,8 @@ CODE: } } if (s < e) { - Perl_warner(aTHX_ packWARN(WARN_UTF8),"%s:Partial character", - SvPV_nolen(*hv_fetch((HV *)SvRV(obj),"Name",4,0))); + Perl_warner(aTHX_ packWARN(WARN_UTF8),"%"SVf":Partial character", + *hv_fetch((HV *)SvRV(obj),"Name",4,0)); } if (check && !(check & ENCODE_LEAVE_SRC)){ if (s < e) { diff --git a/ext/Encode/encoding.pm b/ext/Encode/encoding.pm index 778b44b..e8aa737 100644 --- a/ext/Encode/encoding.pm +++ b/ext/Encode/encoding.pm @@ -1,5 +1,5 @@ package encoding; -our $VERSION = do { my @r = (q$Revision: 1.37 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 1.38 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; use Encode; use strict; @@ -28,8 +28,9 @@ sub import { require Carp; Carp::croak("Unknown encoding '$name'"); } - unless ($arg{Filter}){ - ${^ENCODING} = $enc; # this is all you need, actually. + unless ($arg{Filter}) { + ${^ENCODING} = $enc # this is all you need, actually. + unless $name =~ /^(?:utf-?(?:8|16|32)|ucs-?(?:2|4))(?:[bl]e)?$/i; $HAS_PERLIO or return 1; for my $h (qw(STDIN STDOUT)){ if ($arg{$h}){