Upgrade to Digest::MD5 2.18. files.t doesn't

work yet with blead, my bad.

p4raw-id: //depot/perl@16321
This commit is contained in:
Jarkko Hietaniemi 2002-05-01 23:11:54 +00:00
parent 90f50fa0ea
commit 5a0465204a
7 changed files with 93 additions and 53 deletions

View File

@ -169,10 +169,10 @@ ext/Digest/MD5/hints/irix_6.pl Hints for named architecture
ext/Digest/MD5/Makefile.PL Digest::MD5 extension makefile writer
ext/Digest/MD5/MD5.pm Digest::MD5 extension
ext/Digest/MD5/MD5.xs Digest::MD5 extension
ext/Digest/MD5/t/aaa.t See if Digest::MD5 extension works
ext/Digest/MD5/t/align.t See if Digest::MD5 extension works
ext/Digest/MD5/t/badfile.t See if Digest::MD5 extension works
ext/Digest/MD5/t/files.t See if Digest::MD5 extension works
ext/Digest/MD5/t/md5-aaa.t See if Digest::MD5 extension works
ext/Digest/MD5/typemap Digest::MD5 extension
ext/DynaLoader/dlutils.c Dynamic loader utilities for dl_*.xs files
ext/DynaLoader/dl_aix.xs AIX implementation

View File

@ -1,3 +1,27 @@
2002-05-01 Gisle Aas <gisle@ActiveState.com>
Release 2.18
Changes #12954 and #16173 from bleadperl. Documentation typo fix
and some signed/unsigned mismatches that Microsoft's C compiler
complained about.
The EBCDIC-aware md5-aaa.t from bleadperl.
2002-04-25 Gisle Aas <gisle@ActiveState.com>
Release 2.17
The SvPVbyte in perl-5.6.1 is buggy. Use the one from 5.7.3
instead.
Give warning if the function interface is used as instance
methods: $md5->md5_hex().
2001-09-07 Gisle Aas <gisle@ActiveState.com>
Release 2.16

View File

@ -3,7 +3,7 @@ package Digest::MD5;
use strict;
use vars qw($VERSION @ISA @EXPORT_OK);
$VERSION = '2.16'; # $Date: 2001/09/07 05:45:14 $
$VERSION = '2.18'; # $Date: 2002/05/01 23:30:28 $
require Exporter;
*import = \&Exporter::import;
@ -230,7 +230,7 @@ RFC 1321
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Copyright 1998-2001 Gisle Aas.
Copyright 1998-2002 Gisle Aas.
Copyright 1995-1996 Neil Winton.
Copyright 1991-1992 RSA Data Security, Inc.

View File

