[gst-devel] [gst-cvs] gst-plugins-bad: apexsink: Use a union to avoid type-punning strict aliasing compiler warning.
Jan Schmidt
thaytan at noraisin.net
Tue Mar 3 15:38:54 CET 2009
On Tue, 2009-03-03 at 10:24 +0100, Peter Kjellerstedt wrote:
> > -----Original Message-----
> > ---
> >
> > 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;
>
Easier to read maybe. It makes no difference in the end though - the
union will have the overall size of the larger structure anyway. The
buffer could be declared guchar buf[1], and it'd all be fine.
J.
--
Jan Schmidt <thaytan at noraisin.net>
More information about the gstreamer-devel
mailing list