Change 18493 by jhi@lyta on 2003/01/16 20:03:01

        Subject: Update for ext/MIME/Base64/
        From: Gisle Aas <[EMAIL PROTECTED]>
        Date: 30 Dec 2002 07:34:34 -0800
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/ext/MIME/Base64/Base64.pm#4 edit
... //depot/perl/ext/MIME/Base64/Changes#2 edit
... //depot/perl/ext/MIME/Base64/QuotedPrint.pm#11 edit
... //depot/perl/ext/MIME/Base64/t/quoted-print.t#3 edit
... //depot/perl/ext/MIME/Base64/t/unicode.t#2 edit

Differences ...

==== //depot/perl/ext/MIME/Base64/Base64.pm#4 (text) ====
Index: perl/ext/MIME/Base64/Base64.pm
--- perl/ext/MIME/Base64/Base64.pm#3~17368~     Wed Jun 26 19:39:13 2002
+++ perl/ext/MIME/Base64/Base64.pm      Thu Jan 16 12:03:01 2003
@@ -1,5 +1,5 @@
 #
-# $Id: Base64.pm,v 2.16 2001/02/24 06:28:10 gisle Exp $
+# $Id: Base64.pm,v 2.19 2002/12/28 06:32:37 gisle Exp $
 
 package MIME::Base64;
 
@@ -135,7 +135,7 @@
 @ISA = qw(Exporter DynaLoader);
 @EXPORT = qw(encode_base64 decode_base64);
 
-$VERSION = '2.12';
+$VERSION = '2.13';
 
 eval { bootstrap MIME::Base64 $VERSION; };
 if ($@) {
@@ -155,12 +155,13 @@
 
 sub old_encode_base64 ($;$)
 {
-    my $res = "";
     my $eol = $_[1];
     $eol = "\n" unless defined $eol;
-    pos($_[0]) = 0;                          # ensure start at the beginning
 
-    $res = join '', map( pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs));
+    my $res = pack("u", $_[0]);
+    # Remove first character of each line, remove newlines
+    $res =~ s/^.//mg;
+    $res =~ s/\n//g;
 
     $res =~ tr|` -_|AA-Za-z0-9+/|;               # `# help emacs
     # fix padding at the end
@@ -187,8 +188,22 @@
     $str =~ s/=+$//;                        # remove padding
     $str =~ tr|A-Za-z0-9+/| -_|;            # convert to uuencoded format
 
-    return join'', map( unpack("u", chr(32 + length($_)*3/4) . $_),
-                       $str =~ /(.{1,60})/gs);
+    ## I guess this could be written as
+    #return unpack("u", join('', map( chr(32 + length($_)*3/4) . $_,
+    #                  $str =~ /(.{1,60})/gs) ) );
+    ## but I do not like that...
+    my $uustr = '';
+    my ($i, $l);
+    $l = length($str) - 60;
+    for ($i = 0; $i <= $l; $i += 60) {
+       $uustr .= "M" . substr($str, $i, 60);
+    }
+    $str = substr($str, $i);
+    # and any leftover chars
+    if ($str ne "") {
+       $uustr .= chr(32 + length($str)*3/4) . $str;
+    }
+    return unpack ("u", $uustr);
 }
 
 # Set up aliases so that these functions also can be called as

==== //depot/perl/ext/MIME/Base64/Changes#2 (text) ====
Index: perl/ext/MIME/Base64/Changes
--- perl/ext/MIME/Base64/Changes#1~9334~        Sat Mar 24 19:58:53 2001
+++ perl/ext/MIME/Base64/Changes        Thu Jan 16 12:03:01 2003
@@ -1,3 +1,19 @@
+2002-02-27   Gisle Aas <[EMAIL PROTECTED]>
+
+   Release 2.13
+
+   Sync up with bleadperl:
+       - Documentation update
+       - EBCDIC support
+       - Whitespace tweaks
+       - Improved Unicode support
+       - Test suite tweaks
+
+   Improved version of the old_{en,de}code_base64 functions
+   contributed by Paul Szabo <[EMAIL PROTECTED]>.
+
+
+
 2001-02-23   Gisle Aas <[EMAIL PROTECTED]>
 
    Release 2.12