@ -1,3 +1,5 @@
/* $Id: MD5.xs,v 1.34 2002/05/01 23:30:28 gisle Exp $ */
/*
* This library is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
@ -42,7 +44,27 @@ extern "C" {
}
#endif
#ifndef SvPVbyte
#include "patchlevel.h"
#if PATCHLEVEL <= 4 && !defined(PL_dowarn)
#define PL_dowarn dowarn
#endif
#ifdef SvPVbyte
#if PERL_REVISION == 5 && PERL_VERSION < 7
/* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */
#undef SvPVbyte
#define SvPVbyte(sv, lp) \
((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
static char *
my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
{
sv_utf8_downgrade(sv,0);
return SvPV(sv,*lp);
}
#endif
#else
#define SvPVbyte SvPV
#endif
@ -619,14 +641,31 @@ md5(...)
unsigned char digeststr[16];
PPCODE:
MD5Init(&ctx);
if (PL_dowarn && items > 1) {
data = (unsigned char *)SvPVbyte(ST(0), len);
if (len == 11 && memEQ("Digest::MD5", data, 11)) {
char *f = (ix == F_BIN) ? "md5" :
(ix == F_HEX) ? "md5_hex" : "md5_base64";
warn("&Digest::MD5::%s function probably called as method", f);
}
if (PL_dowarn) {
char *msg = 0;
if (items == 1) {
if (SvROK(ST(0))) {
SV* sv = SvRV(ST(0));
if (SvOBJECT(sv) && strEQ(HvNAME(SvSTASH(sv)), "Digest::MD5"))
msg = "probably called as method";
else
msg = "called with reference argument";
}
}
else if (items > 1) {
data = (unsigned char *)SvPVbyte(ST(0), len);
if (len == 11 && memEQ("Digest::MD5", data, 11)) {
msg = "probably called as class method";
}
}
if (msg) {
char *f = (ix == F_BIN) ? "md5" :
(ix == F_HEX) ? "md5_hex" : "md5_base64";
warn("&Digest::MD5::%s function %s", f, msg);
}
}
for (i = 0; i < items; i++) {
data = (unsigned char *)(SvPVbyte(ST(i), len));
MD5Update(&ctx, data, len);

View File

@ -1,8 +1,3 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
# Digest::MD5 2.07 and older used to trigger a core dump when
# passed an illegal file handle that failed to open.

View File

@ -1,51 +1,35 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
print "1..2\n";
print "1..5\n";
use strict;
use Digest::MD5 qw(md5 md5_hex md5_base64);
#
# This is the output of: 'md5sum MD5.pm MD5.xs'
# This is the output of: 'md5sum Changes README MD5.pm MD5.xs rfc1321.txt'
#
my $EXPECT;
my $EXPECT = <<EOT;
23cafa2de11474f0df8f808cc588bcc9 Changes
3519f3d02c7c91158f732f0f00064657 README
0268931475ae2a2e843ff58504cfa3f0 MD5.pm
1be293491bba726810f8e87671ee0328 MD5.xs
754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
EOT
if (ord('A') == 193) { # EBCDIC
$EXPECT = <<EOT;
ee6a09094632cd610199278bbb0f910e ext/Digest/MD5/MD5.pm
94f873d905cd20a12d8ef4cdbdbcd89f ext/Digest/MD5/MD5.xs
EOT
} else { # ASCII
$EXPECT = <<EOT;
665ddc08b12d6b1bf85ac6dc5aae68b3 ext/Digest/MD5/MD5.pm
5f21e907b2e7dbffe6aba2c762ea93d0 ext/Digest/MD5/MD5.xs
EOT
if (!(-f "README") && -f "../README") {
chdir("..") or die "Can't chdir: $!";
}
my $testno = 0;
my $B64 = 1;
eval { require MIME::Base64; };
if ($@) {
print $@;
print "# Will not test base64 methods\n";
print "Will not test base64 methods\n";
$B64 = 0;
}
my $testno = 0;
use File::Spec;
for (split /^/, $EXPECT) {
my($md5hex, $file) = split ' ';
my @path = split(m:/:, $file);
my $last = pop @path;
my $path = File::Spec->updir;
while (@path) {
$path = File::Spec->catdir($path, shift @path);
}
$file = File::Spec->catfile($path, $last);
my $md5bin = pack("H*", $md5hex);
my $md5b64;
if ($B64) {
@ -126,9 +110,7 @@ sub digest_file
#print "$file $method\n";
open(FILE, $file) or die "Can't open $file: $!";
# Digests above are generated on UNIX without CRLF
# so leave handles in text mode
# binmode(FILE);
binmode(FILE);
my $digest = Digest::MD5->new->addfile(*FILE)->$method();
close(FILE);
@ -140,9 +122,7 @@ sub cat_file
my($file) = @_;
local $/; # slurp
open(FILE, $file) or die "Can't open $file: $!";
# Digests above are generated on UNIX without CRLF
# so leave handles in text mode
# binmode(FILE);
binmode(FILE);
my $tmp = <FILE>;
close(FILE);
$tmp;

View File

@ -1,6 +1,8 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
}
}
use strict;