[vlc-commits] playlist: Fix playlist_Control undefined behavior

Hugo Beauzée-Luyssen git at videolan.org
Tue Sep 26 15:47:06 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Sep 26 14:37:06 2017 +0200| [fa8d8ee2af927d7ae10a5f6e1473ea483c79da10] | committer: Hugo Beauzée-Luyssen

playlist: Fix playlist_Control undefined behavior

../../src/playlist/control.c:145:21: warning: passing an object that
undergoes default argument promotion to 'va_start' has undefined
behavior [-Wvarargs]
    va_start( args, locked );

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

 include/vlc_playlist.h | 2 +-
 src/playlist/control.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index b74d9b3e55..9498e622ca 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -302,7 +302,7 @@ VLC_API void playlist_Deactivate( playlist_t * );
  * \param b_locked TRUE if playlist is locked when entering this function
  * \param variable number of arguments
  */
-VLC_API void playlist_Control( playlist_t *p_playlist, int i_query, bool b_locked, ...  );
+VLC_API void playlist_Control( playlist_t *p_playlist, int i_query, int b_locked, ...  );
 
 static inline void playlist_ViewPlay(playlist_t *pl, playlist_item_t *node,
                                      playlist_item_t *item)
diff --git a/src/playlist/control.c b/src/playlist/control.c
index 2da525a2d6..60d9bae356 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -138,11 +138,11 @@ static void playlist_vaControl( playlist_t *p_playlist, int i_query,
     PL_UNLOCK_IF( !locked );
 }
 
-void playlist_Control( playlist_t *p_playlist, int query, bool locked, ... )
+void playlist_Control( playlist_t *p_playlist, int query, int locked, ... )
 {
     va_list args;
 
     va_start( args, locked );
-    playlist_vaControl( p_playlist, query, locked, args );
+    playlist_vaControl( p_playlist, query, (bool)locked, args );
     va_end( args );
 }



More information about the vlc-commits mailing list