diff --git a/playlist.c b/playlist.c index daf22a81a4..b3674239a5 100644 --- a/playlist.c +++ b/playlist.c @@ -385,11 +385,9 @@ static bool playlist_path_equal(const char *real_path, if (delim) { char compressed_path_b[PATH_MAX_LENGTH]; - unsigned len = (unsigned)(1 + delim - full_path); - + size_t len = (1 + delim - full_path); strlcpy(compressed_path_b, full_path, (len < PATH_MAX_LENGTH ? len : PATH_MAX_LENGTH) * sizeof(char)); - #ifdef _WIN32 /* Handle case-insensitive operating systems*/ if (string_is_equal_noncase(compressed_path_a, compressed_path_b)) diff --git a/retroarch.c b/retroarch.c index b8feeeebec..81732a36ae 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2158,14 +2158,14 @@ struct string_list *dir_list_new_special(const char *input_dir, } static struct string_list *string_list_new_special( - enum string_list_type type, unsigned *len) + enum string_list_type type, size_t *len) { + int i; union string_list_elem_attr attr; - unsigned i; struct string_list *s = string_list_new(); - if (!s || !len) - goto error; + if (!s) + return NULL; attr.i = 0; *len = 0; @@ -2370,24 +2370,21 @@ static struct string_list *string_list_new_special( #endif case STRING_LIST_NONE: default: - goto error; + string_list_free(s); + s = NULL; + return NULL; } return s; - -error: - string_list_free(s); - s = NULL; - return NULL; } const char *char_list_new_special(enum string_list_type type, void *data) { - unsigned len = 0; - struct string_list *s = string_list_new_special(type, &len); - char *opt = (len > 0) ? (char*)calloc(len, sizeof(char)): NULL; + size_t _len = 0; + struct string_list *s = string_list_new_special(type, &_len); + char *opt = (_len > 0) ? (char*)calloc(_len, sizeof(char)): NULL; if (opt && s) - string_list_join_concat(opt, len, s, "|"); + string_list_join_concat(opt, _len, s, "|"); string_list_free(s); s = NULL; return opt; @@ -4507,15 +4504,15 @@ bool command_event(enum event_command cmd, void *data) { #ifdef HAVE_MENU struct string_list *str_list = (struct string_list*)data; - struct menu_state *menu_st = menu_state_get_ptr(); - settings_t *settings = config_get_ptr(); + struct menu_state *menu_st = menu_state_get_ptr(); + settings_t *settings = config_get_ptr(); if (str_list) { if (str_list->size >= 7) { - playlist_config_t playlist_config; playlist_t * playlist; + playlist_config_t playlist_config; struct playlist_entry entry = {0}; bool playlist_sort_alphabetical = settings->bools.playlist_sort_alphabetical; diff --git a/tasks/task_autodetect_blissbox.c b/tasks/task_autodetect_blissbox.c index e101e848d0..14bec7d2ac 100644 --- a/tasks/task_autodetect_blissbox.c +++ b/tasks/task_autodetect_blissbox.c @@ -169,7 +169,7 @@ static const blissbox_pad_type_t* input_autoconfigure_get_blissbox_pad_type_win3 LPTSTR lp_device_path = NULL; char *device_path = NULL; DWORD index = 0; - unsigned len = 0; + size_t len = 0; unsigned i = 0; char vidPidString[32] = {0}; char report[USB_PACKET_CTRL_LEN + 1] = {0}; diff --git a/tasks/task_http.c b/tasks/task_http.c index 31d2d4640b..0b0df5b273 100644 --- a/tasks/task_http.c +++ b/tasks/task_http.c @@ -168,7 +168,6 @@ task_finished: { size_t _len = 0; char *tmp = (char*)net_http_data(http->handle, &_len, false); - struct string_list *headers = net_http_headers(http->handle); if (!tmp) tmp = (char*)net_http_data(http->handle, &_len, true); @@ -177,7 +176,6 @@ task_finished: { if (tmp) free(tmp); - string_list_free(headers); task_set_error(task, strldup("Task cancelled.", sizeof("Task cancelled."))); @@ -187,8 +185,8 @@ task_finished: bool mute; data = (http_transfer_data_t*)malloc(sizeof(*data)); data->data = tmp; - data->headers = headers; data->len = _len; + data->headers = net_http_headers(http->handle); data->status = net_http_status(http->handle); task_set_data(task, data);