From 683632c36cd5874d6e65aa12a503b2cbf5c429a3 Mon Sep 17 00:00:00 2001 From: QC Date: Sun, 18 Oct 2015 19:02:19 +0200 Subject: [PATCH] Some cleanups --- source/helper.c | 7 ++++--- source/rofi.c | 3 ++- source/scrollbar.c | 6 +++--- source/textbox.c | 2 +- test/helper-test.c | 6 ++++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/source/helper.c b/source/helper.c index 0795bdfe..8a77d398 100644 --- a/source/helper.c +++ b/source/helper.c @@ -574,10 +574,11 @@ void config_sanity_check ( Display *display ) } } if ( config.fullscreen && config.monitor != -1 ) { - g_string_append_printf ( msg, "\tconfig.monitor=%d is invalid. Value should be unset (-1) when fullscreen mode is enabled.\n", - config.monitor); + g_string_append_printf ( msg, + "\tconfig.monitor=%d is invalid. Value should be unset (-1) when fullscreen mode is enabled.\n", + config.monitor ); config.monitor = -1; - found_error = 1; + found_error = 1; } // Check size diff --git a/source/rofi.c b/source/rofi.c index abc8a263..ef9bdf9d 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1440,7 +1440,7 @@ void error_dialog ( const char *msg, int markup ) menu_calculate_window_and_element_width ( &state, &mon ); state.max_elements = 0; - state.text = textbox_create ( TB_AUTOHEIGHT | TB_WRAP + ( ( markup ) ? TB_MARKUP : 0 ), + state.text = textbox_create ( ( TB_AUTOHEIGHT | TB_WRAP ) + ( ( markup ) ? TB_MARKUP : 0 ), ( state.border ), ( state.border ), ( state.w - ( 2 * ( state.border ) ) ), 1, NORMAL, ( msg != NULL ) ? msg : "" ); state.line_height = textbox_get_height ( state.text ); @@ -1889,6 +1889,7 @@ static gpointer rofi_signal_handler_process ( gpointer arg ) } } } + return NULL; } /** diff --git a/source/scrollbar.c b/source/scrollbar.c index 21eb7077..eca41127 100644 --- a/source/scrollbar.c +++ b/source/scrollbar.c @@ -64,21 +64,21 @@ void scrollbar_free ( scrollbar *sb ) void scrollbar_set_max_value ( scrollbar *sb, unsigned int max ) { if ( sb != NULL ) { - sb->length = MAX ( 1, max ); + sb->length = MAX ( 1u, max ); } } void scrollbar_set_handle ( scrollbar *sb, unsigned int pos ) { if ( sb != NULL ) { - sb->pos = MIN ( sb->length, MAX ( 0, pos ) ); + sb->pos = MIN ( sb->length, pos ); } } void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length ) { if ( sb != NULL ) { - sb->pos_length = MIN ( sb->length, MAX ( 1, pos_length ) ); + sb->pos_length = MIN ( sb->length, MAX ( 1u, pos_length ) ); } } diff --git a/source/textbox.c b/source/textbox.c index 31c9b48e..1e9e8ac5 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -590,7 +590,7 @@ static void textbox_parse_string ( Display *display, const char *str, RowColor return; } char *cstr = g_strdup ( str ); - char *endp; + char *endp = NULL; char *token; int index = 0; for ( token = strtok_r ( cstr, ",", &endp ); token != NULL; token = strtok_r ( NULL, ",", &endp ) ) { diff --git a/test/helper-test.c b/test/helper-test.c index b12969db..096849c2 100644 --- a/test/helper-test.c +++ b/test/helper-test.c @@ -22,11 +22,13 @@ int show_error_message ( const char *msg, int markup ) return 0; } #include -int monitor_get_smallest_size ( Display *d ) +int monitor_get_smallest_size ( G_GNUC_UNUSED Display *d ) { + return 0; } -int monitor_get_dimension ( Display *d, Screen *screen, int monitor, workarea *mon ) +int monitor_get_dimension ( G_GNUC_UNUSED Display *d, G_GNUC_UNUSED Screen *screen, G_GNUC_UNUSED int monitor, G_GNUC_UNUSED workarea *mon ) { + return 0; } int main ( int argc, char ** argv )