summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2016-07-28 13:10:22 +0300
committerMartin Storsjö <martin@martin.st>2016-07-31 22:50:51 +0300
commit25bacd0a0c32ae682e6f411b1ac9020aeaabca72 (patch)
tree2606b9bd0703577075b95be7923c5d9b8598e608 /libavcodec
parent7ebdffc353f3f0827864e8e3461fdc00cc243b14 (diff)
Don't use expressions with side effects in macro parameters
AV_WB32 can be implemented as a macro that expands its parameters multiple times (in case AV_HAVE_FAST_UNALIGNED isn't set and the compiler doesn't support GCC attributes); make sure not to read multiple times from the source in this case. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dxv.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 99327dface..39b297a235 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -121,8 +121,10 @@ static int dxv_decompress_dxt1(AVCodecContext *avctx)
int pos = 2;
/* Copy the first two elements */
- AV_WL32(ctx->tex_data, bytestream2_get_le32(gbc));
- AV_WL32(ctx->tex_data + 4, bytestream2_get_le32(gbc));
+ value = bytestream2_get_le32(gbc);
+ AV_WL32(ctx->tex_data, value);
+ value = bytestream2_get_le32(gbc);
+ AV_WL32(ctx->tex_data + 4, value);
/* Process input until the whole texture has been filled */
while (pos + 2 <= ctx->tex_size / 4) {
@@ -172,10 +174,14 @@ static int dxv_decompress_dxt5(AVCodecContext *avctx)
int probe, check;
/* Copy the first four elements */
- AV_WL32(ctx->tex_data + 0, bytestream2_get_le32(gbc));
- AV_WL32(ctx->tex_data + 4, bytestream2_get_le32(gbc));
- AV_WL32(ctx->tex_data + 8, bytestream2_get_le32(gbc));
- AV_WL32(ctx->tex_data + 12, bytestream2_get_le32(gbc));
+ value = bytestream2_get_le32(gbc);
+ AV_WL32(ctx->tex_data + 0, value);
+ value = bytestream2_get_le32(gbc);
+ AV_WL32(ctx->tex_data + 4, value);
+ value = bytestream2_get_le32(gbc);
+ AV_WL32(ctx->tex_data + 8, value);
+ value = bytestream2_get_le32(gbc);
+ AV_WL32(ctx->tex_data + 12, value);
/* Process input until the whole texture has been filled */
while (pos + 2 <= ctx->tex_size / 4) {