summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2019-01-31 09:12:29 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2019-01-31 09:12:29 +0000
commitbbe6f202f7bf0108cfc3bc44dbab7be65c113ce2 (patch)
treecf86f7c7f00d00dd8227623ba034dc5fbc1f16c9 /cpan
parente8db349f5c61708301fd5463e49bfe95c448dd6d (diff)
downloadperl-bbe6f202f7bf0108cfc3bc44dbab7be65c113ce2.tar.gz
Update Encode to CPAN version 3.00
[DELTA] $Revision: 3.00 $ $Date: 2019/01/31 04:51:32 $ ! Encode.pm VERSION bumped to 3.00 to make PAUSE happy 2.100 2019/01/31 04:26:40 ! Encode.xs MANIFEST + t/xml.t Pulled: Do not access SV* buffer if we have not called SvPV_force() https://github.com/dankogai/p5-encode/pull/137 ! MANIFEST remove utf8messages.t which is already deleted from the repository.
Diffstat (limited to 'cpan')
-rw-r--r--cpan/Encode/Encode.pm4
-rw-r--r--cpan/Encode/Encode.xs28
-rw-r--r--cpan/Encode/t/decode.t2
-rw-r--r--cpan/Encode/t/enc_eucjp.t2
-rw-r--r--cpan/Encode/t/xml.t22
5 files changed, 36 insertions, 22 deletions
diff --git a/cpan/Encode/Encode.pm b/cpan/Encode/Encode.pm
index ec625b9f20..6d240b3bc1 100644
--- a/cpan/Encode/Encode.pm
+++ b/cpan/Encode/Encode.pm
@@ -1,5 +1,5 @@
#
-# $Id: Encode.pm,v 2.99 2019/01/21 03:11:41 dankogai Exp $
+# $Id: Encode.pm,v 3.00 2019/01/31 04:49:28 dankogai Exp $
#
package Encode;
use strict;
@@ -7,7 +7,7 @@ use warnings;
use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG};
our $VERSION;
BEGIN {
- $VERSION = sprintf "%d.%02d", q$Revision: 2.99 $ =~ /(\d+)/g;
+ $VERSION = sprintf "%d.%02d", q$Revision: 3.00 $ =~ /(\d+)/g;
require XSLoader;
XSLoader::load( __PACKAGE__, $VERSION );
}
diff --git a/cpan/Encode/Encode.xs b/cpan/Encode/Encode.xs
index ddc1b1f366..30fbeaba5f 100644
--- a/cpan/Encode/Encode.xs
+++ b/cpan/Encode/Encode.xs
@@ -1,5 +1,5 @@
/*
- $Id: Encode.xs,v 2.45 2019/01/21 03:13:35 dankogai Exp $
+ $Id: Encode.xs,v 2.46 2019/01/31 04:26:40 dankogai Exp $
*/
#define PERL_NO_GET_CONTEXT
@@ -148,6 +148,7 @@ encode_method(pTHX_ const encode_t * enc, const encpage_t * dir, SV * src, U8 *
IV check, STRLEN * offset, SV * term, int * retcode,
SV *fallback_cb)
{
+ U8 *sorig = s;
STRLEN tlen = slen;
STRLEN ddone = 0;
STRLEN sdone = 0;
@@ -309,7 +310,7 @@ encode_method(pTHX_ const encode_t * enc, const encpage_t * dir, SV * src, U8 *
/* settle variables when fallback */
d = (U8 *)SvEND(dst);
dlen = SvLEN(dst) - ddone - 1;
- s = (U8*)SvPVX(src) + sdone;
+ s = sorig + sdone;
slen = tlen - sdone;
break;
@@ -322,12 +323,9 @@ encode_method(pTHX_ const encode_t * enc, const encpage_t * dir, SV * src, U8 *
} /* End of looping through the string */
ENCODE_SET_SRC:
if (check && !(check & ENCODE_LEAVE_SRC)){
- sdone = SvCUR(src) - (slen+sdone);
- if (sdone) {
+ sdone = tlen - (slen+sdone);
sv_setpvn(src, (char*)s+slen, sdone);
- }
- SvCUR_set(src, sdone);
- SvSETMAGIC(src);
+ SvSETMAGIC(src);
}
/* warn("check = 0x%X, code = 0x%d\n", check, code); */
@@ -335,7 +333,7 @@ encode_method(pTHX_ const encode_t * enc, const encpage_t * dir, SV * src, U8 *
SvPOK_only(dst);
#if ENCODE_XS_PROFILE
- if (SvCUR(dst) > SvCUR(src)){
+ if (SvCUR(dst) > tlen){
Perl_warn(aTHX_
"SvLEN(dst)=%d, SvCUR(dst)=%d. %d bytes unused(%f %%)\n",
SvLEN(dst), SvCUR(dst), SvLEN(dst) - SvCUR(dst),
@@ -666,12 +664,9 @@ PPCODE:
/* Clear out translated part of source unless asked not to */
if (modify) {
- slen = e-s;
- if (slen) {
+ slen = e-s;
sv_setpvn(src, (char*)s, slen);
- }
- SvCUR_set(src, slen);
- SvSETMAGIC(src);
+ SvSETMAGIC(src);
}
SvUTF8_on(dst);
if (SvTAINTED(src)) SvTAINTED_on(dst); /* propagate taintedness */
@@ -736,12 +731,9 @@ PPCODE:
/* Clear out translated part of source unless asked not to */
if (modify) {
- slen = e-s;
- if (slen) {
+ slen = e-s;
sv_setpvn(src, (char*)s, slen);
- }
- SvCUR_set(src, slen);
- SvSETMAGIC(src);
+ SvSETMAGIC(src);
}
SvPOK_only(dst);
SvUTF8_off(dst);
diff --git a/cpan/Encode/t/decode.t b/cpan/Encode/t/decode.t
index 0c3b6697f4..66723f4423 100644
--- a/cpan/Encode/t/decode.t
+++ b/cpan/Encode/t/decode.t
@@ -1,5 +1,5 @@
#
-# $Id: decode.t,v 1.4 2017/10/06 22:21:53 dankogai Exp $
+# $Id: decode.t,v 1.5 2019/01/31 04:26:40 dankogai Exp $
#
use strict;
use Encode qw(decode_utf8 FB_CROAK find_encoding decode);
diff --git a/cpan/Encode/t/enc_eucjp.t b/cpan/Encode/t/enc_eucjp.t
index 8f933b0063..84548af0d6 100644
--- a/cpan/Encode/t/enc_eucjp.t
+++ b/cpan/Encode/t/enc_eucjp.t
@@ -1,4 +1,4 @@
-# $Id: enc_eucjp.t,v 2.5 2017/06/10 17:23:50 dankogai Exp $
+# $Id: enc_eucjp.t,v 2.6 2019/01/31 04:26:40 dankogai Exp $
# This is the twin of enc_utf8.t .
BEGIN {
diff --git a/cpan/Encode/t/xml.t b/cpan/Encode/t/xml.t
new file mode 100644
index 0000000000..2c7e721d91
--- /dev/null
+++ b/cpan/Encode/t/xml.t
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+use Encode;
+use Test::More;
+
+my $content = String->new("--\x{30c6}--");
+my $text = Encode::encode('latin1', $content, Encode::FB_XMLCREF);
+is $text, "--&#x30c6;--";
+
+done_testing;
+
+package String;
+use overload
+ '""' => sub { ${$_[0]} }, fallback => 1;
+
+sub new {
+ my($class, $str) = @_;
+ bless \$str, $class;
+}
+
+1;