From aebb6bd9f3acef31eafa1c14f4173323da998026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 12 Feb 2019 17:58:19 +0200 Subject: [PATCH] dvdreadsrc: Work around GCC9 compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's technically true but not for this specific type. dvdreadsrc.c:394:65: error: taking address of packed member of ‘struct ’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 394 | gst_dvd_read_src_make_clut_change_event (src, src->cur_pgc->palette); | ~~~~~~~~~~~~^~~~~~~~~ --- ext/dvdread/dvdreadsrc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ext/dvdread/dvdreadsrc.c b/ext/dvdread/dvdreadsrc.c index 18e9f7015f..4a8b38f5b5 100644 --- a/ext/dvdread/dvdreadsrc.c +++ b/ext/dvdread/dvdreadsrc.c @@ -78,7 +78,7 @@ static void gst_dvd_read_src_set_property (GObject * object, guint prop_id, static void gst_dvd_read_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static GstEvent *gst_dvd_read_src_make_clut_change_event (GstDvdReadSrc * src, - const guint * clut); + const guint32 * clut); static gboolean gst_dvd_read_src_get_size (GstDvdReadSrc * src, gint64 * size); static gboolean gst_dvd_read_src_do_seek (GstBaseSrc * src, GstSegment * s); static gint64 gst_dvd_read_src_convert_timecode (dvd_time_t * time); @@ -348,6 +348,7 @@ static gboolean gst_dvd_read_src_goto_chapter (GstDvdReadSrc * src, gint chapter) { gint i; + const guint8 *palette; /* make sure the chapter number is valid for this title */ if (chapter < 0 || chapter >= src->num_chapters) { @@ -390,8 +391,11 @@ gst_dvd_read_src_goto_chapter (GstDvdReadSrc * src, gint chapter) if (src->pending_clut_event) gst_event_unref (src->pending_clut_event); + /* Work around GCC 9 compiler warning here about taking address of packed + * member, which may result in an unaligned pointer access */ + palette = (const guint8 *) src->cur_pgc->palette; src->pending_clut_event = - gst_dvd_read_src_make_clut_change_event (src, src->cur_pgc->palette); + gst_dvd_read_src_make_clut_change_event (src, (const guint32 *) palette); return TRUE; } @@ -1348,7 +1352,7 @@ gst_dvd_read_src_src_event (GstBaseSrc * basesrc, GstEvent * event) static GstEvent * gst_dvd_read_src_make_clut_change_event (GstDvdReadSrc * src, - const guint * clut) + const guint32 * clut) { GstStructure *structure; gchar name[16];