summaryrefslogtreecommitdiffstats
path: root/src/H5checksum.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-04-07 18:25:39 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-04-07 18:25:39 (GMT)
commitdfc2a0993c076387d96f08e812e6eb9a84e4b778 (patch)
tree694520f115c6807d21b21096e89fc9e2b1742877 /src/H5checksum.c
parentb7dc1ef6f4c9e8a3e1dd4ee18f2dafcd763c21c1 (diff)
downloadhdf5-dfc2a0993c076387d96f08e812e6eb9a84e4b778.zip
hdf5-dfc2a0993c076387d96f08e812e6eb9a84e4b778.tar.gz
hdf5-dfc2a0993c076387d96f08e812e6eb9a84e4b778.tar.bz2
Brings H5module.h from develop and fixes Autotools badness
Diffstat (limited to 'src/H5checksum.c')
-rw-r--r--src/H5checksum.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/H5checksum.c b/src/H5checksum.c
index 7daf8b8..0cd7745 100644
--- a/src/H5checksum.c
+++ b/src/H5checksum.c
@@ -15,7 +15,7 @@
*
* Created: H5checksum.c
* Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Internal code for computing fletcher32 checksums
*
@@ -25,6 +25,7 @@
/****************/
/* Module Setup */
/****************/
+#include "H5module.h" /* This source code file is part of the H5 module */
/***********/
/* Headers */
@@ -141,7 +142,7 @@ H5_checksum_fletcher32(const void *_data, size_t _len)
} /* end H5_checksum_fletcher32() */
/*-------------------------------------------------------------------------
- * Function: H5_checksum_crc_make_table
+ * Function: H5__checksum_crc_make_table
*
* Purpose: Compute the CRC table for the CRC checksum algorithm
*
@@ -153,12 +154,12 @@ H5_checksum_fletcher32(const void *_data, size_t _len)
*-------------------------------------------------------------------------
*/
static void
-H5_checksum_crc_make_table(void)
+H5__checksum_crc_make_table(void)
{
uint32_t c; /* Checksum for each byte value */
unsigned n, k; /* Local index variables */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Compute the checksum for each possible byte value */
for (n = 0; n < 256; n++) {
@@ -173,10 +174,10 @@ H5_checksum_crc_make_table(void)
H5_crc_table_computed = TRUE;
FUNC_LEAVE_NOAPI_VOID
-} /* end H5_checksum_crc_make_table() */
+} /* end H5__checksum_crc_make_table() */
/*-------------------------------------------------------------------------
- * Function: H5_checksum_crc_make_table
+ * Function: H5__checksum_crc_update
*
* Purpose: Update a running CRC with the bytes buf[0..len-1]--the CRC
* should be initialized to all 1's, and the transmitted value
@@ -191,22 +192,22 @@ H5_checksum_crc_make_table(void)
*-------------------------------------------------------------------------
*/
static uint32_t
-H5_checksum_crc_update(uint32_t crc, const uint8_t *buf, size_t len)
+H5__checksum_crc_update(uint32_t crc, const uint8_t *buf, size_t len)
{
size_t n; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Initialize the CRC table if necessary */
if (!H5_crc_table_computed)
- H5_checksum_crc_make_table();
+ H5__checksum_crc_make_table();
/* Update the CRC with the results from this buffer */
for (n = 0; n < len; n++)
crc = H5_crc_table[(crc ^ buf[n]) & 0xff] ^ (crc >> 8);
FUNC_LEAVE_NOAPI(crc)
-} /* end H5_checksum_crc_update() */
+} /* end H5__checksum_crc_update() */
/*-------------------------------------------------------------------------
* Function: H5_checksum_crc
@@ -234,7 +235,8 @@ H5_checksum_crc(const void *_data, size_t len)
HDassert(_data);
HDassert(len > 0);
- FUNC_LEAVE_NOAPI(H5_checksum_crc_update((uint32_t)0xffffffffL, (const uint8_t *)_data, len) ^ 0xffffffffL)
+ FUNC_LEAVE_NOAPI(H5__checksum_crc_update((uint32_t)0xffffffffL, (const uint8_t *)_data, len) ^
+ 0xffffffffL)
} /* end H5_checksum_crc() */
/*
@@ -378,7 +380,7 @@ uint32_t
H5_checksum_lookup3(const void *key, size_t length, uint32_t initval)
{
const uint8_t *k = (const uint8_t *)key;
- uint32_t a, b, c; /* internal state */
+ uint32_t a, b, c = 0; /* internal state */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -413,36 +415,47 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval)
{
case 12:
c += ((uint32_t)k[11]) << 24;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 11:
c += ((uint32_t)k[10]) << 16;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 10:
c += ((uint32_t)k[9]) << 8;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 9:
c += k[8];
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 8:
b += ((uint32_t)k[7]) << 24;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 7:
b += ((uint32_t)k[6]) << 16;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 6:
b += ((uint32_t)k[5]) << 8;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 5:
b += k[4];
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 4:
a += ((uint32_t)k[3]) << 24;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 3:
a += ((uint32_t)k[2]) << 16;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 2:
a += ((uint32_t)k[1]) << 8;
+ /* FALLTHROUGH */
H5_ATTR_FALLTHROUGH
case 1:
a += k[0];