From 2b9efcfa943de99f65a56b2f7b6d5cf3e47c2e01 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 2 Jul 2018 10:29:53 +0200 Subject: [PATCH 2/2] Fix miscellaneous compiler warnings Fix all compiler warnings (and one type) except for the deprectation warnings for the gdk_screen_get_monitor_* functions used in the x11 renderer. Signed-off-by: Hans de Goede --- src/libply-splash-core/ply-device-manager.c | 12 ++++++------ src/libply/ply-logger.c | 1 - src/libply/ply-rectangle.c | 5 +++++ src/main.c | 2 +- src/plugins/renderers/frame-buffer/plugin.c | 4 ++-- src/plugins/splash/script/script-lib-sprite.c | 4 ++-- src/plugins/splash/two-step/plugin.c | 2 ++ 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c index b637fb8..18612ac 100644 --- a/src/libply-splash-core/ply-device-manager.c +++ b/src/libply-splash-core/ply-device-manager.c @@ -134,13 +134,13 @@ static void free_devices_from_device_path (ply_device_manager_t *manager, const char *device_path) { - char *key = NULL; - ply_renderer_t *renderer = NULL; + void *key = NULL; + void *renderer = NULL; ply_hashtable_lookup_full (manager->renderers, (void *) device_path, - (void **) &key, - (void **) &renderer); + &key, + &renderer); if (renderer == NULL) return; @@ -696,12 +696,12 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager, (void *) ply_renderer_get_device_name (renderer)); if (old_renderer != NULL) { - ply_trace ("ignoring device %s since it's alerady managed", + ply_trace ("ignoring device %s since it's already managed", ply_renderer_get_device_name (renderer)); ply_renderer_free (renderer); renderer = NULL; - return; + return true; } } } diff --git a/src/libply/ply-logger.c b/src/libply/ply-logger.c index 496b9a5..1178f80 100644 --- a/src/libply/ply-logger.c +++ b/src/libply/ply-logger.c @@ -313,7 +313,6 @@ ply_logger_open_file (ply_logger_t *logger, const char *filename) { int fd; - mode_t mode; assert (logger != NULL); assert (filename != NULL); diff --git a/src/libply/ply-rectangle.c b/src/libply/ply-rectangle.c index a79a21d..8e3875e 100644 --- a/src/libply/ply-rectangle.c +++ b/src/libply/ply-rectangle.c @@ -129,6 +129,7 @@ ply_rectangle_find_overlap (ply_rectangle_t *rectangle1, case V_COLLISION_EXACT: return PLY_RECTANGLE_OVERLAP_EXACT_LEFT_EDGE; } + break; /* Never reached */ case H_COLLISION_RIGHT: switch (v_collision) { case V_COLLISION_NONE: @@ -144,6 +145,7 @@ ply_rectangle_find_overlap (ply_rectangle_t *rectangle1, case V_COLLISION_EXACT: return PLY_RECTANGLE_OVERLAP_EXACT_RIGHT_EDGE; } + break; /* Never reached */ case H_COLLISION_BOTH: switch (v_collision) { case V_COLLISION_NONE: @@ -159,6 +161,7 @@ ply_rectangle_find_overlap (ply_rectangle_t *rectangle1, case V_COLLISION_EXACT: return PLY_RECTANGLE_OVERLAP_ALL_EDGES; } + break; /* Never reached */ case H_COLLISION_CONTAINED: switch (v_collision) { case V_COLLISION_NONE: @@ -174,6 +177,7 @@ ply_rectangle_find_overlap (ply_rectangle_t *rectangle1, case V_COLLISION_EXACT: return PLY_RECTANGLE_OVERLAP_NO_EDGES; } + break; /* Never reached */ case H_COLLISION_EXACT: switch (v_collision) { case V_COLLISION_NONE: @@ -189,6 +193,7 @@ ply_rectangle_find_overlap (ply_rectangle_t *rectangle1, case V_COLLISION_EXACT: return PLY_RECTANGLE_OVERLAP_NO_EDGES; } + break; /* Never reached */ } return PLY_RECTANGLE_OVERLAP_NONE; } diff --git a/src/main.c b/src/main.c index c735a87..09e3c2f 100644 --- a/src/main.c +++ b/src/main.c @@ -907,7 +907,7 @@ plymouth_should_show_default_splash (state_t *state) { ply_trace ("checking if plymouth should show default splash"); - const char const *strings[] = { + const char * const strings[] = { "single", "1", "s", "S", "-S", NULL }; int i; diff --git a/src/plugins/renderers/frame-buffer/plugin.c b/src/plugins/renderers/frame-buffer/plugin.c index 41ad6cd..b4050c5 100644 --- a/src/plugins/renderers/frame-buffer/plugin.c +++ b/src/plugins/renderers/frame-buffer/plugin.c @@ -392,9 +392,9 @@ close_device (ply_renderer_backend_t *backend) backend->head.area.height = 0; } -static const char const *get_visual_name (int visual) +static const char *get_visual_name (int visual) { - static const char const *visuals[] = + static const char * const visuals[] = { [FB_VISUAL_MONO01] = "FB_VISUAL_MONO01", [FB_VISUAL_MONO10] = "FB_VISUAL_MONO10", diff --git a/src/plugins/splash/script/script-lib-sprite.c b/src/plugins/splash/script/script-lib-sprite.c index c49297d..206252b 100644 --- a/src/plugins/splash/script/script-lib-sprite.c +++ b/src/plugins/splash/script/script-lib-sprite.c @@ -462,8 +462,8 @@ static void script_lib_sprite_draw_area (script_lib_display_t *display, /* In that case only draw the background if the sprite doesn't * cover the complete area */ if (position_x > x || position_y > y || - (ply_pixel_buffer_get_width (sprite->image) + position_x) < (x + width) || - (ply_pixel_buffer_get_height (sprite->image) + position_y) < (y + height)) + ((int)ply_pixel_buffer_get_width (sprite->image) + position_x) < (x + width) || + ((int)ply_pixel_buffer_get_height (sprite->image) + position_y) < (y + height)) script_lib_draw_brackground (pixel_buffer, &clip_area, data); } else { script_lib_draw_brackground (pixel_buffer, &clip_area, data); diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index 070741d..944e53a 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -200,6 +200,8 @@ view_load_end_animation (view_t *view) switch (plugin->mode) { case PLY_BOOT_SPLASH_MODE_BOOT_UP: case PLY_BOOT_SPLASH_MODE_UPDATES: + case PLY_BOOT_SPLASH_MODE_INVALID: /* Should never happen */ + default: animation_prefix = "startup-animation-"; break; case PLY_BOOT_SPLASH_MODE_SHUTDOWN: -- 2.17.1