'MIME::Base64' =>
{
'MAINTAINER' => 'gaas',
- 'DISTRIBUTION' => 'GAAS/MIME-Base64-3.08.tar.gz',
+ 'DISTRIBUTION' => 'GAAS/MIME-Base64-3.09.tar.gz',
'FILES' => q[cpan/MIME-Base64],
'EXCLUDED' => [ qw{ t/bad-sv.t }, ],
'CPAN' => 1,
- 'UPSTREAM' => undef,
+ 'UPSTREAM' => 'cpan',
},
'Module::Build' =>
@ISA = qw(Exporter);
@EXPORT = qw(encode_base64 decode_base64);
-$VERSION = '3.08';
+$VERSION = '3.09';
require XSLoader;
XSLoader::load('MIME::Base64', $VERSION);
-/* $Id$
+/*
Copyright 1997-2004 Gisle Aas
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 */
/* 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;
}
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++;
}
PROTOTYPE: $;$$
PREINIT:
- char *eol;
+ const char *eol;
STRLEN eol_len;
int binary;
STRLEN sv_len;
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;
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;
+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
@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()
["$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"],
["$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"],
["$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"],