[master] 4a5ec60 failing crc32 checks on macos + clang - casting the culprit?

Nils Goroll nils.goroll at uplex.de
Mon Sep 12 20:30:22 CEST 2016


commit 4a5ec60af1ff1a0ec81b7c255f5d9ca01299b1be
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Sep 12 20:28:58 2016 +0200

    failing crc32 checks on macos + clang - casting the culprit?

diff --git a/lib/libvmod_directors/crc32.c b/lib/libvmod_directors/crc32.c
index 714b0f0..44a5250 100644
--- a/lib/libvmod_directors/crc32.c
+++ b/lib/libvmod_directors/crc32.c
@@ -83,17 +83,15 @@ static const uint32_t crc32bits[] = {
 };
 
 uint32_t
-crc32(uint32_t crc, const void *p1, unsigned l)
+crc32(uint32_t crc, const unsigned char *p, unsigned l)
 {
-	const unsigned char *p;
-
-	for (p = (const unsigned char*)p1; l-- > 0; p++)
+	for (; l-- > 0; p++)
 		crc = (crc >> 8) ^ crc32bits[(crc ^ *p) & 0xff];
 	return (crc);
 }
 
 uint32_t
-crc32_l(const void *p1, unsigned l)
+crc32_l(const unsigned char *p1, unsigned l)
 {
 	uint32_t crc;
 
diff --git a/lib/libvmod_directors/crc32.h b/lib/libvmod_directors/crc32.h
index 39adf8a..dfe56ab 100644
--- a/lib/libvmod_directors/crc32.h
+++ b/lib/libvmod_directors/crc32.h
@@ -1,3 +1,3 @@
 #include <stdint.h>
-uint32_t crc32(uint32_t crc, const void *p1, unsigned l);
-uint32_t crc32_l(const void *p1, unsigned l);
+uint32_t crc32(uint32_t crc, const unsigned char *, unsigned);
+uint32_t crc32_l(const unsigned char *, unsigned);



More information about the varnish-commit mailing list