Skip to content

Commit 9b6ddfb

Browse files
committed
Turn iteration variables from unsigned to size_t or int
1 parent fe5ea7a commit 9b6ddfb

File tree

8 files changed

+34
-45
lines changed

8 files changed

+34
-45
lines changed

configuration.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5192,8 +5192,7 @@ const char *input_config_get_prefix(unsigned user, bool meta)
51925192
*/
51935193
static void input_config_save_keybinds_user(config_file_t *conf, unsigned user)
51945194
{
5195-
unsigned i = 0;
5196-
5195+
size_t i = 0;
51975196
for (i = 0; input_config_bind_map_get_valid(i); i++)
51985197
{
51995198
char key[64];
@@ -5236,7 +5235,7 @@ static void input_config_save_keybinds_user_override(config_file_t *conf,
52365235
unsigned user, unsigned bind_id,
52375236
const struct retro_keybind *override_bind)
52385237
{
5239-
unsigned i = bind_id;
5238+
size_t i = bind_id;
52405239

52415240
if (input_config_bind_map_get_valid(i))
52425241
{
@@ -6613,7 +6612,7 @@ uint8_t input_config_bind_map_get_retro_key(unsigned bind_index)
66136612

66146613
void input_config_reset_autoconfig_binds(unsigned port)
66156614
{
6616-
unsigned i;
6615+
size_t i;
66176616

66186617
if (port >= MAX_USERS)
66196618
return;
@@ -6639,7 +6638,7 @@ void input_config_reset_autoconfig_binds(unsigned port)
66396638

66406639
void input_config_set_autoconfig_binds(unsigned port, void *data)
66416640
{
6642-
unsigned i;
6641+
size_t i;
66436642
config_file_t *config = (config_file_t*)data;
66446643
struct retro_keybind *binds = NULL;
66456644

@@ -6737,8 +6736,8 @@ void input_config_parse_joy_axis(
67376736
void *conf_data, const char *prefix,
67386737
const char *axis, void *bind_data)
67396738
{
6740-
char tmp[64];
6741-
char key[64];
6739+
char tmp[64];
6740+
char key[64];
67426741
config_file_t *conf = (config_file_t*)conf_data;
67436742
struct retro_keybind *bind = (struct retro_keybind*)bind_data;
67446743
struct config_entry_list *tmp_a = NULL;
@@ -6833,8 +6832,7 @@ void input_config_parse_joy_button(
68336832

68346833
tmp[0] = '\0';
68356834

6836-
fill_pathname_join_delim(key, s,
6837-
"btn", '_', sizeof(key));
6835+
fill_pathname_join_delim(key, s, "btn", '_', sizeof(key));
68386836

68396837
if (config_get_array(conf, key, tmp, sizeof(tmp)))
68406838
{

database_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ char *bin_to_hex_alloc(const uint8_t *data, size_t len)
504504
static int database_cursor_iterate(libretrodb_cursor_t *cur,
505505
database_info_t *db_info)
506506
{
507-
unsigned i;
507+
size_t i;
508508
struct rmsgpack_dom_value item;
509509
const char* str = NULL;
510510

playlist.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,7 +2578,6 @@ static size_t playlist_get_old_format_metadata_value(
25782578

25792579
static bool playlist_read_file(playlist_t *playlist)
25802580
{
2581-
unsigned i;
25822581
int test_char;
25832582
bool res = true;
25842583
#if defined(HAVE_ZLIB)
@@ -2673,6 +2672,7 @@ static bool playlist_read_file(playlist_t *playlist)
26732672
}
26742673
else
26752674
{
2675+
size_t i;
26762676
size_t _len = RBUF_LEN(playlist->entries);
26772677
char line_buf[PLAYLIST_ENTRIES][PATH_MAX_LENGTH] = {{0}};
26782678

@@ -2914,7 +2914,7 @@ bool playlist_init_cached(const playlist_config_t *config)
29142914
**/
29152915
playlist_t *playlist_init(const playlist_config_t *config)
29162916
{
2917-
playlist_t *playlist = (playlist_t*)malloc(sizeof(*playlist));
2917+
playlist_t *playlist = (playlist_t*)malloc(sizeof(*playlist));
29182918
if (!playlist)
29192919
return NULL;
29202920

@@ -3116,7 +3116,6 @@ static int playlist_qsort_func(const struct playlist_entry *a,
31163116
ret = strcasecmp(a_str, b_str);
31173117

31183118
end:
3119-
31203119
a_str = NULL;
31213120
b_str = NULL;
31223121

retroarch.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ midi_driver_t *midi_drivers[] = {
576576

577577
static midi_driver_t *midi_driver_find_driver(const char *ident)
578578
{
579-
unsigned i;
580-
579+
size_t i;
581580
for (i = 0; i < ARRAY_SIZE(midi_drivers); ++i)
582581
{
583582
if (string_is_equal(midi_drivers[i]->ident, ident))
@@ -1230,7 +1229,7 @@ static size_t find_driver_nonempty(
12301229

12311230
int driver_find_index(const char *label, const char *drv)
12321231
{
1233-
unsigned i;
1232+
size_t i;
12341233
char str[NAME_MAX_LENGTH];
12351234

12361235
str[0] = '\0';
@@ -1257,16 +1256,13 @@ int driver_find_index(const char *label, const char *drv)
12571256
**/
12581257
static void driver_find_last(const char *label, char *s, size_t len)
12591258
{
1260-
unsigned i;
1261-
1259+
size_t i;
12621260
for (i = 0;
12631261
find_driver_nonempty(label, i, s, len) > 0; i++) { }
1264-
12651262
if (i)
12661263
i = i - 1;
12671264
else
12681265
i = 0;
1269-
12701266
find_driver_nonempty(label, i, s, len);
12711267
}
12721268

@@ -5228,8 +5224,7 @@ bool command_event(enum event_command cmd, void *data)
52285224
break;
52295225
case CMD_EVENT_RUMBLE_STOP:
52305226
{
5231-
unsigned i;
5232-
5227+
size_t i;
52335228
for (i = 0; i < MAX_USERS; i++)
52345229
{
52355230
unsigned joy_idx = settings->uints.input_joypad_index[i];
@@ -5722,12 +5717,12 @@ void retroarch_override_setting_unset(
57225717

57235718
static void retroarch_override_setting_free_state(void)
57245719
{
5725-
unsigned i;
5720+
size_t i;
57265721
for (i = 0; i < RARCH_OVERRIDE_SETTING_LAST; i++)
57275722
{
57285723
if (i == RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE)
57295724
{
5730-
unsigned j;
5725+
size_t j;
57315726
for (j = 0; j < MAX_USERS; j++)
57325727
retroarch_override_setting_unset(
57335728
RARCH_OVERRIDE_SETTING_LIBRETRO_DEVICE, &j);
@@ -6174,7 +6169,7 @@ const struct retro_subsystem_info *libretro_find_subsystem_info(
61746169
const struct retro_subsystem_info *info, unsigned num_info,
61756170
const char *ident)
61766171
{
6177-
unsigned i;
6172+
size_t i;
61786173
for (i = 0; i < num_info; i++)
61796174
{
61806175
if ( string_is_equal(info[i].ident, ident)
@@ -6203,16 +6198,12 @@ const struct retro_controller_description *
62036198
libretro_find_controller_description(
62046199
const struct retro_controller_info *info, unsigned id)
62056200
{
6206-
unsigned i;
6207-
6201+
size_t i;
62086202
for (i = 0; i < info->num_types; i++)
62096203
{
6210-
if (info->types[i].id != id)
6211-
continue;
6212-
6213-
return &info->types[i];
6204+
if (info->types[i].id == id)
6205+
return &info->types[i];
62146206
}
6215-
62166207
return NULL;
62176208
}
62186209

@@ -8667,7 +8658,7 @@ bool retroarch_main_quit(void)
86678658

86688659
enum retro_language retroarch_get_language_from_iso(const char *iso639)
86698660
{
8670-
unsigned i;
8661+
size_t i;
86718662
enum retro_language lang = RETRO_LANGUAGE_ENGLISH;
86728663

86738664
struct lang_pair

runahead.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static void runahead_input_state_set_last(
765765
unsigned port, unsigned device,
766766
unsigned index, unsigned id, int16_t value)
767767
{
768-
unsigned i;
768+
size_t i;
769769
input_list_element *element = NULL;
770770

771771
if (!runloop_st->input_state_list)

runloop.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,7 +2747,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
27472747

27482748
case RETRO_ENVIRONMENT_SET_SUBSYSTEM_INFO:
27492749
{
2750-
unsigned i;
2750+
size_t i;
27512751
const struct retro_subsystem_info *info =
27522752
(const struct retro_subsystem_info*)data;
27532753
unsigned log_level = settings->uints.libretro_log_level;
@@ -2801,7 +2801,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
28012801

28022802
case RETRO_ENVIRONMENT_SET_CONTROLLER_INFO:
28032803
{
2804-
unsigned i, j;
2804+
size_t i, j;
28052805
const struct retro_controller_info *info
28062806
= (const struct retro_controller_info*)data;
28072807
unsigned log_level = settings->uints.libretro_log_level;
@@ -2846,7 +2846,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
28462846
{
28472847
if (sys_info)
28482848
{
2849-
unsigned i;
2849+
size_t i;
28502850
const struct retro_memory_map *mmaps =
28512851
(const struct retro_memory_map*)data;
28522852
rarch_memory_descriptor_t *descriptors = NULL;
@@ -4133,7 +4133,7 @@ void runloop_event_deinit_core(void)
41334133

41344134
static bool runloop_path_init_subsystem(runloop_state_t *runloop_st)
41354135
{
4136-
unsigned i, j;
4136+
size_t i, j;
41374137
const struct retro_subsystem_info *info = NULL;
41384138
rarch_system_info_t *sys_info = &runloop_st->system;
41394139
bool subsystem_path_empty = path_is_empty(RARCH_PATH_SUBSYSTEM);
@@ -8288,7 +8288,7 @@ void runloop_path_deinit_subsystem(void)
82888288

82898289
void runloop_path_set_special(char **argv, unsigned num_content)
82908290
{
8291-
unsigned i;
8291+
size_t i;
82928292
char str[PATH_MAX_LENGTH];
82938293
union string_list_elem_attr attr;
82948294
bool is_dir = false;

tasks/task_content.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ static void content_load_init_wrap(
13961396
static bool content_load(content_ctx_info_t *info,
13971397
content_state_t *p_content)
13981398
{
1399-
unsigned i;
1399+
size_t i;
14001400
bool success = false;
14011401
int rarch_argc = 0;
14021402
char *rarch_argv[MAX_ARGS] = {NULL};
@@ -2777,7 +2777,7 @@ uint8_t content_get_flags(void)
27772777
/* Clears the pending subsystem rom buffer*/
27782778
void content_clear_subsystem(void)
27792779
{
2780-
unsigned i;
2780+
size_t i;
27812781
content_state_t *p_content = content_state_get_ptr();
27822782

27832783
p_content->pending_subsystem_rom_id = 0;
@@ -2828,7 +2828,7 @@ void content_set_subsystem(unsigned idx)
28282828
/* Sets the subsystem by name */
28292829
bool content_set_subsystem_by_name(const char* subsystem_name)
28302830
{
2831-
unsigned i;
2831+
size_t i;
28322832
runloop_state_t *runloop_st = runloop_state_get_ptr();
28332833
rarch_system_info_t *sys_info = &runloop_st->system;
28342834
/* 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)
28532853

28542854
size_t content_get_subsystem_friendly_name(const char* subsystem_name, char *s, size_t len)
28552855
{
2856-
unsigned i;
2856+
size_t i;
28572857
runloop_state_t *runloop_st = runloop_state_get_ptr();
28582858
rarch_system_info_t *sys_info = &runloop_st->system;
28592859
/* Core not loaded completely, use the data we peeked on load core */
@@ -2918,7 +2918,7 @@ void content_unset_does_not_need_content(void)
29182918
*/
29192919
static uint32_t file_crc32(uint32_t crc, const char *path)
29202920
{
2921-
unsigned i;
2921+
size_t i;
29222922
RFILE *file = NULL;
29232923
unsigned char *buf = NULL;
29242924
if (!path)

verbosity.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
333333

334334
void RARCH_LOG_BUFFER(uint8_t *data, size_t len)
335335
{
336-
unsigned i, offset;
336+
size_t i;
337+
size_t offset;
337338
int padding = len % 16;
338339
uint8_t buf[16] = {0};
339340

0 commit comments

Comments
 (0)