[gstutils] Adds more safety to GST_WRITE_* and GST_READ_ macros.
authorThiago Santos <thiagoss@embedded.ufcg.edu.br>
Fri, 15 May 2009 17:42:48 +0000 (14:42 -0300)
committerThiago Santos <thiagoss@embedded.ufcg.edu.br>
Fri, 15 May 2009 18:26:17 +0000 (15:26 -0300)
Adds safety ( ) to parameters in _GST_PUT and _GST_GET macros.
Fixes #582708.

gst/gstutils.h

index 4e40bba..010254a 100644 (file)
@@ -268,10 +268,10 @@ GST_BOILERPLATE_FULL (type, type_as_function, parent_type,              \
 
 /* Define PUT and GET functions for unaligned memory */
 #define _GST_GET(__data, __idx, __size, __shift) \
-    (((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
+    (((guint##__size) (((guint8 *) (__data))[__idx])) << (__shift))
 
 #define _GST_PUT(__data, __idx, __size, __shift, __num) \
-    (((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
+    (((guint8 *) (__data))[__idx] = (((guint##__size) (__num)) >> (__shift)) & 0xff)
 
 /**
  * GST_READ_UINT64_BE: