freebsd-ports/devel/a2dev/files/patch-util_hash.c
Martin Wilke cd06a37022 - Unbreak
- Fix build with gcc 4.2
- pet portlint

PR:		117648 (based on)
Submitted by:	Pietro Cerutti <gahr@gahr.ch>
2007-10-30 10:54:00 +00:00

17 lines
453 B
C

--- util/hash.c.orig 2007-10-30 11:34:44.000000000 +0100
+++ util/hash.c 2007-10-30 11:39:58.000000000 +0100
@@ -29,8 +29,12 @@
{
unsigned crc = CRC_INIT;
- while (length--)
- crc = table[(crc ^ *((unsigned char *) bytes)++) & 0xFF] ^ (crc >> 8);
+ unsigned char byte;
+ unsigned len = 0;
+ for(len=0; len<length; len++){
+ byte = ((unsigned char *)bytes)[len];
+ crc = table[(crc ^ byte) & 0xFF] ^ (crc >> 8);
+ }
return(crc ^ CRC_FINAL);
}