>From 75b11bfc90201b91839ef81c2bfbcee6294a0053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Sat, 26 Dec 2020 23:40:57 +0000 Subject: [PATCH] maint: avoid -Werror=cast-align src/cksum.c:201:15: error: cast increases required alignment of target type [-Werror=cast-align] 201 | datap = (uint32_t *)buf; | ^ --- src/cksum.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cksum.c b/src/cksum.c index 26d670d4a..714e33391 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -161,7 +161,7 @@ static bool have_read_stdin; static bool cksum (const char *file, bool print_name) { - unsigned char buf[BUFLEN]; + uint32_t buf[BUFLEN/4]; uint_fast32_t crc = 0; uintmax_t length = 0; size_t bytes_read; @@ -189,7 +189,6 @@ cksum (const char *file, bool print_name) while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0) { - unsigned char *cp = buf; uint32_t *datap; uint32_t second = 0; @@ -209,7 +208,7 @@ cksum (const char *file, bool print_name) } /* And finish up last 0-7 bytes in a byte by byte fashion */ - cp = (unsigned char *)datap; + unsigned char *cp = (unsigned char *)datap; while (bytes_read--) crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ *cp++) & 0xFF]; if (feof (fp)) -- 2.26.2