summaryrefslogtreecommitdiff
path: root/ext/Digest/MD5
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-07-07 14:08:16 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-07 14:08:16 +0000
commit263df5f176be8146ec259953e28e2b87bb448e1d (patch)
tree902608c9ffb05dee8d60f8e01a458e2ba91e93ea /ext/Digest/MD5
parentef3aad6271d16a39465a0b656ec0882569b532cb (diff)
downloadperl-263df5f176be8146ec259953e28e2b87bb448e1d.tar.gz
Retract #20056, #20055, #20052, #20050, #20048: the changes
are just breaking more than they are fixing. p4raw-id: //depot/perl@20057
Diffstat (limited to 'ext/Digest/MD5')
-rw-r--r--ext/Digest/MD5/MD5.xs9
-rw-r--r--ext/Digest/MD5/t/badfile.t9
-rw-r--r--ext/Digest/MD5/t/files.t6
3 files changed, 8 insertions, 16 deletions
diff --git a/ext/Digest/MD5/MD5.xs b/ext/Digest/MD5/MD5.xs
index 9b607538ad..0bf05f0c57 100644
--- a/ext/Digest/MD5/MD5.xs
+++ b/ext/Digest/MD5/MD5.xs
@@ -621,7 +621,7 @@ addfile(self, fh)
MD5_CTX* context = get_md5_ctx(self);
STRLEN fill = context->bytes_low & 0x3F;
unsigned char buffer[4096];
- SSize_t n;
+ int n;
CODE:
if (fh) {
if (fill) {
@@ -630,19 +630,18 @@ addfile(self, fh)
* first.
*/
STRLEN missing = 64 - fill;
- n = PerlIO_read(fh, buffer, missing);
- if (n >= 0)
+ if ( (n = PerlIO_read(fh, buffer, missing)))
MD5Update(context, buffer, n);
else
XSRETURN(1); /* self */
}
/* Process blocks until EOF or error */
- while ( (n = PerlIO_read(fh, buffer, sizeof(buffer))) > 0 ) {
+ while ( (n = PerlIO_read(fh, buffer, sizeof(buffer)))) {
MD5Update(context, buffer, n);
}
- if (n < 0 && PerlIO_error(fh)) {
+ if (PerlIO_error(fh)) {
croak("Reading from filehandle failed");
}
}
diff --git a/ext/Digest/MD5/t/badfile.t b/ext/Digest/MD5/t/badfile.t
index 2292341b8f..32fc6fef7c 100644
--- a/ext/Digest/MD5/t/badfile.t
+++ b/ext/Digest/MD5/t/badfile.t
@@ -4,7 +4,6 @@
print "1..3\n";
use Digest::MD5 ();
-use Config;
$md5 = Digest::MD5->new;
@@ -22,17 +21,11 @@ eval {
print "not " unless $@ =~ /^No filehandle passed at/;
print "ok 2\n";
-# Some stdio implementations don't gripe about reading from write-only
-# filehandles, so if we are using stdio (which means either pre-perlio
-# Perl, or perlio-Perl configured to have no perlio), we can't expect
-# to get the right error.
-my $stdio = !exists $Config{useperlio} || !defined $Config{useperlio};
-
open(BAR, ">no-existing-file.$$") || die;
eval {
$md5->addfile(*BAR);
};
-print "not " unless $@ =~ /^Reading from filehandle failed at/ || $stdio;
+print "not " unless $@ =~ /^Reading from filehandle failed at/;
print "ok 3\n";
close(BAR);
diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t
index 08cd51b0b3..f28e0df845 100644
--- a/ext/Digest/MD5/t/files.t
+++ b/ext/Digest/MD5/t/files.t
@@ -23,7 +23,7 @@ if (ord "A" == 193) { # EBCDIC
fcc48d6bb88ca8065bf9ddfcb9e7483e Changes
0565ec21b15c0f23f4c51fb327c8926d README
1965beb0e48253b694220fbb5d6230f5 MD5.pm
-339e7a6915dcd67ff5bb583a7568fbb6 MD5.xs
+5b3c24da3f70f3c0938cc7c205a28ab7 MD5.xs
276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt
EOT
} elsif ("\n" eq "\015") { # MacOS
@@ -31,7 +31,7 @@ EOT
f161f474603c54a0093ad2f6f93be33b Changes
6c950a0211a5a28f023bb482037698cd README
18178c90bc13d6824f6c96973b6e9433 MD5.pm
-1f004206b000efac36e9890aac6f0281 MD5.xs
+2c7fdb2ffa3840dc4f8dcdcf13241015 MD5.xs
754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
EOT
} else {
@@ -40,7 +40,7 @@ EOT
029fa5059ba0b2175cee09ab5d9b7b73 Changes
6c950a0211a5a28f023bb482037698cd README
18178c90bc13d6824f6c96973b6e9433 MD5.pm
-1f004206b000efac36e9890aac6f0281 MD5.xs
+2c7fdb2ffa3840dc4f8dcdcf13241015 MD5.xs
754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
EOT
}