From: Michael Niedermayer Date: Wed, 18 Feb 2015 00:37:06 +0000 (+0100) Subject: avcodec/wavpack: Add () to protect the arguments of UPDATE_WEIGHT_CLIP() X-Git-Tag: android-x86-6.0-r1~253 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b7c19aee6c86f6924f83a8e2a7b087b8ea6c00fa;p=android-x86%2Fexternal-ffmpeg.git avcodec/wavpack: Add () to protect the arguments of UPDATE_WEIGHT_CLIP() Signed-off-by: Michael Niedermayer --- 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; \ } \ }