==== //depot/perl/ext/MIME/Base64/QuotedPrint.pm#11 (text) ====
Index: perl/ext/MIME/Base64/QuotedPrint.pm
--- perl/ext/MIME/Base64/QuotedPrint.pm#10~17449~       Tue Jul  9 11:38:04 2002
+++ perl/ext/MIME/Base64/QuotedPrint.pm Thu Jan 16 12:03:01 2003
@@ -1,5 +1,5 @@
 #
-# $Id: QuotedPrint.pm,v 2.3 1997/12/02 10:24:27 aas Exp $
+# $Id: QuotedPrint.pm,v 2.4 2002/12/28 05:50:05 gisle Exp $
 
 package MIME::QuotedPrint;
 
@@ -74,13 +74,18 @@
 
 use Carp qw(croak);
 
-$VERSION = sprintf("%d.%02d", q$Revision: 2.3 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 2.4 $ =~ /(\d+)\.(\d+)/);
 
 sub encode_qp ($)
 {
     my $res = shift;
-    croak("The Quoted-Printable encoding is only defined for bytes")
-       if $res =~ /[^\0-\xFF]/;
+    if ($] >= 5.006) {
+       require bytes;
+       if (bytes::length($res) > length($res) ||
+           ($] >= 5.008 && $res =~ /[^\0-\xFF]/)) {
+           croak("The Quoted-Printable encoding is only defined for bytes");
+       }
+    }
 
     # Do not mention ranges such as $res =~ s/([^ \t\n!-<>-~])/sprintf("=%02X", 
ord($1))/eg;
     # since that will not even compile on an EBCDIC machine (where ord('!') > 
ord('<')).

==== //depot/perl/ext/MIME/Base64/t/quoted-print.t#3 (text) ====
Index: perl/ext/MIME/Base64/t/quoted-print.t
--- perl/ext/MIME/Base64/t/quoted-print.t#2~17429~      Mon Jul  8 17:17:49 2002
+++ perl/ext/MIME/Base64/t/quoted-print.t       Thu Jan 16 12:03:01 2003
@@ -1,6 +1,8 @@
 BEGIN {
-        chdir 't' if -d 't';
-        @INC = '../lib';
+        if ($ENV{PERL_CORE}) {
+                chdir 't' if -d 't';
+                @INC = '../lib';
+        }
 }
 
 use MIME::QuotedPrint;
@@ -111,5 +113,5 @@
                                 "foo\r\n\r\nfoo \r\nfoo \r\n\r\n";
 $testno++; print "ok $testno\n";
 
-print "not " if eval { encode_qp("XXX \x{100}") } || $@ !~ /^The Quoted-Printable 
encoding is only defined for bytes/;
+print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || $@ !~ /^The 
+Quoted-Printable encoding is only defined for bytes/);
 $testno++; print "ok $testno\n";

==== //depot/perl/ext/MIME/Base64/t/unicode.t#2 (text) ====
Index: perl/ext/MIME/Base64/t/unicode.t
--- perl/ext/MIME/Base64/t/unicode.t#1~10676~   Sun Jun 17 21:17:15 2001
+++ perl/ext/MIME/Base64/t/unicode.t    Thu Jan 16 12:03:01 2003
@@ -1,6 +1,12 @@
 BEGIN {
-        chdir 't' if -d 't';
-        @INC = '../lib';
+       unless ($] >= 5.006) {
+               print "1..0\n";
+               exit(0);
+       }
+        if ($ENV{PERL_CORE}) {
+                chdir 't' if -d 't';
+                @INC = '../lib';
+        }
 }
 
 print "1..1\n";
End of Patch.

Reply via email to