From be717529c29a71c0489f8cb0b675767971df632d Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 25 Oct 2016 13:37:42 +0200 Subject: [PATCH] Remove function pointer casts Signed-off-by: Sebastian Ramacher --- zathura/callbacks.c | 14 +++++++++----- zathura/callbacks.h | 6 +++--- zathura/shortcuts.c | 4 ++-- zathura/zathura.c | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/zathura/callbacks.c b/zathura/callbacks.c index 192b5de..8c3fc65 100644 --- a/zathura/callbacks.c +++ b/zathura/callbacks.c @@ -357,14 +357,16 @@ handle_link(GtkEntry* entry, girara_session_t* session, } 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); } 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); } @@ -395,7 +397,7 @@ password_dialog(gpointer data) "Incorrect password. Enter password:", true, NULL, - (girara_callback_inputbar_activate_t) cb_password_dialog, + cb_password_dialog, dialog ); } @@ -404,12 +406,14 @@ password_dialog(gpointer data) } 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; } + zathura_password_dialog_info_t* dialog = data; + if (dialog->path == NULL) { free(dialog); goto error_ret; diff --git a/zathura/callbacks.h b/zathura/callbacks.h index a357028..d989996 100644 --- a/zathura/callbacks.h +++ b/zathura/callbacks.h @@ -110,7 +110,7 @@ void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path, * @param session The girara session * @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 @@ -119,7 +119,7 @@ bool cb_sc_follow(GtkEntry* entry, girara_session_t* session); * @param session The girara session * @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 @@ -136,7 +136,7 @@ void cb_file_monitor(ZathuraFileMonitor* monitor, girara_session_t* session); * @param dialog The dialog information * @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 diff --git a/zathura/shortcuts.c b/zathura/shortcuts.c index 4aca805..3390123 100644 --- a/zathura/shortcuts.c +++ b/zathura/shortcuts.c @@ -135,7 +135,7 @@ sc_display_link(girara_session_t* session, girara_argument_t* UNUSED(argument), if (show_links) { zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_INPUTBAR); 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); } @@ -223,7 +223,7 @@ sc_follow(girara_session_t* session, girara_argument_t* UNUSED(argument), /* ask for input */ if (show_links == true) { 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; diff --git a/zathura/zathura.c b/zathura/zathura.c index 1cb8f8d..19aaa83 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -751,7 +751,7 @@ document_open_password_dialog(gpointer data) zathura_password_dialog_info_t* password_dialog_info = data; 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; }