summaryrefslogtreecommitdiff
path: root/devel/a2dev/files/patch-util_hash.c
blob: da60d94c2ac4bf28d2e7ff50c680f83d58f998f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- 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);
 }