diff --git a/command.c b/command.c index d55e8d42ab..f2ab73637a 100644 --- a/command.c +++ b/command.c @@ -183,13 +183,12 @@ typedef struct socklen_t cmd_source_len; } command_network_t; -static void network_command_reply( - command_t *cmd, - const char * data, size_t len) +static void network_command_reply(command_t *cmd, + const char *s, size_t len) { command_network_t *netcmd = (command_network_t*)cmd->userptr; /* Respond (fire and forget since it's UDP) */ - sendto(netcmd->net_fd, data, len, 0, + sendto(netcmd->net_fd, s, len, 0, (struct sockaddr*)&netcmd->cmd_source, netcmd->cmd_source_len); } @@ -280,12 +279,11 @@ typedef struct char stdin_buf[CMD_BUF_SIZE]; } command_stdin_t; -static void stdin_command_reply( - command_t *cmd, - const char * data, size_t len) +static void stdin_command_reply(command_t *cmd, + const char *s, size_t len) { /* Just write to stdout! */ - fwrite(data, 1, len, stdout); + fwrite(s, 1, len, stdout); fflush(stdout); } @@ -445,12 +443,11 @@ typedef struct int last_fd; } command_uds_t; -static void uds_command_reply( - command_t *cmd, - const char * data, size_t len) +static void uds_command_reply(command_t *cmd, + const char *s, size_t len) { command_uds_t *subcmd = (command_uds_t*)cmd->userptr; - write(subcmd->last_fd, data, len); + write(subcmd->last_fd, s, len); } static void uds_command_free(command_t *handle) @@ -1165,8 +1162,8 @@ void command_event_init_controllers(rarch_system_info_t *sys_info, } #ifdef HAVE_CONFIGFILE -static size_t command_event_save_config( - const char *config_path, char *s, size_t len) +static size_t command_event_save_config(const char *config_path, + char *s, size_t len) { size_t _len = 0; bool path_exists = !string_is_empty(config_path); @@ -1238,8 +1235,8 @@ static size_t command_event_undo_load_state(char *s, size_t len) bool command_event_resize_windowed_scale(settings_t *settings, unsigned window_scale) { - unsigned idx = 0; - bool video_fullscreen = settings->bools.video_fullscreen; + unsigned idx = 0; + bool video_fullscreen = settings->bools.video_fullscreen; if (window_scale == 0) return false; diff --git a/menu/menu_explore.c b/menu/menu_explore.c index 1e3e1c3e14..3ac2023da4 100644 --- a/menu/menu_explore.c +++ b/menu/menu_explore.c @@ -550,20 +550,20 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist, rdb_num = RHMAP_GET(rdb_indices, rdb_hash); if (!rdb_num) { - size_t systemname_len; + size_t _len; struct explore_rdb newrdb; - char *ext_path = NULL; + char *ext_path = NULL; - newrdb.handle = libretrodb_new(); - newrdb.count = 0; - newrdb.playlist_crcs = NULL; - newrdb.playlist_names = NULL; + newrdb.handle = libretrodb_new(); + newrdb.count = 0; + newrdb.playlist_crcs = NULL; + newrdb.playlist_names = NULL; - systemname_len = db_ext - db_name; - if (systemname_len >= sizeof(newrdb.systemname)) - systemname_len = sizeof(newrdb.systemname)-1; - memcpy(newrdb.systemname, db_name, systemname_len); - newrdb.systemname[systemname_len] = '\0'; + _len = db_ext - db_name; + if (_len >= sizeof(newrdb.systemname)) + _len = sizeof(newrdb.systemname)-1; + memcpy(newrdb.systemname, db_name, _len); + newrdb.systemname[_len] = '\0'; fill_pathname_join_special( tmp, directory_database, db_name, sizeof(tmp)); @@ -971,7 +971,8 @@ static void explore_action_find_complete(void *userdata, const char *line) } } -static int explore_action_ok_find(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) +static int explore_action_ok_find(const char *path, const char *label, + unsigned type, size_t idx, size_t entry_idx) { menu_input_ctx_line_t line; line.label = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SEARCH); @@ -983,8 +984,8 @@ static int explore_action_ok_find(const char *path, const char *label, unsigned return 0; } -static const char* explore_get_view_path(struct menu_state *menu_st, menu_list_t *menu_list, - file_list_t *menu_stack) +static const char* explore_get_view_path(struct menu_state *menu_st, + menu_list_t *menu_list, file_list_t *menu_stack) { struct item_file *cur = (struct item_file *)&menu_stack->list[menu_stack->size - 1]; @@ -994,13 +995,16 @@ static const char* explore_get_view_path(struct menu_state *menu_st, menu_list_t const menu_ctx_driver_t *driver_ctx = menu_st->driver_ctx; if (driver_ctx->list_get_entry) { - size_t selection = driver_ctx->list_get_selection ? driver_ctx->list_get_selection(menu_st->userdata) : 0; - size_t _len = driver_ctx->list_get_size ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0; + size_t selection = driver_ctx->list_get_selection + ? driver_ctx->list_get_selection(menu_st->userdata) : 0; + size_t _len = driver_ctx->list_get_size + ? driver_ctx->list_get_size(menu_st->userdata, MENU_LIST_TABS) : 0; if (selection > 0 && _len > 0) { struct item_file *item = NULL; /* Label contains the path and path contains the label */ - if ((item = (struct item_file*)driver_ctx->list_get_entry(menu_st->userdata, MENU_LIST_HORIZONTAL, + if ((item = (struct item_file*)driver_ctx->list_get_entry( + menu_st->userdata, MENU_LIST_HORIZONTAL, (unsigned)(selection - (_len +1))))) return item->label; } @@ -1029,7 +1033,8 @@ static void explore_on_edit_views(enum msg_hash_enums msg) MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); } -static int explore_action_ok_deleteview(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) +static int explore_action_ok_deleteview(const char *path, const char *label, + unsigned type, size_t idx, size_t entry_idx) { struct menu_state *menu_st = menu_state_get_ptr(); menu_list_t *menu_list = menu_st->entries.list; @@ -1151,7 +1156,8 @@ static void explore_action_saveview_complete(void *userdata, const char *name) explore_on_edit_views(MENU_ENUM_LABEL_EXPLORE_VIEW_SAVED); } -static int explore_action_ok_saveview(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) +static int explore_action_ok_saveview(const char *path, const char *label, + unsigned type, size_t idx, size_t entry_idx) { menu_input_ctx_line_t line; line.label = msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_NEW_VIEW); @@ -1446,33 +1452,33 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings) && !explore_by_info[cat].is_boolean && RBUF_LEN(state->by[cat]) > 1)) { - size_t tmplen = strlcpy(tmp, + size_t _len = strlcpy(tmp, msg_hash_to_str(explore_by_info[cat].by_enum), sizeof(tmp)); if (is_top) { if (explore_by_info[cat].is_numeric) - snprintf(tmp + tmplen, - sizeof(tmp) - tmplen, + snprintf(tmp + _len, + sizeof(tmp) - _len, " (%s - %s)", entries[0]->str, entries[RBUF_LEN(entries) - 1]->str); else if (!explore_by_info[cat].is_boolean) { - tmplen += strlcpy (tmp + tmplen, " (", sizeof(tmp) - tmplen); - tmplen += snprintf(tmp + tmplen, sizeof(tmp) - tmplen, + _len += strlcpy (tmp + _len, " (", sizeof(tmp) - _len); + _len += snprintf(tmp + _len, sizeof(tmp) - _len, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ITEMS_COUNT), (unsigned)RBUF_LEN(entries)); - strlcpy(tmp + tmplen, ")", sizeof(tmp) - tmplen); + strlcpy(tmp + _len, ")", sizeof(tmp) - _len); } } else if (i != state->view_levels) { - tmplen += strlcpy(tmp + tmplen, " (", sizeof(tmp) - tmplen); - tmplen += strlcpy(tmp + tmplen, + _len += strlcpy(tmp + _len, " (", sizeof(tmp) - _len); + _len += strlcpy(tmp + _len, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_RANGE_FILTER), - sizeof(tmp) - tmplen); - strlcpy(tmp + tmplen, ")", sizeof(tmp) - tmplen); + sizeof(tmp) - _len); + strlcpy(tmp + _len, ")", sizeof(tmp) - _len); } explore_menu_entry(list, state, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index d167d951ae..6feb13b46f 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -1069,7 +1069,9 @@ static void setting_get_string_representation_int_gpu_index(rarch_setting_t *set { struct string_list *list = video_driver_get_gpu_api_devices(video_context_driver_get_api()); size_t _len = snprintf(s, len, "%d", *setting->value.target.integer); - if (list && (*setting->value.target.integer < (int)list->size) && !string_is_empty(list->elems[*setting->value.target.integer].data)) + if ( list + && (*setting->value.target.integer < (int)list->size) + && !string_is_empty(list->elems[*setting->value.target.integer].data)) { s[ _len] = ' '; s[++_len] = '-'; @@ -1081,8 +1083,7 @@ static void setting_get_string_representation_int_gpu_index(rarch_setting_t *set } static void setting_get_string_representation_int( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (setting) snprintf(s, len, "%d", *setting->value.target.integer); @@ -1259,13 +1260,12 @@ static void setting_get_string_representation_st_dir(rarch_setting_t *setting, char *s, size_t len) { if (setting) -#if IOS { +#if IOS if (*setting->value.target.string) fill_pathname_abbreviate_special(s, setting->value.target.string, len); else strlcpy(s, setting->dir.empty_path, len); - } #else strlcpy(s, *setting->value.target.string @@ -1273,18 +1273,21 @@ static void setting_get_string_representation_st_dir(rarch_setting_t *setting, : setting->dir.empty_path, len); #endif + } } static void setting_get_string_representation_st_path(rarch_setting_t *setting, char *s, size_t len) { if (setting) + { #if IOS fill_pathname_abbreviate_special(s, path_basename(setting->value.target.string), len); #else fill_pathname(s, path_basename(setting->value.target.string), "", len); #endif + } } static void setting_get_string_representation_st_string(rarch_setting_t *setting, @@ -2541,8 +2544,8 @@ static void end_sub_group( /* MENU SETTINGS */ -static int setting_action_ok_bind_all( - rarch_setting_t *setting, size_t idx, bool wraparound) +static int setting_action_ok_bind_all(rarch_setting_t *setting, + size_t idx, bool wraparound) { if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_ALL, setting)) return -1; @@ -2572,7 +2575,8 @@ static int setting_action_ok_bind_all_save_autoconfig( char buf[128]; char msg[NAME_MAX_LENGTH]; config_get_autoconf_profile_filename(name, index_offset, buf, sizeof(buf)); - _len = snprintf(msg, sizeof(msg),msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY_NAMED), buf); + _len = snprintf(msg, sizeof(msg), + msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY_NAMED), buf); runloop_msg_queue_push(msg, _len, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); } @@ -2849,8 +2853,7 @@ static int setting_string_action_ok_microphone_device( #endif static void setting_get_string_representation_streaming_mode( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -2881,8 +2884,7 @@ static void setting_get_string_representation_streaming_mode( } static void setting_get_string_representation_video_stream_quality( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -3036,8 +3038,7 @@ static void setting_get_string_representation_password( #if TARGET_OS_IPHONE static void setting_get_string_representation_uint_keyboard_gamepad_mapping_type( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -3062,8 +3063,7 @@ static void setting_get_string_representation_uint_keyboard_gamepad_mapping_type #ifdef HAVE_TRANSLATE static void setting_get_string_representation_uint_ai_service_mode( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { enum msg_hash_enums enum_idx = MSG_UNKNOWN; if (!setting) @@ -5057,8 +5057,7 @@ static void setting_get_string_representation_crt_switch_resolution_super( } static void setting_get_string_representation_uint_playlist_sublabel_runtime_type( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5081,8 +5080,7 @@ static void setting_get_string_representation_uint_playlist_sublabel_runtime_typ } static void setting_get_string_representation_uint_playlist_sublabel_last_played_style( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5234,8 +5232,7 @@ static void setting_get_string_representation_uint_playlist_sublabel_last_played } static void setting_get_string_representation_uint_playlist_inline_core_display_type( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5264,8 +5261,7 @@ static void setting_get_string_representation_uint_playlist_inline_core_display_ } static void setting_get_string_representation_uint_playlist_entry_remove_enable( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5295,8 +5291,7 @@ static void setting_get_string_representation_uint_playlist_entry_remove_enable( #ifdef _3DS static void setting_get_string_representation_uint_video_3ds_display_mode( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5333,8 +5328,7 @@ static void setting_get_string_representation_uint_video_3ds_display_mode( #if defined(DINGUX) static void setting_get_string_representation_uint_video_dingux_ipu_filter_type( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5364,8 +5358,7 @@ static void setting_get_string_representation_uint_video_dingux_ipu_filter_type( #if defined(DINGUX_BETA) static void setting_get_string_representation_uint_video_dingux_refresh_rate( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5390,8 +5383,7 @@ static void setting_get_string_representation_uint_video_dingux_refresh_rate( #if defined(RS90) || defined(MIYOO) static void setting_get_string_representation_uint_video_dingux_rs90_softfilter_type( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5416,8 +5408,7 @@ static void setting_get_string_representation_uint_video_dingux_rs90_softfilter_ #endif static void setting_get_string_representation_uint_input_auto_game_focus( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5447,8 +5438,7 @@ static void setting_get_string_representation_uint_input_auto_game_focus( #if defined(HAVE_OVERLAY) static void setting_get_string_representation_uint_input_overlay_show_inputs( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -5477,8 +5467,7 @@ static void setting_get_string_representation_uint_input_overlay_show_inputs( } static void setting_get_string_representation_uint_input_overlay_show_inputs_port( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (setting) snprintf(s, len, "%u", @@ -5499,8 +5488,7 @@ static void setting_get_string_representation_overlay_lightgun_port( } static void setting_get_string_representation_overlay_lightgun_action( - rarch_setting_t *setting, - char *s, size_t len) + rarch_setting_t *setting, char *s, size_t len) { if (!setting) return; @@ -23614,7 +23602,7 @@ static bool setting_append_list( parent_group, general_write_handler, general_read_handler, - SD_FLAG_CMD_APPLY_AUTO); + SD_FLAG_CMD_APPLY_AUTO); #endif diff --git a/retroarch.c b/retroarch.c index dc692e4333..a4f47313fb 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2348,11 +2348,11 @@ static struct string_list *string_list_new_special( char zone_desc[TIMEZONE_LENGTH]; while (fgets(zone_desc, TIMEZONE_LENGTH, zones_file)) { - size_t zone_desc_len = strlen(zone_desc); + size_t _len = strlen(zone_desc); - if (zone_desc_len > 0) - if (zone_desc[--zone_desc_len] == '\n') - zone_desc[zone_desc_len] = '\0'; + if (_len > 0) + if (zone_desc[--_len] == '\n') + zone_desc[_len] = '\0'; if (zone_desc && zone_desc[0] != '\0') { diff --git a/runloop.c b/runloop.c index 9f6ce406f7..a33c19f3ab 100644 --- a/runloop.c +++ b/runloop.c @@ -561,7 +561,7 @@ void libretro_get_environment_info( runloop_st->flags &= ~RUNLOOP_FLAG_IGNORE_ENVIRONMENT_CB; } -static dylib_t load_dynamic_core(const char *path, char *buf, +static dylib_t load_dynamic_core(const char *path, char *s, size_t len) { #if defined(ANDROID) @@ -593,7 +593,7 @@ static dylib_t load_dynamic_core(const char *path, char *buf, /* Need to use absolute path for this setting. It can be * saved to content history, and a relative path would * break in that scenario. */ - path_resolve_realpath(buf, len, resolve_symlinks); + path_resolve_realpath(s, len, resolve_symlinks); return dylib_load(path); } @@ -1116,8 +1116,7 @@ static bool validate_per_core_options(char *s, return true; } -static bool validate_game_options( - const char *core_name, +static bool validate_game_options(const char *core_name, char *s, size_t len, bool mkdir) { const char *game_name = path_basename_nocompression(path_get(RARCH_PATH_BASENAME)); @@ -1466,9 +1465,8 @@ bool runloop_environment_cb(unsigned cmd, void *data) case RETRO_ENVIRONMENT_SET_VARIABLE: { + size_t opt_idx, val_idx; const struct retro_variable *var = (const struct retro_variable*)data; - size_t opt_idx; - size_t val_idx; /* If core passes NULL to the callback, return * value indicates whether callback is supported */ @@ -7743,7 +7741,7 @@ void core_run(void) current_core->retro_run(); - + #ifdef HAVE_GAME_AI settings_t *settings = config_get_ptr();