Remove function pointer casts

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2016-10-25 13:37:42 +02:00
parent 10f8f89726
commit be717529c2
4 changed files with 15 additions and 11 deletions

View file

@ -357,14 +357,16 @@ handle_link(GtkEntry* entry, girara_session_t* session,
} }
bool bool
cb_sc_follow(GtkEntry* entry, girara_session_t* session) cb_sc_follow(GtkEntry* entry, void* data)
{ {
girara_session_t* session = data;
return handle_link(entry, session, ZATHURA_LINK_ACTION_FOLLOW); return handle_link(entry, session, ZATHURA_LINK_ACTION_FOLLOW);
} }
bool bool
cb_sc_display_link(GtkEntry* entry, girara_session_t* session) cb_sc_display_link(GtkEntry* entry, void* data)
{ {
girara_session_t* session = data;
return handle_link(entry, session, ZATHURA_LINK_ACTION_DISPLAY); return handle_link(entry, session, ZATHURA_LINK_ACTION_DISPLAY);
} }
@ -395,7 +397,7 @@ password_dialog(gpointer data)
"Incorrect password. Enter password:", "Incorrect password. Enter password:",
true, true,
NULL, NULL,
(girara_callback_inputbar_activate_t) cb_password_dialog, cb_password_dialog,
dialog dialog
); );
} }
@ -404,12 +406,14 @@ password_dialog(gpointer data)
} }
bool bool
cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog) cb_password_dialog(GtkEntry* entry, void* data)
{ {
if (entry == NULL || dialog == NULL) { if (entry == NULL || data == NULL) {
goto error_ret; goto error_ret;
} }
zathura_password_dialog_info_t* dialog = data;
if (dialog->path == NULL) { if (dialog->path == NULL) {
free(dialog); free(dialog);
goto error_ret; goto error_ret;

View file

@ -110,7 +110,7 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
* @param session The girara session * @param session The girara session
* @return true if no error occurred and the event has been handled * @return true if no error occurred and the event has been handled
*/ */
bool cb_sc_follow(GtkEntry* entry, girara_session_t* session); bool cb_sc_follow(GtkEntry* entry, void* session);
/** /**
* Called when input has been passed to the sc_display_link dialog * Called when input has been passed to the sc_display_link dialog
@ -119,7 +119,7 @@ bool cb_sc_follow(GtkEntry* entry, girara_session_t* session);
* @param session The girara session * @param session The girara session
* @return true if no error occurred and the event has been handled * @return true if no error occurred and the event has been handled
*/ */
bool cb_sc_display_link(GtkEntry* entry, girara_session_t* session); bool cb_sc_display_link(GtkEntry* entry, void* session);
/** /**
* Emitted when file has been changed * Emitted when file has been changed
@ -136,7 +136,7 @@ void cb_file_monitor(ZathuraFileMonitor* monitor, girara_session_t* session);
* @param dialog The dialog information * @param dialog The dialog information
* @return true if input has been handled * @return true if input has been handled
*/ */
bool cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog); bool cb_password_dialog(GtkEntry* entry, void* dialog);
/** /**
* Emitted when the view has been resized * Emitted when the view has been resized

View file

@ -135,7 +135,7 @@ sc_display_link(girara_session_t* session, girara_argument_t* UNUSED(argument),
if (show_links) { if (show_links) {
zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_INPUTBAR); zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_INPUTBAR);
girara_dialog(zathura->ui.session, "Display link:", FALSE, NULL, girara_dialog(zathura->ui.session, "Display link:", FALSE, NULL,
(girara_callback_inputbar_activate_t) cb_sc_display_link, cb_sc_display_link,
zathura->ui.session); zathura->ui.session);
} }
@ -223,7 +223,7 @@ sc_follow(girara_session_t* session, girara_argument_t* UNUSED(argument),
/* ask for input */ /* ask for input */
if (show_links == true) { if (show_links == true) {
zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_INPUTBAR); zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_INPUTBAR);
girara_dialog(zathura->ui.session, "Follow link:", FALSE, NULL, (girara_callback_inputbar_activate_t) cb_sc_follow, zathura->ui.session); girara_dialog(zathura->ui.session, "Follow link:", FALSE, NULL, cb_sc_follow, zathura->ui.session);
} }
return false; return false;

View file

@ -751,7 +751,7 @@ document_open_password_dialog(gpointer data)
zathura_password_dialog_info_t* password_dialog_info = data; zathura_password_dialog_info_t* password_dialog_info = data;
girara_dialog(password_dialog_info->zathura->ui.session, _("Enter password:"), true, NULL, girara_dialog(password_dialog_info->zathura->ui.session, _("Enter password:"), true, NULL,
(girara_callback_inputbar_activate_t) cb_password_dialog, password_dialog_info); cb_password_dialog, password_dialog_info);
return FALSE; return FALSE;
} }