X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hv.h;h=6a51ca40b2d570f21103a0d789a8492a6ff45518;hb=cebd85e6fca2f450b0cc02ffa6ad2fdfdf763f59;hp=4979fdd8b636b2da22b067ba3f9cda5d9e0d7c49;hpb=ceea138788c46b183220c4e9ce5aee45bb27dfa4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hv.h b/hv.h index 4979fdd..6a51ca4 100644 --- a/hv.h +++ b/hv.h @@ -1,6 +1,7 @@ /* hv.h * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, + * 2000, 2001, 2002, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -47,12 +48,19 @@ struct xpvhv { }; /* hash a key */ -/* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins */ -/* from requirements by Colin Plumb. */ -/* (http://burtleburtle.net/bob/hash/doobs.html) */ +/* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins + * from requirements by Colin Plumb. + * (http://burtleburtle.net/bob/hash/doobs.html) */ +/* The use of a temporary pointer and the casting games + * is needed to serve the dual purposes of + * (a) the hashed data being interpreted as "unsigned char" (new since 5.8, + * a "char" can be either signed or signed, depending on the compiler) + * (b) catering for old code that uses a "char" + */ #define PERL_HASH(hash,str,len) \ STMT_START { \ - register const unsigned char *s_PeRlHaSh = str; \ + register const char *s_PeRlHaSh_tmp = str; \ + register const unsigned char *s_PeRlHaSh = (const unsigned char *)s_PeRlHaSh_tmp; \ register I32 i_PeRlHaSh = len; \ register U32 hash_PeRlHaSh = 0; \ while (i_PeRlHaSh--) { \