[gst-devel] [gst-cvs] gst-plugins-bad: apexsink: Use a union to avoid type-punning strict aliasing compiler warning.

Peter Kjellerstedt peter.kjellerstedt at axis.com
Tue Mar 3 10:24:47 CET 2009


> -----Original Message-----
> From: Jan Schmidt [mailto:thaytan at kemper.freedesktop.org]
> Sent: den 27 februari 2009 13:04
> To: gstreamer-cvs at lists.sourceforge.net
> Subject: [gst-cvs] gst-plugins-bad: apexsink: Use a union to avoid
> type-punning strict aliasing compiler warning.
> 
> Module: gst-plugins-bad
> Branch: master
> Commit: 4a046a08a336e1cde0105f40461f67491f5b22a1
> URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=4a046a08a336e1cde0105f40461f67491f5b22a1
> 
> Author: Jan Schmidt <thaytan at noraisin.net>
> Date:   Fri Feb 27 10:16:57 2009 +0000
> 
> apexsink: Use a union to avoid type-punning strict aliasing compiler warning.
> 
> ---
> 
>  ext/apexsink/gstapexraop.c |   24 +++++++++++++++++-------
>  1 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/ext/apexsink/gstapexraop.c b/ext/apexsink/gstapexraop.c
> index 42b707c..98b7d86 100644
> --- a/ext/apexsink/gstapexraop.c
> +++ b/ext/apexsink/gstapexraop.c
> @@ -231,7 +231,17 @@ gst_apexraop_connect (GstApExRAOP * con)
>        creq[GST_APEX_RAOP_SDP_DEFAULT_LENGTH],
>        hreq[GST_APEX_RAOP_HDR_DEFAULT_LENGTH], *req;
>    RSA *rsa;
> -  guchar *mod, *exp, buf[4 + 8 + 16], rsakey[512];
> +  guchar *mod, *exp, rsakey[512];
> +  union gst_randbytes
> +  {
> +    struct asvals
> +    {
> +      gulong url_key;
> +      guint64 conn_id;
> +      guchar challenge[16];
> +    } v;
> +    guchar buf[4 + 8 + 16];

Wouldn't it be better to use:

    guchar buf[sizeof (struct asvals)];

> +  } randbuf;
>    gsize size;
>    struct sockaddr_in ioaddr;
>    socklen_t iolen;

//Peter





More information about the gstreamer-devel mailing list