From: Jan Schmidt Date: Tue, 24 Feb 2009 16:49:40 +0000 (+0000) Subject: rtsp: Fix a strict aliasing warning X-Git-Tag: 1.19.3~511^2~9979 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94791df88d8a17be266d38c34054b84ccdd2479b;p=platform%2Fupstream%2Fgstreamer.git rtsp: Fix a strict aliasing warning Fix strict aliasing warnings from casting a sockaddr_storage and using it as a sockaddr_in6. Use a union instead. --- diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index f861d8a..f5ba068 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -1767,24 +1767,27 @@ gst_rtsp_connection_clear_auth_params (GstRTSPConnection * conn) GstRTSPResult gst_rtsp_connection_set_qos_dscp (GstRTSPConnection * conn, guint qos_dscp) { - struct sockaddr_storage sa_s; - socklen_t sa_sl = sizeof (sa_s); + union gst_sockaddr + { + struct sockaddr_storage sa_s; + struct sockaddr_in6 saddr6; + } sa; + socklen_t sa_sl = sizeof (sa); gint af; gint tos; g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL); g_return_val_if_fail (conn->fd.fd >= 0, GST_RTSP_EINVAL); - if (getsockname (conn->fd.fd, (struct sockaddr *) &sa_s, &sa_sl) < 0) + if (getsockname (conn->fd.fd, (struct sockaddr *) &sa.sa_s, &sa_sl) < 0) goto no_getsockname; - af = sa_s.ss_family; + af = sa.sa_s.ss_family; /* if this is an IPv4-mapped address then do IPv4 QoS */ if (af == AF_INET6) { - struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) &sa_s; - if (IN6_IS_ADDR_V4MAPPED (&saddr6->sin6_addr)) + if (IN6_IS_ADDR_V4MAPPED (&sa.saddr6.sin6_addr)) af = AF_INET; }