mirror of https://git.ffmpeg.org/ffmpeg.git
avutil/md5: stop discarding the const qualifier for the src pointer
The code modifying the buffer on big endian systems was removed. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
e2b7ae4b19
commit
a43389547c
|
@ -98,11 +98,12 @@ static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
|
||||||
a = b + (a << t | a >> (32 - t)); \
|
a = b + (a << t | a >> (32 - t)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static void body(uint32_t ABCD[4], uint32_t *src, int nblocks)
|
static void body(uint32_t ABCD[4], const uint8_t *src, int nblocks)
|
||||||
{
|
{
|
||||||
int i av_unused;
|
int i av_unused;
|
||||||
int n;
|
int n;
|
||||||
uint32_t a, b, c, d, t, *X;
|
const uint32_t *X;
|
||||||
|
uint32_t a, b, c, d, t;
|
||||||
|
|
||||||
for (n = 0; n < nblocks; n++) {
|
for (n = 0; n < nblocks; n++) {
|
||||||
a = ABCD[3];
|
a = ABCD[3];
|
||||||
|
@ -110,7 +111,7 @@ static void body(uint32_t ABCD[4], uint32_t *src, int nblocks)
|
||||||
c = ABCD[1];
|
c = ABCD[1];
|
||||||
d = ABCD[0];
|
d = ABCD[0];
|
||||||
|
|
||||||
X = src + n * 16;
|
X = (const uint32_t *)src + n * 16;
|
||||||
|
|
||||||
#if CONFIG_SMALL
|
#if CONFIG_SMALL
|
||||||
for (i = 0; i < 64; i++) {
|
for (i = 0; i < 64; i++) {
|
||||||
|
@ -164,19 +165,19 @@ void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)
|
||||||
len -= cnt;
|
len -= cnt;
|
||||||
if (j + cnt < 64)
|
if (j + cnt < 64)
|
||||||
return;
|
return;
|
||||||
body(ctx->ABCD, (uint32_t *)ctx->block, 1);
|
body(ctx->ABCD, ctx->block, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
end = src + (len & ~63);
|
end = src + (len & ~63);
|
||||||
if (!HAVE_FAST_UNALIGNED && ((intptr_t)src & 3)) {
|
if (!HAVE_FAST_UNALIGNED && ((intptr_t)src & 3)) {
|
||||||
while (src < end) {
|
while (src < end) {
|
||||||
memcpy(ctx->block, src, 64);
|
memcpy(ctx->block, src, 64);
|
||||||
body(ctx->ABCD, (uint32_t *) ctx->block, 1);
|
body(ctx->ABCD, ctx->block, 1);
|
||||||
src += 64;
|
src += 64;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int nblocks = len / 64;
|
int nblocks = len / 64;
|
||||||
body(ctx->ABCD, (uint32_t *)src, nblocks);
|
body(ctx->ABCD, src, nblocks);
|
||||||
src = end;
|
src = end;
|
||||||
}
|
}
|
||||||
len &= 63;
|
len &= 63;
|
||||||
|
|
Loading…
Reference in New Issue