summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2017-11-20 17:06:07 +0100
committerEdward Hervey <bilboed@bilboed.com>2017-12-01 10:50:33 +0100
commit2707d5cfa6856762615e88fd7c66137b2574f60e (patch)
tree5eca461b7c98ddf7dbfc5e80e20d66c6ccd4e782
parenta8fa876d00bb6dee3dca11b43b396f1f4613baf1 (diff)
downloadgstreamer-plugins-bad-2707d5cfa6856762615e88fd7c66137b2574f60e.tar.gz
all: Fix left-shift undefined behaviour
Cast to the target type before shifting (or use macro if available)
-rw-r--r--gst-libs/gst/gl/gstglcontext.c2
-rw-r--r--gst/dvbsuboverlay/dvb-sub.c2
-rw-r--r--gst/mxf/mxftypes.c4
3 files changed, 3 insertions, 5 deletions
diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c
index 83b50c65c..a64cd73b5 100644
--- a/gst-libs/gst/gl/gstglcontext.c
+++ b/gst-libs/gst/gl/gstglcontext.c
@@ -569,7 +569,7 @@ gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint * major,
#endif
const gchar *version;
gint maj, min, n;
- GstGLAPI ret = (1 << 31);
+ GstGLAPI ret = (1U << 31);
_init_debug ();
diff --git a/gst/dvbsuboverlay/dvb-sub.c b/gst/dvbsuboverlay/dvb-sub.c
index cddb19ec9..2e6e48dde 100644
--- a/gst/dvbsuboverlay/dvb-sub.c
+++ b/gst/dvbsuboverlay/dvb-sub.c
@@ -54,7 +54,7 @@ static void dvb_sub_init (void);
*/
#define AYUV(y,u,v,a) (((a) << 24) | ((y) << 16) | ((u) << 8) | (v))
-#define RGBA_TO_AYUV(r,g,b,a) (((a) << 24) | ((rgb_to_y(r,g,b)) << 16) | ((rgb_to_u(r,g,b)) << 8) | (rgb_to_v(r,g,b)))
+#define RGBA_TO_AYUV(r,g,b,a) ((((guint32)(a)) << 24) | ((rgb_to_y(r,g,b)) << 16) | ((rgb_to_u(r,g,b)) << 8) | (rgb_to_v(r,g,b)))
typedef struct DVBSubCLUT
diff --git a/gst/mxf/mxftypes.c b/gst/mxf/mxftypes.c
index ba7704b8c..e077f3f23 100644
--- a/gst/mxf/mxftypes.c
+++ b/gst/mxf/mxftypes.c
@@ -250,9 +250,7 @@ mxf_uuid_hash (const MXFUUID * uuid)
g_return_val_if_fail (uuid != NULL, 0);
for (i = 0; i < 4; i++)
- ret ^= (uuid->u[i * 4 + 0] << 24) |
- (uuid->u[i * 4 + 1] << 16) |
- (uuid->u[i * 4 + 2] << 8) | (uuid->u[i * 4 + 3] << 0);
+ ret ^= GST_READ_UINT32_BE (uuid->u + i * 4);
return ret;
}