From: Ralph Corderoy Date: Mon, 29 May 2017 11:56:10 +0000 (+0100) Subject: sizeof char is always 1, so don't bother to divide by it. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/2b677bfbc0ece2abfb27fa5ff7827ebe2e4609a0?hp=97bb4983b53b2f67756b0b3cc800105e13bfcddb sizeof char is always 1, so don't bother to divide by it. --- diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 501bb88b..e209616a 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -1918,7 +1918,7 @@ calculate_digest (CT ct, int asciiP) unsigned char *ep; fprintf (stderr, "MD5 digest="); - for (ep = (dp = digest) + sizeof(digest) / sizeof(digest[0]); + for (ep = (dp = digest) + sizeof digest; dp < ep; dp++) fprintf (stderr, "%02x", *dp & 0xff); fprintf (stderr, "\n"); @@ -1926,7 +1926,7 @@ calculate_digest (CT ct, int asciiP) /* encode the digest using base64 */ for (dp = digest, op = (char *) outbuf, - cc = sizeof(digest) / sizeof(digest[0]); + cc = sizeof digest; cc > 0; cc -= 3, op += 4) { unsigned long bits; char *bp; diff --git a/uip/mhparse.c b/uip/mhparse.c index 1a7fe520..bab4e5b6 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -1854,7 +1854,7 @@ openBase64 (CT ct, char **file) if (ct->c_digested) { if (memcmp(digest, ct->c_digest, - sizeof(digest) / sizeof(digest[0]))) { + sizeof digest)) { content_error (NULL, ct, "content integrity suspect (digest mismatch) -- continuing"); } else { @@ -2106,7 +2106,7 @@ openQuoted (CT ct, char **file) MD5Final (digest, &mdContext); if (memcmp((char *) digest, (char *) ct->c_digest, - sizeof(digest) / sizeof(digest[0]))) + sizeof digest)) content_error (NULL, ct, "content integrity suspect (digest mismatch) -- continuing"); else @@ -2911,7 +2911,7 @@ readDigest (CT ct, char *cp) size_t len; if (decodeBase64 (cp, &digest, &len, 0, NULL) == OK) { - const size_t maxlen = sizeof ct->c_digest / sizeof ct->c_digest[0]; + const size_t maxlen = sizeof ct->c_digest; if (strlen ((char *) digest) <= maxlen) { memcpy (ct->c_digest, digest, maxlen);