From: Jarkko Hietaniemi Date: Wed, 1 May 2002 23:11:54 +0000 (+0000) Subject: Upgrade to Digest::MD5 2.18. files.t doesn't X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a0465204af83dac035ba461e6e2a04febe9287d;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Digest::MD5 2.18. files.t doesn't work yet with blead, my bad. p4raw-id: //depot/perl@16321 --- diff --git a/MANIFEST b/MANIFEST index 5c0e01f..7086e1d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -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 diff --git a/ext/Digest/MD5/Changes b/ext/Digest/MD5/Changes index 224e271..50de82f 100644 --- a/ext/Digest/MD5/Changes +++ b/ext/Digest/MD5/Changes @@ -1,3 +1,27 @@ +2002-05-01 Gisle Aas + + 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 + + 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 Release 2.16 diff --git a/ext/Digest/MD5/MD5.pm b/ext/Digest/MD5/MD5.pm index 8de2416..93e13e6 100644 --- a/ext/Digest/MD5/MD5.pm +++ b/ext/Digest/MD5/MD5.pm @@ -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. diff --git a/ext/Digest/MD5/MD5.xs b/ext/Digest/MD5/MD5.xs index 0852e52..4a30550 100644 --- a/ext/Digest/MD5/MD5.xs +++ b/ext/Digest/MD5/MD5.xs @@ -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); diff --git a/ext/Digest/MD5/t/badfile.t b/ext/Digest/MD5/t/badfile.t index 63effdf..d066d0d 100644 --- a/ext/Digest/MD5/t/badfile.t +++ b/ext/Digest/MD5/t/badfile.t @@ -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. diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t index 65ecb54..b1abe19 100644 --- a/ext/Digest/MD5/t/files.t +++ b/ext/Digest/MD5/t/files.t @@ -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; - -if (ord('A') == 193) { # EBCDIC -$EXPECT = <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 = ; close(FILE); $tmp; diff --git a/ext/Digest/MD5/t/aaa.t b/ext/Digest/MD5/t/md5-aaa.t similarity index 99% rename from ext/Digest/MD5/t/aaa.t rename to ext/Digest/MD5/t/md5-aaa.t index f3f3202..3069a06 100644 --- a/ext/Digest/MD5/t/aaa.t +++ b/ext/Digest/MD5/t/md5-aaa.t @@ -1,6 +1,8 @@ BEGIN { chdir 't' if -d 't'; - @INC = '../lib'; + if ($ENV{PERL_CORE}) { + @INC = '../lib'; + } } use strict;