[vlc-commits] dialog: add dialog_vaLogin (see #16404)

Thomas Guillem git at videolan.org
Mon Jan 18 16:11:58 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jan 18 15:50:53 2016 +0100| [c512b8114c1518c2527114d0ec54ae5d192c6514] | committer: Thomas Guillem

dialog: add dialog_vaLogin (see #16404)

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

 include/vlc_dialog.h   |    5 +++++
 src/interface/dialog.c |   46 +++++++++++++++++++++++++++-------------------
 src/libvlccore.sym     |    1 +
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index f682a02..27eacd8 100644
--- a/include/vlc_dialog.h
+++ b/include/vlc_dialog.h
@@ -83,6 +83,11 @@ VLC_API void dialog_Login(vlc_object_t *, const char *, char **, char **, bool *
 #define dialog_Login(o, u, p, s, t, v, w, ...) \
         dialog_Login(VLC_OBJECT(o), u, p, s, t, v, w, __VA_ARGS__)
 
+VLC_API void dialog_vaLogin(vlc_object_t *, const char *, char **, char **, bool *, const char *, const char *, va_list args);
+#define dialog_vaLogin(o, u, p, s, t, v, w, x) \
+        dialog_vaLogin(VLC_OBJECT(o), u, p, s, t, v, w, x)
+
+
 /**
  * A question dialog.
  */
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 3a0a36e..94450db 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -128,22 +128,10 @@ void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title,
     vlc_object_release (provider);
 }
 
-#undef dialog_Login
-/**
- * Requests a username and password through the user interface.
- * @param obj the VLC object requesting credential information
- * @param username a pointer to the specified username [OUT]
- * @param password a pointer to the specified password [OUT]
- * @param title title for the dialog
- * @param fmt format string for the message in the dialog
- * @return Nothing. If a user name resp. a password was specified,
- * it will be returned as a heap-allocated character array
- * into the username resp password pointer. Those must be freed with free().
- * Otherwise *username resp *password will be NULL.
- */
-void dialog_Login (vlc_object_t *obj, const char *default_username,
-                   char **username, char **password,
-                   bool *store, const char *title, const char *fmt, ...)
+#undef dialog_vaLogin
+void dialog_vaLogin (vlc_object_t *obj, const char *default_username,
+                   char **username, char **password, bool *store,
+                   const char *title, const char *fmt, va_list ap)
 {
     assert ((username != NULL) && (password != NULL));
 
@@ -156,9 +144,7 @@ void dialog_Login (vlc_object_t *obj, const char *default_username,
         return;
 
     char *text;
-    va_list ap;
 
-    va_start (ap, fmt);
     if (vasprintf (&text, fmt, ap) != -1)
     {
         dialog_login_t dialog = { title, text, default_username, username,
@@ -166,10 +152,32 @@ void dialog_Login (vlc_object_t *obj, const char *default_username,
         var_SetAddress (provider, "dialog-login", &dialog);
         free (text);
     }
-    va_end (ap);
     vlc_object_release (provider);
 }
 
+#undef dialog_Login
+/**
+ * Requests a username and password through the user interface.
+ * @param obj the VLC object requesting credential information
+ * @param username a pointer to the specified username [OUT]
+ * @param password a pointer to the specified password [OUT]
+ * @param title title for the dialog
+ * @param fmt format string for the message in the dialog
+ * @return Nothing. If a user name resp. a password was specified,
+ * it will be returned as a heap-allocated character array
+ * into the username resp password pointer. Those must be freed with free().
+ * Otherwise *username resp *password will be NULL.
+ */
+void dialog_Login (vlc_object_t *obj, const char *default_username,
+                   char **username, char **password,
+                   bool *store, const char *title, const char *fmt, ...)
+{
+    va_list ap;
+    va_start (ap, fmt);
+    dialog_vaLogin (obj, default_username, username, password, store,
+                    title, fmt, ap);
+    va_end (ap);
+}
 
 #undef dialog_Question
 /**
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 477b632..62ef785 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -96,6 +96,7 @@ demux_vaControl
 demux_vaControlHelper
 dialog_ExtensionUpdate
 dialog_Login
+dialog_vaLogin
 dialog_ProgressCancelled
 dialog_ProgressCreate
 dialog_ProgressDestroy



More information about the vlc-commits mailing list