avcodec/wavpack: Add () to protect the arguments of UPDATE_WEIGHT_CLIP()
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Feb 2015 00:37:06 +0000 (01:37 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Feb 2015 00:49:35 +0000 (01:49 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/wavpack.h

index 6cb49a1..a1b46d5 100644 (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; \
         } \
     }