diff --git a/configuration.c b/configuration.c index 0fb9f57d78..8f486e2ea7 100644 --- a/configuration.c +++ b/configuration.c @@ -5192,8 +5192,7 @@ const char *input_config_get_prefix(unsigned user, bool meta) */ static void input_config_save_keybinds_user(config_file_t *conf, unsigned user) { - unsigned i = 0; - + size_t i = 0; for (i = 0; input_config_bind_map_get_valid(i); i++) { char key[64]; @@ -5236,7 +5235,7 @@ static void input_config_save_keybinds_user_override(config_file_t *conf, unsigned user, unsigned bind_id, const struct retro_keybind *override_bind) { - unsigned i = bind_id; + size_t i = bind_id; if (input_config_bind_map_get_valid(i)) { @@ -6613,7 +6612,7 @@ uint8_t input_config_bind_map_get_retro_key(unsigned bind_index) void input_config_reset_autoconfig_binds(unsigned port) { - unsigned i; + size_t i; if (port >= MAX_USERS) return; @@ -6639,7 +6638,7 @@ void input_config_reset_autoconfig_binds(unsigned port) void input_config_set_autoconfig_binds(unsigned port, void *data) { - unsigned i; + size_t i; config_file_t *config = (config_file_t*)data; struct retro_keybind *binds = NULL; @@ -6737,8 +6736,8 @@ void input_config_parse_joy_axis( void *conf_data, const char *prefix, const char *axis, void *bind_data) { - char tmp[64]; - char key[64]; + char tmp[64]; + char key[64]; config_file_t *conf = (config_file_t*)conf_data; struct retro_keybind *bind = (struct retro_keybind*)bind_data; struct config_entry_list *tmp_a = NULL; @@ -6833,8 +6832,7 @@ void input_config_parse_joy_button( tmp[0] = '\0'; - fill_pathname_join_delim(key, s, - "btn", '_', sizeof(key)); + fill_pathname_join_delim(key, s, "btn", '_', sizeof(key)); if (config_get_array(conf, key, tmp, sizeof(tmp))) { diff --git a/database_info.c b/database_info.c index c7c3df8e6e..176af25b74 100644 --- a/database_info.c +++ b/database_info.c @@ -504,7 +504,7 @@ char *bin_to_hex_alloc(const uint8_t *data, size_t len) static int database_cursor_iterate(libretrodb_cursor_t *cur, database_info_t *db_info) { - unsigned i; + size_t i; struct rmsgpack_dom_value item; const char* str = NULL; diff --git a/playlist.c b/playlist.c index d495f8a73d..37aec63d35 100644 --- a/playlist.c +++ b/playlist.c @@ -2578,7 +2578,6 @@ static size_t playlist_get_old_format_metadata_value( static bool playlist_read_file(playlist_t *playlist) { - unsigned i; int test_char; bool res = true; #if defined(HAVE_ZLIB) @@ -2673,6 +2672,7 @@ static bool playlist_read_file(playlist_t *playlist) } else { + size_t i; size_t _len = RBUF_LEN(playlist->entries); char line_buf[PLAYLIST_ENTRIES][PATH_MAX_LENGTH] = {{0}}; @@ -2914,7 +2914,7 @@ bool playlist_init_cached(const playlist_config_t *config) **/ playlist_t *playlist_init(const playlist_config_t *config) { - playlist_t *playlist = (playlist_t*)malloc(sizeof(*playlist)); + playlist_t *playlist = (playlist_t*)malloc(sizeof(*playlist)); if (!playlist) return NULL; @@ -3116,7 +3116,6 @@ static int playlist_qsort_func(const struct playlist_entry *a, ret = strcasecmp(a_str, b_str); end: - a_str = NULL; b_str = NULL; diff --git a/retroarch.c b/retroarch.c index a6d428a5fd..d5b6246312 100644 --- a/retroarch.c +++ b/retroarch.c @@ -576,8 +576,7 @@ midi_driver_t *midi_drivers[] = { static midi_driver_t *midi_driver_find_driver(const char *ident) { - unsigned i; - + size_t i; for (i = 0; i < ARRAY_SIZE(midi_drivers); ++i) { if (string_is_equal(midi_drivers[i]->ident, ident)) @@ -1230,7 +1229,7 @@ static size_t find_driver_nonempty( int driver_find_index(const char *label, const char *drv) { - unsigned i; + size_t i; char str[NAME_MAX_LENGTH]; str[0] = '\0'; @@ -1257,16 +1256,13 @@ int driver_find_index(const char *label, const char *drv) **/ static void driver_find_last(const char *label, char *s, size_t len) { - unsigned i; - + size_t i; for (i = 0; find_driver_nonempty(label, i, s, len) > 0; i++) { } - if (i) i = i - 1; else i = 0; - find_driver_nonempty(label, i, s, len); } @@ -5228,8 +5224,7 @@ bool command_event(enum event_command cmd, void *data) break; case CMD_EVENT_RUMBLE_STOP: { - unsigned i; - + size_t i; for (i = 0; i < MAX_USERS; i++) { unsigned joy_idx = settings->uints.input_joypad_index[i]; @@ -5722,12 +5717,12 @@ void retroarch_override_setting_unset( static void retroarch_override_setting_free_state(void) { - unsigned i; + size_t i; for (i = 0; i < RARCH_OVERRIDE_SETTING_LAST; i++) { if (i == RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE) { - unsigned j; + size_t j; for (j = 0; j < MAX_USERS; j++) retroarch_override_setting_unset( RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &j); @@ -6174,7 +6169,7 @@ const struct retro_subsystem_info *libretro_find_subsystem_info( const struct retro_subsystem_info *info, unsigned num_info, const char *ident) { - unsigned i; + size_t i; for (i = 0; i < num_info; i++) { if ( string_is_equal(info[i].ident, ident) @@ -6203,16 +6198,12 @@ const struct retro_controller_description * libretro_find_controller_description( const struct retro_controller_info *info, unsigned id) { - unsigned i; - + size_t i; for (i = 0; i < info->num_types; i++) { - if (info->types[i].id != id) - continue; - - return &info->types[i]; + if (info->types[i].id == id) + return &info->types[i]; } - return NULL; } @@ -8667,7 +8658,7 @@ bool retroarch_main_quit(void) enum retro_language retroarch_get_language_from_iso(const char *iso639) { - unsigned i; + size_t i; enum retro_language lang = RETRO_LANGUAGE_ENGLISH; struct lang_pair diff --git a/runahead.c b/runahead.c index 16f10276ce..7a75de438a 100644 --- a/runahead.c +++ b/runahead.c @@ -765,7 +765,7 @@ static void runahead_input_state_set_last( unsigned port, unsigned device, unsigned index, unsigned id, int16_t value) { - unsigned i; + size_t i; input_list_element *element = NULL; if (!runloop_st->input_state_list) diff --git a/runloop.c b/runloop.c index 48076bc2dc..ef45c7f448 100644 --- a/runloop.c +++ b/runloop.c @@ -2747,7 +2747,7 @@ bool runloop_environment_cb(unsigned cmd, void *data) case RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO: { - unsigned i; + size_t i; const struct retro_subsystem_info *info = (const struct retro_subsystem_info*)data; unsigned log_level = settings->uints.libretro_log_level; @@ -2801,7 +2801,7 @@ bool runloop_environment_cb(unsigned cmd, void *data) case RETRO_ENVIRONMENT_SET_CONTROLLER_INFO: { - unsigned i, j; + size_t i, j; const struct retro_controller_info *info = (const struct retro_controller_info*)data; unsigned log_level = settings->uints.libretro_log_level; @@ -2846,7 +2846,7 @@ bool runloop_environment_cb(unsigned cmd, void *data) { if (sys_info) { - unsigned i; + size_t i; const struct retro_memory_map *mmaps = (const struct retro_memory_map*)data; rarch_memory_descriptor_t *descriptors = NULL; @@ -4133,7 +4133,7 @@ void runloop_event_deinit_core(void) static bool runloop_path_init_subsystem(runloop_state_t *runloop_st) { - unsigned i, j; + size_t i, j; const struct retro_subsystem_info *info = NULL; rarch_system_info_t *sys_info = &runloop_st->system; bool subsystem_path_empty = path_is_empty(RARCH_PATH_SUBSYSTEM); @@ -8288,7 +8288,7 @@ void runloop_path_deinit_subsystem(void) void runloop_path_set_special(char **argv, unsigned num_content) { - unsigned i; + size_t i; char str[PATH_MAX_LENGTH]; union string_list_elem_attr attr; bool is_dir = false; diff --git a/tasks/task_content.c b/tasks/task_content.c index 765fe5271d..bbda752c9b 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1396,7 +1396,7 @@ static void content_load_init_wrap( static bool content_load(content_ctx_info_t *info, content_state_t *p_content) { - unsigned i; + size_t i; bool success = false; int rarch_argc = 0; char *rarch_argv[MAX_ARGS] = {NULL}; @@ -2777,7 +2777,7 @@ uint8_t content_get_flags(void) /* Clears the pending subsystem rom buffer*/ void content_clear_subsystem(void) { - unsigned i; + size_t i; content_state_t *p_content = content_state_get_ptr(); p_content->pending_subsystem_rom_id = 0; @@ -2828,7 +2828,7 @@ void content_set_subsystem(unsigned idx) /* Sets the subsystem by name */ bool content_set_subsystem_by_name(const char* subsystem_name) { - unsigned i; + size_t i; runloop_state_t *runloop_st = runloop_state_get_ptr(); rarch_system_info_t *sys_info = &runloop_st->system; /* Core not loaded completely, use the data we peeked on load core */ @@ -2853,7 +2853,7 @@ bool content_set_subsystem_by_name(const char* subsystem_name) size_t content_get_subsystem_friendly_name(const char* subsystem_name, char *s, size_t len) { - unsigned i; + size_t i; runloop_state_t *runloop_st = runloop_state_get_ptr(); rarch_system_info_t *sys_info = &runloop_st->system; /* Core not loaded completely, use the data we peeked on load core */ @@ -2918,7 +2918,7 @@ void content_unset_does_not_need_content(void) */ static uint32_t file_crc32(uint32_t crc, const char *path) { - unsigned i; + size_t i; RFILE *file = NULL; unsigned char *buf = NULL; if (!path) diff --git a/verbosity.c b/verbosity.c index 4c6d78124f..86d2ae15fe 100644 --- a/verbosity.c +++ b/verbosity.c @@ -333,7 +333,8 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) void RARCH_LOG_BUFFER(uint8_t *data, size_t len) { - unsigned i, offset; + size_t i; + size_t offset; int padding = len % 16; uint8_t buf[16] = {0};