Doh! I typed memcpy when I really wanted memset.
This does not actually introduce any new dependencies. Evergreen
updates/installation already requires bzip2. If bzip2 is present,
then libbz2 is present. We don't need libbz2 headers, just the
library itself for a single data structure used in crc32 calculation.
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
AC_PROG_RANLIB
# Checks for libraries.
+AC_CHECK_LIB([bz2],[BZ2_bzCompressInit],,AC_MSG_ERROR(*** OpenILS requires libbz2))
# Checks for header files.
AC_CHECK_HEADERS([err.h fcntl.h netinet/in.h stdint.h stdio.h stdlib.h string.h sys/stat.h sys/types.h unistd.h])
memcpy(header + 12, &outVal, 4);
outVal = htonl(newsize);
memcpy(header + 16, &outVal, 4);
- memcpy(header + 20, 0, 12);
+ memset(header + 20, 0, 12);
if (fwrite(header, 32, 1, pf) != 1)
err(1, "fwrite(%s)", argv[3]);
#include <stdint.h>
/* This guy lives in libbz2, and is the only reason we need libbz2. */
- extern uint32_t BZ2_crc32Table[256];
+extern uint32_t BZ2_crc32Table[256];
uint32_t
crc32(const unsigned char *buf, uint32_t len)
const unsigned char *end = buf + len;
for (; buf != end; ++buf)
- crc = (crc << 8) ^ crc32Table[(crc >> 24) ^ *buf];
+ crc = (crc << 8) ^ BZ2_crc32Table[(crc >> 24) ^ *buf];
crc = ~crc;
return crc;