md5: fix [-Wpointer-arith] compiler warnings

This reverts commits 9aecb00947 and
cdad5961f3 which fixed a different
compiler warning that seems to have disappeared (at least on the
debian-8-full builds).
merge-requests/1/head
Olaf Meeuwissen 2016-08-28 11:58:16 +09:00
rodzic bf53c71434
commit 235de98784
1 zmienionych plików z 7 dodań i 13 usunięć

Wyświetl plik

@ -82,12 +82,6 @@ void
md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx);
static void
md5_set_uint32 (void *buffer, md5_uint32 n)
{
memcpy (buffer, &n, sizeof (md5_uint32));
}
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void
@ -110,10 +104,10 @@ md5_init_ctx (struct md5_ctx *ctx)
void *
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
{
md5_set_uint32 (resbuf + 0 * sizeof (md5_uint32), SWAP (ctx->A));
md5_set_uint32 (resbuf + 1 * sizeof (md5_uint32), SWAP (ctx->B));
md5_set_uint32 (resbuf + 2 * sizeof (md5_uint32), SWAP (ctx->C));
md5_set_uint32 (resbuf + 3 * sizeof (md5_uint32), SWAP (ctx->D));
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
return resbuf;
}
@ -139,9 +133,9 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
memcpy (&ctx->buffer[bytes], fillbuf, pad);
/* Put the 64-bit file length in *bits* at the end of the buffer. */
md5_set_uint32(ctx->buffer + (bytes + pad), SWAP (ctx->total[0] << 3));
md5_set_uint32(ctx->buffer + (bytes + pad + 4), SWAP ((ctx->total[1] << 3) |
(ctx->total[0] >> 29)));
*(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
*(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
(ctx->total[0] >> 29));
/* Process last bytes. */
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);