summaryrefslogtreecommitdiff
path: root/cpan/MIME-Base64
diff options
context:
space:
mode:
authorJesse Vincent <jesse@bestpractical.com>2010-02-03 12:41:13 -0800
committerJesse Vincent <jesse@bestpractical.com>2010-02-03 12:41:13 -0800
commit9ef40646096384d9f65acffab1b9a2df07d03a0c (patch)
treeee618c539a0947bb6ec21398ff35863969187342 /cpan/MIME-Base64
parentf6ef2c660ed92bb859fe759e2dc87eb7fc02615a (diff)
downloadperl-9ef40646096384d9f65acffab1b9a2df07d03a0c.tar.gz
Revert "Update to MIME-Base64 3.09"
I chatted with Gisle and he confirmed that this didn't fix a release-blocking issue. Since we're frozen for 5.12, he agreed that we should back it out. This reverts commit 5e58db16ffcf34442d0ba4b645757884324e35c2.
Diffstat (limited to 'cpan/MIME-Base64')
-rw-r--r--cpan/MIME-Base64/Base64.pm2
-rw-r--r--cpan/MIME-Base64/Base64.xs36
-rw-r--r--cpan/MIME-Base64/Changes10
-rw-r--r--cpan/MIME-Base64/QuotedPrint.pm2
-rw-r--r--cpan/MIME-Base64/t/quoted-print.t11
5 files changed, 23 insertions, 38 deletions
diff --git a/cpan/MIME-Base64/Base64.pm b/cpan/MIME-Base64/Base64.pm
index 2bcd585779..6c076d1b7c 100644
--- a/cpan/MIME-Base64/Base64.pm
+++ b/cpan/MIME-Base64/Base64.pm
@@ -7,7 +7,7 @@ require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(encode_base64 decode_base64);
-$VERSION = '3.09';
+$VERSION = '3.08';
require XSLoader;
XSLoader::load('MIME::Base64', $VERSION);
diff --git a/cpan/MIME-Base64/Base64.xs b/cpan/MIME-Base64/Base64.xs
index 279aad984b..1740a163f1 100644
--- a/cpan/MIME-Base64/Base64.xs
+++ b/cpan/MIME-Base64/Base64.xs
@@ -1,4 +1,4 @@
-/*
+/* $Id$
Copyright 1997-2004 Gisle Aas
@@ -119,7 +119,7 @@ encode_base64(sv,...)
PREINIT:
char *str; /* string to encode */
SSize_t len; /* length of the string */
- const char*eol;/* the end-of-line sequence to use */
+ char *eol; /* the end-of-line sequence to use */
STRLEN eollen; /* length of the EOL sequence */
char *r; /* result string */
STRLEN rlen; /* length of result string */
@@ -157,8 +157,8 @@ encode_base64(sv,...)
/* encode */
for (chunk=0; len > 0; len -= 3, chunk++) {
if (chunk == (MAX_LINE/4)) {
- const char *c = eol;
- const char *e = eol + eollen;
+ char *c = eol;
+ char *e = eol + eollen;
while (c < e)
*r++ = *c++;
chunk = 0;
@@ -181,8 +181,8 @@ encode_base64(sv,...)
}
if (rlen) {
/* append eol to the result string */
- const char *c = eol;
- const char *e = eol + eollen;
+ char *c = eol;
+ char *e = eol + eollen;
while (c < e)
*r++ = *c++;
}
@@ -270,7 +270,7 @@ encode_qp(sv,...)
PROTOTYPE: $;$$
PREINIT:
- const char *eol;
+ char *eol;
STRLEN eol_len;
int binary;
STRLEN sv_len;
@@ -320,8 +320,15 @@ encode_qp(sv,...)
if (p_len) {
/* output plain text (with line breaks) */
if (eol_len) {
- while (p_len > MAX_LINE - 1 - linelen) {
+ STRLEN max_last_line = (p == end || *p == '\n')
+ ? MAX_LINE /* .......\n */
+ : ((p + 1) == end || *(p + 1) == '\n')
+ ? MAX_LINE - 3 /* ....=XX\n */
+ : MAX_LINE - 4; /* ...=XX=\n */
+ while (p_len + linelen > max_last_line) {
STRLEN len = MAX_LINE - 1 - linelen;
+ if (len > p_len)
+ len = p_len;
sv_catpvn(RETVAL, p_beg, len);
p_beg += len;
p_len -= len;
@@ -340,21 +347,14 @@ encode_qp(sv,...)
break;
}
else if (*p == '\n' && eol_len && !binary) {
- if (linelen == 1 && SvCUR(RETVAL) > eol_len + 1 && SvEND(RETVAL)[-eol_len - 2] == '=') {
- /* fixup useless soft linebreak */
- SvEND(RETVAL)[-eol_len - 2] = SvEND(RETVAL)[-1];
- SvCUR_set(RETVAL, SvCUR(RETVAL) - 1);
- }
- else {
- sv_catpvn(RETVAL, eol, eol_len);
- }
- p++;
+ sv_catpvn(RETVAL, eol, eol_len);
+ p++;
linelen = 0;
}
else {
/* output escaped char (with line breaks) */
assert(p < end);
- if (eol_len && linelen > MAX_LINE - 4 && !(linelen == MAX_LINE - 3 && p + 1 < end && p[1] == '\n' && !binary)) {
+ if (eol_len && linelen > MAX_LINE - 4) {
sv_catpvn(RETVAL, "=", 1);
sv_catpvn(RETVAL, eol, eol_len);
linelen = 0;
diff --git a/cpan/MIME-Base64/Changes b/cpan/MIME-Base64/Changes
index 595c8dc0c9..4b60a89d96 100644
--- a/cpan/MIME-Base64/Changes
+++ b/cpan/MIME-Base64/Changes
@@ -1,13 +1,3 @@
-2010-01-25 Gisle Aas <gisle@ActiveState.com>
-
- Release 3.09
-
- The Quoted-Printable encoder would sometimes output lines
- that were 77 characters long. The max line length should be 76.
- [RT#53919]
-
-
-
2009-06-09 Gisle Aas <gisle@ActiveState.com>
Release 3.08
diff --git a/cpan/MIME-Base64/QuotedPrint.pm b/cpan/MIME-Base64/QuotedPrint.pm
index ca3a042edb..aee13d6256 100644
--- a/cpan/MIME-Base64/QuotedPrint.pm
+++ b/cpan/MIME-Base64/QuotedPrint.pm
@@ -7,7 +7,7 @@ require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(encode_qp decode_qp);
-$VERSION = "3.09";
+$VERSION = "3.08";
use MIME::Base64; # will load XS version of {en,de}code_qp()
diff --git a/cpan/MIME-Base64/t/quoted-print.t b/cpan/MIME-Base64/t/quoted-print.t
index 73c23016c7..5bb87385af 100644
--- a/cpan/MIME-Base64/t/quoted-print.t
+++ b/cpan/MIME-Base64/t/quoted-print.t
@@ -62,7 +62,7 @@ y. -- H. L. Mencken=\n"],
["$x70!23" => "$x70!23=\n"],
["$x70!234" => "$x70!234=\n"],
["$x70!2345" => "$x70!2345=\n"],
- ["$x70!23456" => "$x70!2345=\n6=\n"],
+ ["$x70!23456" => "$x70!23456=\n"],
["$x70!234567" => "$x70!2345=\n67=\n"],
["$x70!23456=" => "$x70!2345=\n6=3D=\n"],
["$x70!23\n" => "$x70!23\n"],
@@ -78,13 +78,8 @@ y. -- H. L. Mencken=\n"],
["$x70!2===xxx" => "$x70!2=3D=\n=3D=3Dxxx=\n"],
["$x70!23===xx" => "$x70!23=\n=3D=3D=3Dxx=\n"],
["$x70!234===x" => "$x70!234=\n=3D=3D=3Dx=\n"],
- ["$x70!2=" => "$x70!2=3D=\n"],
- ["$x70!23=" => "$x70!23=\n=3D=\n"],
- ["$x70!234=" => "$x70!234=\n=3D=\n"],
- ["$x70!2345=" => "$x70!2345=\n=3D=\n"],
- ["$x70!23456=" => "$x70!2345=\n6=3D=\n"],
["$x70!2=\n" => "$x70!2=3D\n"],
- ["$x70!23=\n" => "$x70!23=3D\n"],
+ ["$x70!23=\n" => "$x70!23=\n=3D\n"],
["$x70!234=\n" => "$x70!234=\n=3D\n"],
["$x70!2345=\n" => "$x70!2345=\n=3D\n"],
["$x70!23456=\n" => "$x70!2345=\n6=3D\n"],
@@ -152,7 +147,7 @@ y. -- H. L. Mencken=\n"],
["$x70!23" => "$x70!23=\n"],
["$x70!234" => "$x70!234=\n"],
["$x70!2345" => "$x70!2345=\n"],
- ["$x70!23456" => "$x70!2345=\n6=\n"],
+ ["$x70!23456" => "$x70!23456=\n"],
["$x70!234567" => "$x70!2345=\n67=\n"],
["$x70!23456=" => "$x70!2345=\n6=7E=\n"],
["$x70!23\n" => "$x70!23\n"],