Skip to content

Commit 7ba8c20

Browse files
authored
Merge pull request #14 from khwilliamson/mime
MIME-Base64: Rmv EBCDIC-dependent code
2 parents e28a691 + f4ed665 commit 7ba8c20

File tree

5 files changed

+155
-279
lines changed

5 files changed

+155
-279
lines changed

Base64.xs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ static const unsigned char index_64[256] = {
7777
# define SvPVbyte SvPV
7878
#endif
7979

80-
#ifndef isXDIGIT
81-
# define isXDIGIT isxdigit
82-
#endif
83-
8480
#ifndef NATIVE_TO_ASCII
8581
# define NATIVE_TO_ASCII(ch) (ch)
8682
#endif
@@ -301,11 +297,7 @@ decoded_base64_length(sv)
301297

302298
MODULE = MIME::Base64 PACKAGE = MIME::QuotedPrint
303299

304-
#ifdef EBCDIC
305-
#define qp_isplain(c) ((c) == '\t' || ((!isprint(c) && (c) != '=')))
306-
#else
307-
#define qp_isplain(c) ((c) == '\t' || (((c) >= ' ' && (c) <= '~') && (c) != '='))
308-
#endif
300+
#define qp_isplain(c) ((c) == '\t' || (isPRINT(c) && (c) != '='))
309301

310302
SV*
311303
encode_qp(sv,...)

t/base64.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ BEGIN {
1818
if (ord('A') == 0x41) {
1919
*ASCII = sub { return $_[0] };
2020
}
21-
else {
21+
else { # Translating to ASCII has the effect of showing that this test file
22+
# verifies that arbitrary binary input acts the same on both
23+
# platforms.
2224
require Encode;
23-
*ASCII = sub { Encode::encode('ascii',$_[0]) };
25+
*ASCII = sub { return Encode::encode('ascii',$_[0]); };
2426
}
2527
}
2628

t/base64url.t

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
use strict;
44
use warnings;
5-
use Test qw(plan ok);
5+
use Test qw(plan ok skip);
66

77
use MIME::Base64 qw(encode_base64url decode_base64url);
88

99
my @tests;
10+
1011
while (<DATA>) {
1112
next if /^#/;
1213
chomp;
@@ -18,8 +19,8 @@ plan tests => 2 * @tests;
1819
for (@tests) {
1920
my($name, $input, $output) = @$_;
2021
print "# $name\n";
21-
ok(decode_base64url($input), $output);
22-
ok(encode_base64url($output), $input);
22+
skip(ord("A") != 65 ? "ASCII-centric test" : 0, decode_base64url($input), $output);
23+
skip(ord("A") != 65 ? "ASCII-centric test" : 0, encode_base64url($output), $input);
2324
}
2425

2526
__END__

0 commit comments

Comments
 (0)