# HG changeset patch # User kostya # Date 1265888735 0 # Node ID 3423ae1276e201a3392001baeed5e374367c44c1 # Parent 030b858fee8baa485d707d777a7563fca0c480cb Make SHA digest function write digest value with AV_WN32 instead of assuming that output may be written as uint32_t since output buffer may not be aligned (and it's silly to force alignment on it) and it does not work in that case properly on some architectures. diff -r 030b858fee8b -r 3423ae1276e2 sha.c --- a/sha.c Wed Feb 10 23:08:32 2010 +0000 +++ b/sha.c Thu Feb 11 11:45:35 2010 +0000 @@ -25,6 +25,7 @@ #include "avutil.h" #include "bswap.h" #include "sha.h" +#include "intreadwrite.h" /** hash context */ typedef struct AVSHA { @@ -319,7 +320,7 @@ av_sha_update(ctx, "", 1); av_sha_update(ctx, (uint8_t *)&finalcount, 8); /* Should cause a transform() */ for (i = 0; i < ctx->digest_len; i++) - ((uint32_t*)digest)[i] = be2me_32(ctx->state[i]); + AV_WN32(digest + i*4, be2me_32(ctx->state[i])); } #if LIBAVUTIL_VERSION_MAJOR < 51