[vlc-commits] plugin: match prototypes for callbacks as variable args

Rémi Denis-Courmont git at videolan.org
Thu Oct 27 18:46:15 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 27 15:15:13 2016 +0300| [65fb4c22163ec3d566bd3444f09a8ca6d6d19486] | committer: Rémi Denis-Courmont

plugin: match prototypes for callbacks as variable args

Cast was missing, leading to mismatch.

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

 include/vlc_plugin.h |  7 ++++---
 src/modules/entry.c  | 10 ++++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index 0d4e943..3e4e7f6 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -299,8 +299,9 @@ VLC_METADATA_EXPORTS
         goto error;
 
 #define set_callbacks( activate, deactivate ) \
-    if (vlc_module_set (VLC_MODULE_CB_OPEN, #activate, activate) \
-     || vlc_module_set (VLC_MODULE_CB_CLOSE, #deactivate, deactivate)) \
+    if (vlc_module_set(VLC_MODULE_CB_OPEN, #activate, (void *)(activate)) \
+     || vlc_module_set(VLC_MODULE_CB_CLOSE, #deactivate, \
+                       (void *)(deactivate))) \
         goto error;
 
 #define cannot_unload_broken_library( ) \
@@ -470,7 +471,7 @@ VLC_METADATA_EXPORTS
                     (const char *const *)(list_text));
 
 #define change_string_cb( cb ) \
-    vlc_config_set (VLC_CONFIG_LIST_CB, #cb, (cb));
+    vlc_config_set (VLC_CONFIG_LIST_CB, #cb, (void *)(cb));
 
 #define change_integer_list( list, list_text ) \
     vlc_config_set (VLC_CONFIG_LIST, \
diff --git a/src/modules/entry.c b/src/modules/entry.c
index 7af97e9..db50668 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -417,15 +417,21 @@ static int vlc_plugin_setter(void *ctx, void *tgt, int propid, ...)
         }
 
         case VLC_CONFIG_LIST_CB:
+        {
+            void *cb;
+
             va_arg(ap, const char *);
+            cb = va_arg(ap, void *);
+
             if (IsConfigIntegerType (item->i_type))
-               item->list.i_cb = va_arg (ap, vlc_integer_list_cb);
+               item->list.i_cb = cb;
             else
             if (IsConfigStringType (item->i_type))
-               item->list.psz_cb = va_arg (ap, vlc_string_list_cb);
+               item->list.psz_cb = cb;
             else
                 break;
             break;
+        }
 
         default:
             fprintf (stderr, "LibVLC: unknown module property %d\n", propid);



More information about the vlc-commits mailing list