From b7c19aee6c86f6924f83a8e2a7b087b8ea6c00fa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 18 Feb 2015 01:37:06 +0100 Subject: [PATCH] avcodec/wavpack: Add () to protect the arguments of UPDATE_WEIGHT_CLIP() Signed-off-by: Michael Niedermayer --- libavcodec/wavpack.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/wavpack.h b/libavcodec/wavpack.h index 6cb49a1b3e..a1b46d5bd7 100644 --- a/libavcodec/wavpack.h +++ b/libavcodec/wavpack.h @@ -104,15 +104,15 @@ typedef struct WvChannel { // macros for applying weight #define UPDATE_WEIGHT_CLIP(weight, delta, samples, in) \ - if (samples && in) { \ - if ((samples ^ in) < 0) { \ - weight -= delta; \ - if (weight < -1024) \ - weight = -1024; \ + if ((samples) && (in)) { \ + if (((samples) ^ (in)) < 0) { \ + (weight) -= (delta); \ + if ((weight) < -1024) \ + (weight) = -1024; \ } else { \ - weight += delta; \ - if (weight > 1024) \ - weight = 1024; \ + (weight) += (delta); \ + if ((weight) > 1024) \ + (weight) = 1024; \ } \ }