[vlc-commits] libvlc: re-order dialog callback arguments
Thomas Guillem
git at videolan.org
Thu Mar 10 11:45:32 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 10 11:36:51 2016 +0100| [c021c52459e41a2c465b1f658a578a74bbe4eda8] | committer: Thomas Guillem
libvlc: re-order dialog callback arguments
The opaque p_data is now the first argument for the sake of consistency.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c021c52459e41a2c465b1f658a578a74bbe4eda8
---
include/vlc/libvlc_dialog.h | 42 +++++++++++++++++++++---------------------
lib/dialog.c | 35 +++++++++++++++++------------------
2 files changed, 38 insertions(+), 39 deletions(-)
diff --git a/include/vlc/libvlc_dialog.h b/include/vlc/libvlc_dialog.h
index d9b63eb..11edcae 100644
--- a/include/vlc/libvlc_dialog.h
+++ b/include/vlc/libvlc_dialog.h
@@ -52,12 +52,12 @@ typedef struct libvlc_dialog_cbs
/**
* Called when an error message needs to be displayed
*
+ * @param p_data opaque pointer for the callback
* @param psz_title title of the diaog
* @param psz_text text of the dialog
- * @param p_data opaque pointer for the callback
*/
- void (*pf_display_error)(const char *psz_title, const char *psz_text,
- void *p_data);
+ void (*pf_display_error)(void *p_data, const char *psz_title,
+ const char *psz_text);
/**
* Called when a login dialog needs to be displayed
@@ -68,18 +68,18 @@ typedef struct libvlc_dialog_cbs
* @note to receive this callack, libvlc_dialog_cbs.pf_cancel should not be
* NULL.
*
+ * @param p_data opaque pointer for the callback
* @param p_id id used to interact with the dialog
* @param psz_title title of the diaog
* @param psz_text text of the dialog
* @param psz_default_username user name that should be set on the user form
* @param b_ask_store if true, ask the user if he wants to save the
* credentials
- * @param p_data opaque pointer for the callback
*/
- void (*pf_display_login)(libvlc_dialog_id *p_id, const char *psz_title,
- const char *psz_text,
+ void (*pf_display_login)(void *p_data, libvlc_dialog_id *p_id,
+ const char *psz_title, const char *psz_text,
const char *psz_default_username,
- bool b_ask_store, void *p_data);
+ bool b_ask_store);
/**
* Called when a question dialog needs to be displayed
@@ -90,6 +90,7 @@ typedef struct libvlc_dialog_cbs
* @note to receive this callack, libvlc_dialog_cbs.pf_cancel should not be
* NULL.
*
+ * @param p_data opaque pointer for the callback
* @param p_id id used to interact with the dialog
* @param psz_title title of the diaog
* @param psz_text text of the dialog
@@ -99,13 +100,12 @@ typedef struct libvlc_dialog_cbs
* button
* @param psz_action2 text of the second button, if NULL, don't display
* this button
- * @param p_data opaque pointer for the callback
*/
- void (*pf_display_question)(libvlc_dialog_id *p_id, const char *psz_title,
- const char *psz_text,
+ void (*pf_display_question)(void *p_data, libvlc_dialog_id *p_id,
+ const char *psz_title, const char *psz_text,
libvlc_dialog_question_type i_type,
const char *psz_cancel, const char *psz_action1,
- const char *psz_action2, void *p_data);
+ const char *psz_action2);
/**
* Called when a progress dialog needs to be displayed
@@ -116,6 +116,7 @@ typedef struct libvlc_dialog_cbs
* @note to receive this callack, libvlc_dialog_cbs.pf_cancel and
* libvlc_dialog_cbs.pf_update_progress should not be NULL.
*
+ * @param p_data opaque pointer for the callback
* @param p_id id used to interact with the dialog
* @param psz_title title of the diaog
* @param psz_text text of the dialog
@@ -124,12 +125,11 @@ typedef struct libvlc_dialog_cbs
* 1.0)
* @param psz_cancel text of the cancel button, if NULL the dialog is not
* cancellable
- * @param p_data opaque pointer for the callback
*/
- void (*pf_display_progress)(libvlc_dialog_id *p_id, const char *psz_title,
- const char *psz_text, bool b_indeterminate,
- float f_position, const char *psz_cancel,
- void *p_data);
+ void (*pf_display_progress)(void *p_data, libvlc_dialog_id *p_id,
+ const char *psz_title, const char *psz_text,
+ bool b_indeterminate, float f_position,
+ const char *psz_cancel);
/**
* Called when a displayed dialog needs to be cancelled
@@ -137,21 +137,21 @@ typedef struct libvlc_dialog_cbs
* The implementation must call libvlc_dialog_dismiss() to really release
* the dialog.
*
- * @param p_id id of the dialog
* @param p_data opaque pointer for the callback
+ * @param p_id id of the dialog
*/
- void (*pf_cancel)(libvlc_dialog_id *p_id, void *p_data);
+ void (*pf_cancel)(void *p_data, libvlc_dialog_id *p_id);
/**
* Called when a progress dialog needs to be updated
*
+ * @param p_data opaque pointer for the callback
* @param p_id id of the dialog
* @param f_position osition of the progress bar (between 0.0 and 1.0)
* @param psz_text new text of the progress dialog
- * @param p_data opaque pointer for the callback
*/
- void (*pf_update_progress)(libvlc_dialog_id *p_id, float f_position,
- const char *psz_text, void *p_data);
+ void (*pf_update_progress)(void *p_data, libvlc_dialog_id *p_id,
+ float f_position, const char *psz_text);
} libvlc_dialog_cbs;
/**
diff --git a/lib/dialog.c b/lib/dialog.c
index 273cba9..2fd936b 100644
--- a/lib/dialog.c
+++ b/lib/dialog.c
@@ -49,8 +49,8 @@ display_error_cb(void *p_data, const char *psz_title, const char *psz_text)
{
libvlc_instance_t *p_instance = p_data;
- p_instance->dialog.cbs.pf_display_error(psz_title, psz_text,
- p_instance->dialog.data);
+ p_instance->dialog.cbs.pf_display_error(p_instance->dialog.data, psz_title,
+ psz_text);
}
static void
@@ -60,11 +60,10 @@ display_login_cb(void *p_data, vlc_dialog_id *p_id, const char *psz_title,
{
libvlc_instance_t *p_instance = p_data;
- p_instance->dialog.cbs.pf_display_login((libvlc_dialog_id *) p_id,
- psz_title, psz_text,
- psz_default_username,
- b_ask_store,
- p_instance->dialog.data);
+ p_instance->dialog.cbs.pf_display_login(p_instance->dialog.data,
+ (libvlc_dialog_id *) p_id,
+ psz_title, psz_text,
+ psz_default_username, b_ask_store);
}
static void
@@ -77,11 +76,11 @@ display_question_cb(void *p_data, vlc_dialog_id *p_id, const char *psz_title,
const libvlc_dialog_question_type i_ltype =
vlc_to_libvlc_dialog_question_type(i_type);
- p_instance->dialog.cbs.pf_display_question((libvlc_dialog_id *) p_id,
+ p_instance->dialog.cbs.pf_display_question(p_instance->dialog.data,
+ (libvlc_dialog_id *) p_id,
psz_title, psz_text, i_ltype,
psz_cancel,
- psz_action1, psz_action2,
- p_instance->dialog.data);
+ psz_action1, psz_action2);
}
static void
@@ -91,19 +90,19 @@ display_progress_cb(void *p_data, vlc_dialog_id *p_id, const char *psz_title,
{
libvlc_instance_t *p_instance = p_data;
- p_instance->dialog.cbs.pf_display_progress((libvlc_dialog_id *) p_id,
+ p_instance->dialog.cbs.pf_display_progress(p_instance->dialog.data,
+ (libvlc_dialog_id *) p_id,
psz_title, psz_text,
b_indeterminate, f_position,
- psz_cancel,
- p_instance->dialog.data);
+ psz_cancel);
}
static void
cancel_cb(void *p_data, vlc_dialog_id *p_id)
{
libvlc_instance_t *p_instance = p_data;
- p_instance->dialog.cbs.pf_cancel((libvlc_dialog_id *)p_id,
- p_instance->dialog.data);
+ p_instance->dialog.cbs.pf_cancel(p_instance->dialog.data,
+ (libvlc_dialog_id *)p_id);
}
static void
@@ -111,9 +110,9 @@ update_progress_cb(void *p_data, vlc_dialog_id *p_id, float f_position,
const char *psz_text)
{
libvlc_instance_t *p_instance = p_data;
- p_instance->dialog.cbs.pf_update_progress((libvlc_dialog_id *) p_id,
- f_position, psz_text,
- p_instance->dialog.data);
+ p_instance->dialog.cbs.pf_update_progress(p_instance->dialog.data,
+ (libvlc_dialog_id *) p_id,
+ f_position, psz_text);
}
void
More information about the vlc-commits
mailing list