develooper Front page | perl.perl5.porters | Postings from May 2003

[PATCH] Sync up MIME-Base64 to latest on CPAN

Thread Next
From:
Gisle Aas
Date:
May 13, 2003 10:00
Subject:
[PATCH] Sync up MIME-Base64 to latest on CPAN
Message ID:
lru1byzss9.fsf@caliper.activestate.com
The following patch should bring MIME-Base64 in bleadperl up to date
with the CPAN version of the package.

Regards,
Gisle

diff -ru ext/MIME/Base64/Base64.pm /home/gisle/p/base64/Base64.pm
--- ext/MIME/Base64/Base64.pm	Mon Feb  3 01:40:22 2003
+++ /home/gisle/p/base64/Base64.pm	Tue May 13 09:21:25 2003
@@ -1,5 +1,5 @@
 #
-# $Id: Base64.pm,v 2.25 2003/01/05 08:01:33 gisle Exp $
+# $Id: Base64.pm,v 2.28 2003/05/13 16:21:25 gisle Exp $
 
 package MIME::Base64;
 
@@ -137,7 +137,7 @@
 @ISA = qw(Exporter DynaLoader);
 @EXPORT = qw(encode_base64 decode_base64);
 
-$VERSION = '2.16';
+$VERSION = '2.19';
 
 eval { bootstrap MIME::Base64 $VERSION; };
 if ($@) {
diff -ru ext/MIME/Base64/Base64.xs /home/gisle/p/base64/Base64.xs
--- ext/MIME/Base64/Base64.xs	Sat Feb 15 01:27:37 2003
+++ /home/gisle/p/base64/Base64.xs	Tue May 13 09:21:25 2003
@@ -1,4 +1,4 @@
-/* $Id: Base64.xs,v 1.32 2003/01/05 07:49:07 gisle Exp $
+/* $Id: Base64.xs,v 1.36 2003/05/13 16:21:25 gisle Exp $
 
 Copyright 1997-2003 Gisle Aas
 
@@ -46,6 +46,13 @@
    #define PL_dowarn dowarn
 #endif
 
+#ifdef G_WARN_ON
+   #define DOWARN (PL_dowarn & G_WARN_ON)
+#else
+   #define DOWARN PL_dowarn
+#endif
+
+
 #define MAX_LINE  76 /* size of encoded lines */
 
 static char basis_64[] =
@@ -209,7 +216,7 @@
 
 		if (str == end) {
 		    if (i < 4) {
-			if (i && PL_dowarn)
+			if (i && DOWARN)
 			    warn("Premature end of base64 data");
 			if (i < 2) goto thats_it;
 			if (i == 2) c[2] = EQ;
@@ -220,7 +227,7 @@
             } while (i < 4);
 	
 	    if (c[0] == EQ || c[1] == EQ) {
-		if (PL_dowarn) warn("Premature padding of base64 data");
+		if (DOWARN) warn("Premature padding of base64 data");
 		break;
             }
 	    /* printf("c0=%d,c1=%d,c2=%d,c3=%d\n", c[0],c[1],c[2],c[3]);*/
@@ -324,7 +331,7 @@
 		}
 	    }
 
-	    if (*p == '\n') {
+	    if (*p == '\n' && eol_len) {
 	        sv_catpvn(RETVAL, eol, eol_len);
 	        p++;
 		linelen = 0;
@@ -410,6 +417,11 @@
                 }
 	    }
 	}
+	if (whitespace) {
+	    while (whitespace < str) {
+		*r++ = *whitespace++;
+	    }
+        }
 	*r = '\0';
 	SvCUR_set(RETVAL, r - SvPVX(RETVAL));
 
