[Pyukiwiki-cvs 0004123] CVS update: PyukiWiki-Devel/build

Back to archive index

PyukiWiki CVS Commit pyuki****@lists*****
2012年 1月 29日 (日) 06:57:59 JST


Index: PyukiWiki-Devel/build/b64decode.pl
diff -u PyukiWiki-Devel/build/b64decode.pl:1.2 PyukiWiki-Devel/build/b64decode.pl:1.3
--- PyukiWiki-Devel/build/b64decode.pl:1.2	Sun Jan 29 06:07:58 2012
+++ PyukiWiki-Devel/build/b64decode.pl	Sun Jan 29 06:57:59 2012
@@ -1,38 +1 @@
-$base64_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
-                   'abcdefghijklmnopqrstuvwxyz'.
-                   '0123456789+/';
-$base64_pad = '=';
-
-$uuencode_alphabet = q|`!"#$%&'()*+,-./0123456789:;<=>?|.
-                      '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'; # double that '\\'!
-$uuencode_pad = '`';
-
-
-sub b64decode
-{
-    local ($_) = @_;
-    local ($result);
-
-    # zap bad characters and translate others to uuencode alphabet
-    eval qq{
-	tr|$tr_base64||cd;
-	tr|$tr_base64|$tr_uuencode|;
-    };
-
-    # break into lines of 60 encoded chars, prepending "M" for uuencode,
-    # and then using perl's builtin uudecoder to convert to binary.
-    while (s/^(.{60})//) {
-	#warn "chunk :$&:\n";
-	$result .= unpack("u", "M" . $&);
-    }
-
-    # also decode any leftover chars
-    if ($_ ne "") {
-	#warn "last chunk :$_:\n";
-	$result .= unpack("u",
-		    substr($uuencode_alphabet, length($_)*3/4, 1) . $_);
-    }
-
-    # return result
-    $result;
-}
+while(<STDIN>){$i.=$_;}print &bd($i);sub bd{local($_)=@_;my $r;$a='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';$b=q|`!"#$%&'()*+,-./0123456789:;<=>?|.'@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_';($c=" ".$b)=~s/\\/\\\\/;$d="A".$a;eval qq{tr|$d||cd;tr|$d|$c|;};while(s/^(.{60})//){$r.=unpack("u","M".$&);}if($_ ne ""){$r.=unpack("u",substr($b,length($_)*3/4,1).$_);}$r;}



Pyukiwiki-cvs メーリングリストの案内
Back to archive index