[vlc-devel] commit: v4l: attempt to fix strict aliasing warnings. (Alexis Ballier )

git version control git at videolan.org
Sun Oct 18 13:14:51 CEST 2009


vlc | branch: master | Alexis Ballier <aballier at gentoo.org> | Sun Sep 27 12:31:38 2009 +0200| [c2d2e2bb4dd925bb4f7bf0ecfc64a99013f76471] | committer: Rémi Denis-Courmont 

v4l: attempt to fix strict aliasing warnings.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c2d2e2bb4dd925bb4f7bf0ecfc64a99013f76471
---

 modules/access/v4l.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/modules/access/v4l.c b/modules/access/v4l.c
index e72feb7..2edf250 100644
--- a/modules/access/v4l.c
+++ b/modules/access/v4l.c
@@ -837,7 +837,7 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
      * or height */
     if( p_sys->b_mjpeg )
     {
-        struct quicktime_mjpeg_app1 *p_app1;
+        struct quicktime_mjpeg_app1 p_app1;
         int32_t i_offset;
 
         if( ioctl( i_fd, MJPIOC_G_PARAMS, &mjpeg ) < 0 )
@@ -859,12 +859,11 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
         mjpeg.APP_len = 40;
 
         /* aligned */
-        p_app1 = (struct quicktime_mjpeg_app1 *)mjpeg.APP_data;
-        p_app1->i_reserved = 0;
-        p_app1->i_tag = VLC_FOURCC( 'm','j','p','g' );
-        p_app1->i_field_size = 0;
-        p_app1->i_padded_field_size = 0;
-        p_app1->i_next_field = 0;
+        p_app1.i_reserved = 0;
+        p_app1.i_tag = VLC_FOURCC( 'm','j','p','g' );
+        p_app1.i_field_size = 0;
+        p_app1.i_padded_field_size = 0;
+        p_app1.i_next_field = 0;
         /* XXX WARNING XXX */
         /* these's nothing magic about these values.  We are dangerously
          * assuming the encoder card is encoding mjpeg-a and is not throwing
@@ -876,15 +875,16 @@ static int OpenVideoDev( demux_t *p_demux, char *psz_device )
          * does conform to standards outside of Apple Quicktime.
          */
         i_offset = 0x2e;
-        p_app1->i_DQT_offset = hton32( i_offset );
+        p_app1.i_DQT_offset = hton32( i_offset );
         i_offset = 0xb4;
-        p_app1->i_DHT_offset = hton32( i_offset );
+        p_app1.i_DHT_offset = hton32( i_offset );
         i_offset = 0x258;
-        p_app1->i_SOF_offset = hton32( i_offset );
+        p_app1.i_SOF_offset = hton32( i_offset );
         i_offset = 0x26b;
-        p_app1->i_SOS_offset = hton32( i_offset );
+        p_app1.i_SOS_offset = hton32( i_offset );
         i_offset = 0x279;
-        p_app1->i_data_offset = hton32( i_offset );
+        p_app1.i_data_offset = hton32( i_offset );
+        memcpy(mjpeg.APP_data, &p_app1, sizeof(struct quicktime_mjpeg_app1));
 
         /* SOF and SOS aren't specified by the mjpeg API because they aren't
          * optional.  They will be present in the output. */




More information about the vlc-devel mailing list