Permalink
Browse files

Use void type for crc routines' data buffer argument.

  • Loading branch information...
1 parent 91e5ee4 commit 7a686cb1afa6ceef19867059d99bd81885133f10 @madler committed Oct 23, 2016
Showing with 10 additions and 9 deletions.
  1. +7 −6 crc.c
  2. +3 −3 crc.h
View
@@ -6,9 +6,9 @@
#include <stddef.h>
#include "crc.h"
-word_t crc_bitwise(model_t *model, word_t crc,
- unsigned char const *buf, size_t len)
+word_t crc_bitwise(model_t *model, word_t crc, void const *dat, size_t len)
{
+ unsigned char const *buf = dat;
word_t poly = model->poly;
/* if requested, return the initial CRC */
@@ -97,9 +97,10 @@ void crc_table_bytewise(model_t *model)
} while (++k);
}
-word_t crc_bytewise(model_t *model, word_t crc,
- unsigned char const *buf, size_t len)
+word_t crc_bytewise(model_t *model, word_t crc, void const *dat, size_t len)
{
+ unsigned char const *buf = dat;
+
/* if requested, return the initial CRC */
if (buf == NULL)
return model->init;
@@ -187,9 +188,9 @@ void crc_table_wordwise(model_t *model)
}
}
-word_t crc_wordwise(model_t *model, word_t crc,
- unsigned char const *buf, size_t len)
+word_t crc_wordwise(model_t *model, word_t crc, void const *dat, size_t len)
{
+ unsigned char const *buf = dat;
unsigned little, top, shift;
/* if requested, return the initial CRC */
View
@@ -27,7 +27,7 @@
The final value of crc is the CRC of the chunks in sequence. The first call
of crc_bitwise() gets the initial CRC value for this model.
*/
-word_t crc_bitwise(model_t *, word_t, unsigned char const *, size_t);
+word_t crc_bitwise(model_t *, word_t, void const *, size_t);
/* Fill in the 256-entry table in model with the CRC of the bytes 0..255, for a
byte-wise calculation of the given CRC model. The table value is the
@@ -40,7 +40,7 @@ void crc_table_bytewise(model_t *);
/* Equivalent to crc_bitwise(), but use a faster byte-wise table-based
approach. This assumes that model->table_byte has been initialized using
crc_table_bytewise(). */
-word_t crc_bytewise(model_t *, word_t, unsigned char const *, size_t);
+word_t crc_bytewise(model_t *, word_t, void const *, size_t);
/* Fill in the tables for a word-wise CRC calculation. This also fills in the
byte-wise table since that is needed for the word-wise calculation.
@@ -60,6 +60,6 @@ void crc_table_wordwise(model_t *);
/* Equivalent to crc_bitwise(), but use an even faster word-wise table-based
approach. This assumes that model->table_byte and model->table_word have
been initialized using crc_table_wordwise(). */
-word_t crc_wordwise(model_t *, word_t, unsigned char const *, size_t);
+word_t crc_wordwise(model_t *, word_t, void const *, size_t);
#endif

0 comments on commit 7a686cb

Please sign in to comment.