summaryrefslogtreecommitdiff
path: root/cpan/MIME-Base64
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2010-02-02 23:22:15 +0100
committerGisle Aas <gisle@aas.no>2010-04-18 17:30:18 +0200
commit9f1a4ec8341de9d773560197e1271866342ebdcb (patch)
tree95ceb28e84f49684f3d6ba82c58afbcf311421e6 /cpan/MIME-Base64
parent321e50c78dc0d470de5f7359ebb2943e43def5bd (diff)
downloadperl-9f1a4ec8341de9d773560197e1271866342ebdcb.tar.gz
Update to MIME-Base64 3.09
Fixes issue where the Quoted-Printable encoder would sometimes output lines that were 77 characters long. The max line length should be 76. This reverts revert 9ef40646096384d9f65acffab1b9a2df07d03a0c.
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, 38 insertions, 23 deletions
diff --git a/cpan/MIME-Base64/Base64.pm b/cpan/MIME-Base64/Base64.pm
index 6c076d1b7c..2bcd585779 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.08';
+$VERSION = '3.09';
require XSLoader;
XSLoader::load('MIME::Base64', $VERSION);
diff --git a/cpan/MIME-Base64/Base64.xs b/cpan/MIME-Base64/Base64.xs
index 1740a163f1..279aad984b 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 */
- char *eol; /* the end-of-line sequence to use */
+ const 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)) {
- char *c = eol;
- char *e = eol + eollen;
+ const char *c = eol;
+ const 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 */
- char *c = eol;
- char *e = eol + eollen;
+ const char *c = eol;
+ const char *e = eol + eollen;
while (c < e)
*r++ = *c++;
}
@@ -270,7 +270,7 @@ encode_qp(sv,...)
PROTOTYPE: $;$$
PREINIT:
- char *eol;
+ const char *eol;
STRLEN eol_len;
int binary;
STRLEN sv_len;
@@ -320,15 +320,8 @@ encode_qp(sv,...)
if (p_len) {
/* output plain text (with line breaks) */
if (eol_len) {
- 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) {
+ while (p_len > MAX_LINE - 1 - linelen) {
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;
@@ -347,14 +340,21 @@ encode_qp(sv,...)
break;
}
else if (*p == '\n' && eol_len && !binary) {
- sv_catpvn(RETVAL, eol, eol_len);
- p++;
+ 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++;
linelen = 0;
}
else {
/* output escaped char (with line breaks) */
assert(p < end);
- if (eol_len && linelen > MAX_LINE - 4) {
+ if (eol_len && linelen > MAX_LINE - 4 && !(linelen == MAX_LINE - 3 && p + 1 < end && p[1] == '\n' && !binary)) {
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 4b60a89d96..595c8dc0c9 100644
--- a/cpan/MIME-Base64/Changes
+++ b/cpan/MIME-Base64/Changes
@@ -1,3 +1,13 @@
+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 aee13d6256..ca3a042edb 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.08";
+$VERSION = "3.09";
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 5bb87385af..73c23016c7 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!23456=\n"],
+ ["$x70!23456" => "$x70!2345=\n6=\n"],
["$x70!234567" => "$x70!2345=\n67=\n"],
["$x70!23456=" => "$x70!2345=\n6=3D=\n"],
["$x70!23\n" => "$x70!23\n"],
@@ -78,8 +78,13 @@ 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=\n=3D\n"],
+ ["$x70!23=\n" => "$x70!23=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"],
@@ -147,7 +152,7 @@ y. -- H. L. Mencken=\n"],
["$x70!23" => "$x70!23=\n"],
["$x70!234" => "$x70!234=\n"],
["$x70!2345" => "$x70!2345=\n"],
- ["$x70!23456" => "$x70!23456=\n"],
+ ["$x70!23456" => "$x70!2345=\n6=\n"],
["$x70!234567" => "$x70!2345=\n67=\n"],
["$x70!23456=" => "$x70!2345=\n6=7E=\n"],
["$x70!23\n" => "$x70!23\n"],