2026-05-08 Paul Eggert <eggert@cs.ucla.edu>
+ md2: omit confusing casts
+ * lib/md2.c (md2_process_bytes):
+ Use size_t, not unsigned long, for size.
+ Although the code was correct it was unclear.
+ (md2_update_chksum, md2_compress): Omit confusing casts.
+
Pacify -Wuseless-cast for pthread_self
* lib/glthread/thread.h (gl_thread_self_pointer):
* tests/test-pthread-mutex.c, tests/test-pthread-once2.c:
while (len > 0)
{
- unsigned long n = MIN (len, (16 - ctx->curlen));
- memcpy (ctx->buf + ctx->curlen, in, (size_t) n);
+ size_t n = MIN (len, (16 - ctx->curlen));
+ memcpy (ctx->buf + ctx->curlen, in, n);
ctx->curlen += n;
in += n;
len -= n;
{
/* caution, the RFC says its "C[j] = S[M[i*16+j] xor L]" but the
reference source code [and test vectors] say otherwise. */
- L = (ctx->chksum[j] ^= PI_SUBST[(int) (ctx->buf[j] ^ L)] & 255);
+ L = (ctx->chksum[j] ^= PI_SUBST[ctx->buf[j] ^ L] & 255);
}
}
{
for (size_t k = 0; k < 48; k++)
{
- t = (ctx->X[k] ^= PI_SUBST[(int) (t & 255)]);
+ t = (ctx->X[k] ^= PI_SUBST[t & 255]);
}
t = (t + (unsigned char) j) & 255;
}