From 004f182e29e728e92912c5f9d966849c1b493b62 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 23 Oct 2024 20:45:47 +0100 Subject: [PATCH] Avoid casting void* to bool directly --- src/menu/views/settings_editor.c | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 55feffea..41d96407 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -12,36 +12,36 @@ static const char *format_switch (bool state) { } static void set_pal60_type (menu_t *menu, void *arg) { - menu->settings.pal60_enabled = (bool) (arg); + menu->settings.pal60_enabled = (bool)(uintptr_t)(arg); settings_save(&menu->settings); } static void set_protected_entries_type (menu_t *menu, void *arg) { - menu->settings.show_protected_entries = (bool) (arg); + menu->settings.show_protected_entries = (bool)(uintptr_t)(arg); settings_save(&menu->settings); menu->browser.reload = true; } static void set_use_saves_folder_type (menu_t *menu, void *arg) { - menu->settings.use_saves_folder = (bool) (arg); + menu->settings.use_saves_folder = (bool)(uintptr_t)(arg); settings_save(&menu->settings); } static void set_sound_enabled_type (menu_t *menu, void *arg) { - menu->settings.sound_enabled = (bool) (arg); + menu->settings.sound_enabled = (bool)(uintptr_t)(arg); sound_use_sfx(menu->settings.sound_enabled); settings_save(&menu->settings); } #ifdef BETA_SETTINGS static void set_bgm_enabled_type (menu_t *menu, void *arg) { - menu->settings.bgm_enabled = (bool) (arg); + menu->settings.bgm_enabled = (bool)(uintptr_t)(arg); settings_save(&menu->settings); } static void set_rumble_enabled_type (menu_t *menu, void *arg) { - menu->settings.rumble_enabled = (bool) (arg); + menu->settings.rumble_enabled = (bool)(uintptr_t)(arg); settings_save(&menu->settings); } @@ -53,39 +53,39 @@ static void set_rumble_enabled_type (menu_t *menu, void *arg) { static component_context_menu_t set_pal60_type_context_menu = { .list = { - {.text = "On", .action = set_pal60_type, .arg = (void *) (true) }, + {.text = "On", .action = set_pal60_type, .arg = (void *)(uintptr_t)(true) }, {.text = "Off", .action = set_pal60_type, .arg = (void *) (false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_protected_entries_type_context_menu = { .list = { - {.text = "On", .action = set_protected_entries_type, .arg = (void *) (true) }, - {.text = "Off", .action = set_protected_entries_type, .arg = (void *) (false) }, + {.text = "On", .action = set_protected_entries_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_protected_entries_type, .arg = (void *)(uintptr_t)(false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_sound_enabled_type_context_menu = { .list = { - {.text = "On", .action = set_sound_enabled_type, .arg = (void *) (true) }, - {.text = "Off", .action = set_sound_enabled_type, .arg = (void *) (false) }, + {.text = "On", .action = set_sound_enabled_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_sound_enabled_type, .arg = (void *)(uintptr_t)(false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_use_saves_folder_type_context_menu = { .list = { - {.text = "On", .action = set_use_saves_folder_type, .arg = (void *) (true) }, - {.text = "Off", .action = set_use_saves_folder_type, .arg = (void *) (false) }, + {.text = "On", .action = set_use_saves_folder_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_use_saves_folder_type, .arg = (void *)(uintptr_t)(false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; #ifdef BETA_SETTINGS static component_context_menu_t set_bgm_enabled_type_context_menu = { .list = { - {.text = "On", .action = set_bgm_enabled_type, .arg = (void *) (true) }, - {.text = "Off", .action = set_bgm_enabled_type, .arg = (void *) (false) }, + {.text = "On", .action = set_bgm_enabled_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_bgm_enabled_type, .arg = (void *)(uintptr_t)(false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = { - {.text = "On", .action = set_rumble_enabled_type, .arg = (void *) (true) }, - {.text = "Off", .action = set_rumble_enabled_type, .arg = (void *) (false) }, + {.text = "On", .action = set_rumble_enabled_type, .arg = (void *)(uintptr_t)(true) }, + {.text = "Off", .action = set_rumble_enabled_type, .arg = (void *)(uintptr_t)(false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; #endif