Revert "Update to MIME-Base64 3.09"
Jesse Vincent [Wed, 3 Feb 2010 20:41:13 +0000 (12:41 -0800)]
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.

Porting/Maintainers.pl
cpan/MIME-Base64/Base64.pm
cpan/MIME-Base64/Base64.xs
cpan/MIME-Base64/Changes
cpan/MIME-Base64/QuotedPrint.pm
cpan/MIME-Base64/t/quoted-print.t

index b71c123..b9bc394 100755 (executable)
@@ -995,11 +995,11 @@ use File::Glob qw(:case);
     'MIME::Base64' =>
        {
        'MAINTAINER'    => 'gaas',
-       'DISTRIBUTION'  => 'GAAS/MIME-Base64-3.09.tar.gz',
+       'DISTRIBUTION'  => 'GAAS/MIME-Base64-3.08.tar.gz',
        'FILES'         => q[cpan/MIME-Base64],
        'EXCLUDED'      => [ qw{ t/bad-sv.t }, ],
        'CPAN'          => 1,
-       'UPSTREAM'      => 'cpan',
+       'UPSTREAM'      => undef,
        },
 
     'Module::Build' =>
index 2bcd585..6c076d1 100644 (file)
@@ -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);
index 279aad9..1740a16 100644 (file)
@@ -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;
index 595c8dc..4b60a89 100644 (file)
@@ -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
index ca3a042..aee13d6 100644 (file)
@@ -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()
 
index 73c2301..5bb8738 100644 (file)
@@ -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"],