avcodec/wavpack: Add () to protect the arguments of UPDATE_WEIGHT_CLIP()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-02-18 01:37:06 +01:00
parent dfc2a3982f
commit b7c19aee6c

View File

@ -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; \
} \
}