[vlc-devel] [PATCH] Use str member of union when it's a string and i member when it's an int

Tristan Lanfrey tristan.lanfrey at gmail.com
Sat Oct 8 13:10:47 CEST 2011


Hi all,

thought I'd commit that sneaky little bug which was crashing the whole
program.

This is because on 64bits sizeof(int) != sizeof(char *) and va_args was
truncating the values of my pointers!

diff --git a/src/misc/media_library.c b/src/misc/media_library.c
index 8470094..b04b7fe 100644
--- a/src/misc/media_library.c
+++ b/src/misc/media_library.c
@@ -219,11 +219,11 @@ int ml_UpdateSimple( media_library_t *p_media_library,
                         vlc_array_append( array, update );
                     break;
                 case 0:
-                    update->value.str = va_arg( args, char* );
+                    update->value.i = va_arg( args, int );
                     vlc_array_append( array, update );
                     break;
                 case 1:
-                    update->value.i = va_arg( args, int );
+                    update->value.str = va_arg( args, char* );
                     vlc_array_append( array, update );
                     break;
             }

-- 
Tristan LANFREY
"putain, je viens de foutre le feu à ma moustache en me rallumant une clope
qui s'était éteinte. ca pue!" (c) Mathieu Leon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20111008/1503f1cc/attachment.html>


More information about the vlc-devel mailing list