mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 22:43:41 +00:00
(task_http.c) Cleanups
This commit is contained in:
parent
2ea5dda564
commit
52c2e76ec8
@ -71,17 +71,12 @@ int cb_core_content_list(void *data_, size_t len);
|
||||
|
||||
static http_handle_t *http_ptr;
|
||||
|
||||
void *rarch_main_data_http_get_ptr(void)
|
||||
{
|
||||
return http_ptr;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
static int zlib_extract_core_callback(const char *name, const char *valid_exts,
|
||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||
uint32_t crc32, void *userdata)
|
||||
{
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
/* Make directory */
|
||||
fill_pathname_join(path, (const char*)userdata, name, sizeof(path));
|
||||
@ -122,9 +117,9 @@ error:
|
||||
static int cb_generic_download(void *data, size_t len,
|
||||
const char *dir_path)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char output_path[PATH_MAX_LENGTH];
|
||||
const char *file_ext = NULL;
|
||||
char output_path[PATH_MAX_LENGTH] = {0};
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!data)
|
||||
@ -361,7 +356,7 @@ static int cb_http_conn_default(void *data_, size_t len)
|
||||
**/
|
||||
static int rarch_main_data_http_iterate_poll(http_handle_t *http)
|
||||
{
|
||||
char elem0[PATH_MAX_LENGTH] = {0};
|
||||
char elem0[PATH_MAX_LENGTH];
|
||||
struct string_list *str_list = NULL;
|
||||
const char *url = msg_queue_pull(http->msg_queue);
|
||||
|
||||
@ -374,9 +369,7 @@ static int rarch_main_data_http_iterate_poll(http_handle_t *http)
|
||||
|
||||
str_list = string_split(url, "|");
|
||||
|
||||
if (!str_list)
|
||||
goto error;
|
||||
if (str_list->size < 1)
|
||||
if (!str_list || (str_list->size < 1))
|
||||
goto error;
|
||||
|
||||
strlcpy(elem0, str_list->elems[0].data, sizeof(elem0));
|
||||
@ -428,7 +421,7 @@ static int rarch_main_data_http_iterate_transfer(void *data)
|
||||
|
||||
if (percent > 0)
|
||||
{
|
||||
char tmp[PATH_MAX_LENGTH] = {0};
|
||||
char tmp[PATH_MAX_LENGTH];
|
||||
snprintf(tmp, sizeof(tmp), "%s: %d%%",
|
||||
msg_hash_to_str(MSG_DOWNLOAD_PROGRESS),
|
||||
percent);
|
||||
@ -443,8 +436,7 @@ static int rarch_main_data_http_iterate_transfer(void *data)
|
||||
|
||||
void rarch_main_data_http_iterate(bool is_thread)
|
||||
{
|
||||
http_handle_t *http = (http_handle_t*)
|
||||
rarch_main_data_http_get_ptr();
|
||||
http_handle_t *http = (http_handle_t*)http_ptr;
|
||||
if (!http)
|
||||
return;
|
||||
|
||||
@ -477,8 +469,7 @@ void rarch_main_data_http_iterate(bool is_thread)
|
||||
|
||||
void rarch_main_data_http_init_msg_queue(void)
|
||||
{
|
||||
http_handle_t *http = (http_handle_t*)
|
||||
rarch_main_data_http_get_ptr();
|
||||
http_handle_t *http = (http_handle_t*)http_ptr;
|
||||
if (!http)
|
||||
return;
|
||||
|
||||
@ -489,8 +480,7 @@ void rarch_main_data_http_init_msg_queue(void)
|
||||
|
||||
msg_queue_t *rarch_main_data_http_get_msg_queue_ptr(void)
|
||||
{
|
||||
http_handle_t *http = (http_handle_t*)
|
||||
rarch_main_data_http_get_ptr();
|
||||
http_handle_t *http = (http_handle_t*)http_ptr;
|
||||
if (!http)
|
||||
return NULL;
|
||||
return http->msg_queue;
|
||||
@ -498,8 +488,7 @@ msg_queue_t *rarch_main_data_http_get_msg_queue_ptr(void)
|
||||
|
||||
void *rarch_main_data_http_get_handle(void)
|
||||
{
|
||||
http_handle_t *http = (http_handle_t*)
|
||||
rarch_main_data_http_get_ptr();
|
||||
http_handle_t *http = (http_handle_t*)http_ptr;
|
||||
if (!http)
|
||||
return NULL;
|
||||
if (http->handle == NULL)
|
||||
@ -509,8 +498,7 @@ void *rarch_main_data_http_get_handle(void)
|
||||
|
||||
void *rarch_main_data_http_conn_get_handle(void)
|
||||
{
|
||||
http_handle_t *http = (http_handle_t*)
|
||||
rarch_main_data_http_get_ptr();
|
||||
http_handle_t *http = (http_handle_t*)http_ptr;
|
||||
if (!http)
|
||||
return NULL;
|
||||
if (http->connection.handle == NULL)
|
||||
|
@ -63,8 +63,6 @@ void *rarch_main_data_http_conn_get_handle(void);
|
||||
void rarch_main_data_http_uninit(void);
|
||||
|
||||
void rarch_main_data_http_init(void);
|
||||
|
||||
void *rarch_main_data_http_get_ptr(void);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RPNG
|
||||
|
Loading…
x
Reference in New Issue
Block a user