diff -ru ext/MIME/Base64/Changes /home/gisle/p/base64/Changes
--- ext/MIME/Base64/Changes	Mon Feb  3 01:40:22 2003
+++ /home/gisle/p/base64/Changes	Tue May 13 09:33:58 2003
@@ -1,3 +1,40 @@
+2003-05-13   Gisle Aas <gisle@ActiveState.com>
+
+   Release 2.19
+
+   decode_qp() did eat up all trailing whitespace in the string decoded.
+   Only whitespace in front of "\n" should go.
+
+   Win32 fix for t/warn.t by Reini Urban <rurban@x-ray.at>.
+
+
+
+2003-03-09   Gisle Aas <gisle@ActiveState.com>
+
+   Release 2.18
+
+   Fix up INSTALLDIRS for perl-5.8 and newer.
+
+
+
+2003-03-09   Gisle Aas <gisle@ActiveState.com>
+
+   Release 2.17
+
+   Make it reliable to disable base64 decoding warnings by
+   resetting $^W in recent perls.  Would really like to be
+   able to do real lexical warnings but the current mechanism
+   does not seems suitable for XS code.
+
+   Passing "" as $eol to encode_qp() disable soft line
+   breaks as well.
+
+   Sync up with changes in bleadperl:
+       - safer patchlevel.h include
+       - bad cast
+
+
+
 2003-01-05   Gisle Aas <gisle@ActiveState.com>
 
    Release 2.16
diff -ru ext/MIME/Base64/QuotedPrint.pm /home/gisle/p/base64/QuotedPrint.pm
--- ext/MIME/Base64/QuotedPrint.pm	Mon Feb  3 01:40:22 2003
+++ /home/gisle/p/base64/QuotedPrint.pm	Tue May 13 09:21:25 2003
@@ -1,5 +1,5 @@
 #
-# $Id: QuotedPrint.pm,v 2.11 2003/01/05 08:01:33 gisle Exp $
+# $Id: QuotedPrint.pm,v 2.12 2003/05/13 16:21:25 gisle Exp $
 
 package MIME::QuotedPrint;
 
@@ -73,7 +73,7 @@
 
 use Carp qw(croak);
 
-$VERSION = "2.16";
+$VERSION = "2.19";
 
 use MIME::Base64;  # try to load XS version of encode_qp
 unless (defined &encode_qp) {
diff -ru ext/MIME/Base64/t/quoted-print.t /home/gisle/p/base64/t/quoted-print.t
--- ext/MIME/Base64/t/quoted-print.t	Mon Feb  3 01:40:22 2003
+++ /home/gisle/p/base64/t/quoted-print.t	Tue May 13 09:19:04 2003
@@ -85,9 +85,13 @@
    # some extra special cases we have had problems with
    ["$x70!2=x=x" => "$x70!2=3D=\nx=3Dx"],
    ["$x70!2345$x70!2345$x70!23456\n", "$x70!2345=\n$x70!2345=\n$x70!23456\n"],
+
+   # trailing whitespace
+   ["foo \t ", "foo=20=09=20"],
+   ["foo\t \n \t", "foo=09=20\n=20=09"],
 );
 
-$notests = @tests + 3;
+$notests = @tests + 7;
 print "1..$notests\n";
 
 $testno = 0;
@@ -127,5 +131,20 @@
                                 "foo\n\nfoo \nfoo \n\n";
 $testno++; print "ok $testno\n";
 
+# Trailing whitespace
+print "not " unless decode_qp("foo  ") eq "foo  ";
+$testno++; print "ok $testno\n";
+
+print "not " unless decode_qp("foo  \n") eq "foo\n";
+$testno++; print "ok $testno\n";
+
+# Test with with alternative line break
+print "not " unless encode_qp("$x70!2345$x70\n", "***") eq "$x70!2345=***$x70***";
+$testno++; print "ok $testno\n";
+
+# Test with no line breaks
+print "not " unless encode_qp("$x70!2345$x70\n", "") eq "$x70!2345$x70=0A";
+$testno++; print "ok $testno\n";
+
 print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || !$@);
 $testno++; print "ok $testno\n";


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About