Commit 6ccfd7f9 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Constify value

parent 641799c4
...@@ -294,7 +294,7 @@ cb_scale_factor(GObject* object, GParamSpec* UNUSED(pspec), gpointer data) ...@@ -294,7 +294,7 @@ cb_scale_factor(GObject* object, GParamSpec* UNUSED(pspec), gpointer data)
} }
void void
cb_page_layout_value_changed(girara_session_t* session, const char* name, girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) cb_page_layout_value_changed(girara_session_t* session, const char* name, girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -303,7 +303,7 @@ cb_page_layout_value_changed(girara_session_t* session, const char* name, girara ...@@ -303,7 +303,7 @@ cb_page_layout_value_changed(girara_session_t* session, const char* name, girara
/* pages-per-row must not be 0 */ /* pages-per-row must not be 0 */
if (g_strcmp0(name, "pages-per-row") == 0) { if (g_strcmp0(name, "pages-per-row") == 0) {
unsigned int pages_per_row = *((unsigned int*) value); unsigned int pages_per_row = *((const unsigned int*) value);
if (pages_per_row == 0) { if (pages_per_row == 0) {
pages_per_row = 1; pages_per_row = 1;
girara_setting_set(session, name, &pages_per_row); girara_setting_set(session, name, &pages_per_row);
...@@ -559,7 +559,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* UNUSED(allocation), za ...@@ -559,7 +559,7 @@ cb_view_resized(GtkWidget* UNUSED(widget), GtkAllocation* UNUSED(allocation), za
void void
cb_setting_recolor_change(girara_session_t* session, const char* name, cb_setting_recolor_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -567,7 +567,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name, ...@@ -567,7 +567,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name,
g_return_if_fail(name != NULL); g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
const bool bool_value = *((bool*) value); const bool bool_value = *((const bool*) value);
if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_enabled(zathura->sync.render_thread) != bool_value) { if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_enabled(zathura->sync.render_thread) != bool_value) {
zathura_renderer_enable_recolor(zathura->sync.render_thread, bool_value); zathura_renderer_enable_recolor(zathura->sync.render_thread, bool_value);
...@@ -577,7 +577,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name, ...@@ -577,7 +577,7 @@ cb_setting_recolor_change(girara_session_t* session, const char* name,
void void
cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -585,7 +585,7 @@ cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, ...@@ -585,7 +585,7 @@ cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
g_return_if_fail(name != NULL); g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
const bool bool_value = *((bool*) value); const bool bool_value = *((const bool*) value);
if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_hue_enabled(zathura->sync.render_thread) != bool_value) { if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_hue_enabled(zathura->sync.render_thread) != bool_value) {
zathura_renderer_enable_recolor_hue(zathura->sync.render_thread, bool_value); zathura_renderer_enable_recolor_hue(zathura->sync.render_thread, bool_value);
...@@ -595,7 +595,7 @@ cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, ...@@ -595,7 +595,7 @@ cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
void void
cb_setting_recolor_keep_reverse_video_change(girara_session_t* session, const char* name, cb_setting_recolor_keep_reverse_video_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -603,7 +603,7 @@ cb_setting_recolor_keep_reverse_video_change(girara_session_t* session, const ch ...@@ -603,7 +603,7 @@ cb_setting_recolor_keep_reverse_video_change(girara_session_t* session, const ch
g_return_if_fail(name != NULL); g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
const bool bool_value = *((bool*) value); const bool bool_value = *((const bool*) value);
if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_reverse_video_enabled(zathura->sync.render_thread) != bool_value) { if (zathura->sync.render_thread != NULL && zathura_renderer_recolor_reverse_video_enabled(zathura->sync.render_thread) != bool_value) {
zathura_renderer_enable_recolor_reverse_video(zathura->sync.render_thread, bool_value); zathura_renderer_enable_recolor_reverse_video(zathura->sync.render_thread, bool_value);
......
...@@ -143,7 +143,7 @@ void cb_scale_factor(GObject* object, GParamSpec* pspec, gpointer data); ...@@ -143,7 +143,7 @@ void cb_scale_factor(GObject* object, GParamSpec* pspec, gpointer data);
* @param data Custom data * @param data Custom data
*/ */
void cb_page_layout_value_changed(girara_session_t* session, const char* name, void cb_page_layout_value_changed(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data); girara_setting_type_t type, const void* value, void* data);
/** /**
* Called when an index element is activated (e.g.: double click) * Called when an index element is activated (e.g.: double click)
...@@ -211,7 +211,7 @@ gboolean cb_view_resized(GtkWidget* widget, GtkAllocation* allocation, zathura_t ...@@ -211,7 +211,7 @@ gboolean cb_view_resized(GtkWidget* widget, GtkAllocation* allocation, zathura_t
* @param data Custom data * @param data Custom data
*/ */
void cb_setting_recolor_change(girara_session_t* session, const char* name, void cb_setting_recolor_change(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data); girara_setting_type_t type, const void* value, void* data);
/** /**
* Emitted when the 'recolor-keephue' setting is changed * Emitted when the 'recolor-keephue' setting is changed
...@@ -223,7 +223,7 @@ void cb_setting_recolor_change(girara_session_t* session, const char* name, ...@@ -223,7 +223,7 @@ void cb_setting_recolor_change(girara_session_t* session, const char* name,
* @param data Custom data * @param data Custom data
*/ */
void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name, void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
girara_setting_type_t type, void* value, void* data); girara_setting_type_t type, const void* value, void* data);
/** /**
* Emitted when the 'recolor-reverse-video' setting is changed * Emitted when the 'recolor-reverse-video' setting is changed
...@@ -235,7 +235,7 @@ void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* n ...@@ -235,7 +235,7 @@ void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* n
* @param data Custom data * @param data Custom data
*/ */
void cb_setting_recolor_keep_reverse_video_change(girara_session_t* session, void cb_setting_recolor_keep_reverse_video_change(girara_session_t* session,
const char* name, girara_setting_type_t type, void* value, void* data); const char* name, girara_setting_type_t type, const void* value, void* data);
/** /**
* Unknown command handler which is used to handle the strict numeric goto * Unknown command handler which is used to handle the strict numeric goto
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
static void static void
cb_jumplist_change(girara_session_t* session, const char* name, cb_jumplist_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -46,7 +46,7 @@ cb_jumplist_change(girara_session_t* session, const char* name, ...@@ -46,7 +46,7 @@ cb_jumplist_change(girara_session_t* session, const char* name,
static void static void
cb_color_change(girara_session_t* session, const char* name, cb_color_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -78,34 +78,34 @@ cb_color_change(girara_session_t* session, const char* name, ...@@ -78,34 +78,34 @@ cb_color_change(girara_session_t* session, const char* name,
static void static void
cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name), cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL); g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
bool* bvalue = value; const bool* bvalue = value;
document_draw_search_results(zathura, !*bvalue); document_draw_search_results(zathura, !*bvalue);
render_all(zathura); render_all(zathura);
} }
static void static void
cb_incsearch_changed(girara_session_t* session, const char* UNUSED(name), cb_incsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL); g_return_if_fail(session->global.data != NULL);
bool inc_search = *(bool*) value; bool inc_search = *(const bool*) value;
girara_special_command_add(session, '/', cmd_search, inc_search, FORWARD, NULL); girara_special_command_add(session, '/', cmd_search, inc_search, FORWARD, NULL);
girara_special_command_add(session, '?', cmd_search, inc_search, BACKWARD, NULL); girara_special_command_add(session, '?', cmd_search, inc_search, BACKWARD, NULL);
} }
static void static void
cb_sandbox_changed(girara_session_t* session, const char* UNUSED(name), cb_sandbox_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
...@@ -126,7 +126,7 @@ cb_sandbox_changed(girara_session_t* session, const char* UNUSED(name), ...@@ -126,7 +126,7 @@ cb_sandbox_changed(girara_session_t* session, const char* UNUSED(name),
static void static void
cb_window_statbusbar_changed(girara_session_t* session, const char* name, cb_window_statbusbar_changed(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{ {
g_return_if_fail(value != NULL); g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL); g_return_if_fail(session != NULL);
......
...@@ -88,7 +88,7 @@ run_synctex_forward(const char* synctex_fwd, const char* filename, ...@@ -88,7 +88,7 @@ run_synctex_forward(const char* synctex_fwd, const char* filename,
static zathura_t* static zathura_t*
init_zathura(const char* config_dir, const char* data_dir, init_zathura(const char* config_dir, const char* data_dir,
const char* cache_dir, const char* plugin_path, char** argv, const char* cache_dir, const char* plugin_path, char** argv,
char* synctex_editor, Window embed) const char* synctex_editor, Window embed)
{ {
/* create zathura session */ /* create zathura session */
zathura_t* zathura = zathura_create(); zathura_t* zathura = zathura_create();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment