X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmd5.c;h=2213dc1206581b936641647c1826cb8d6328bc59;hb=c26924950a3a546112e35c99aad85c0855f4664a;hp=50a264668f189dfa1708d3ebb8d22bd1deebf14b;hpb=569ee54e8941f70ecaff20b12a35eb9fb0cb35ae;p=gnulib.git diff --git a/lib/md5.c b/lib/md5.c index 50a264668..2213dc120 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -83,10 +83,10 @@ md5_init_ctx (struct md5_ctx *ctx) /* Copy the 4 byte value from v into the memory location pointed to by *cp, If your architecture allows unaligned access this is equivalent to * (uint32_t *) cp = v */ -static void +static inline void set_uint32 (char *cp, uint32_t v) { - memcpy (cp, &v, 4); + memcpy (cp, &v, sizeof v); } /* Put result from CTX in first 16 bytes following RESBUF. The result @@ -95,10 +95,10 @@ void * md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) { char *r = resbuf; - set_uint32 (r + 0*4, SWAP (ctx->A)); - set_uint32 (r + 1*4, SWAP (ctx->B)); - set_uint32 (r + 2*4, SWAP (ctx->C)); - set_uint32 (r + 3*4, SWAP (ctx->D)); + set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); + set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); + set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); + set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); return resbuf; }