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

Tristan Lanfrey git at videolan.org
Sat Oct 8 16:49:16 CEST 2011


vlc | branch: master | Tristan Lanfrey <tristan.lanfrey at gmail.com> | Sat Oct  8 17:48:40 2011 +0300| [adbb4c612a4dfbd048bfc4336c75dfb64e3c598a] | committer: Rémi Denis-Courmont

Use str member of union when it's a string and i member when it's an int

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!

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

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

 src/misc/media_library.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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;
             }



More information about the vlc-commits mailing list