[vlc-devel] commit: VLM: fix aliasing ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Aug 29 12:36:17 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 29 13:35:16 2009 +0300| [006fd55e80fecd30c2df56845d1bcc836c1cf013] | committer: Rémi Denis-Courmont 

VLM: fix aliasing

(cherry picked from commit f3c14e261e8da744044e20da393a428cc42a5360)

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

 src/input/vlm.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/input/vlm.c b/src/input/vlm.c
index c7cf269..d1ef096 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -546,17 +546,19 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
             {
                 input_item_t item;
                 es_format_t es, *p_es = &es;
-                char fourcc[5];
+                union { char text[5]; uint32_t value; } fourcc;
 
-                sprintf( fourcc, "%4.4s", p_cfg->vod.psz_mux );
-                fourcc[0] = tolower(fourcc[0]); fourcc[1] = tolower(fourcc[1]);
-                fourcc[2] = tolower(fourcc[2]); fourcc[3] = tolower(fourcc[3]);
+                sprintf( fourcc.text, "%4.4s", p_cfg->vod.psz_mux );
+                fourcc.text[0] = tolower(fourcc.text[0]);
+                fourcc.text[1] = tolower(fourcc.text[1]);
+                fourcc.text[2] = tolower(fourcc.text[2]);
+                fourcc.text[3] = tolower(fourcc.text[3]);
 
                 /* XXX: Don't do it that way, but properly use a new input item ref. */
                 item = *p_media->vod.p_item;
                 item.i_es = 1;
                 item.es = &p_es;
-                es_format_Init( &es, VIDEO_ES, *((int *)fourcc) );
+                es_format_Init( &es, VIDEO_ES, fourcc.value );
 
                 p_media->vod.p_media =
                     p_vlm->p_vod->pf_media_new( p_vlm->p_vod, p_cfg->psz_name, &item );




More information about the vlc-devel mailing list