> -----Original Message-----
> From: Jan Schmidt [mailto:[hidden email]] > Sent: den 27 februari 2009 13:04 > To: [hidden email] > 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 <[hidden email]> > 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 ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
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 <[hidden email]> ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |