diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 247ebba9bb..33148cb6f4 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2266,23 +2266,24 @@ static int action_ok_undo_save_state(const char *path, #ifdef HAVE_ZLIB static void cb_decompressed(void *task_data, void *user_data, const char *err) { - decompress_task_data_t *dec = (decompress_task_data_t*)task_data; + decompress_task_data_t *dec = (decompress_task_data_t*)task_data; + enum msg_hash_enums *enum_idx = (enum msg_hash_enums*)user_data; - if (dec && !err) + if (dec && !err && enum_idx) { - unsigned type_hash = (unsigned)(uintptr_t)user_data; + const char *msg = msg_hash_to_str(*enum_idx); - switch (type_hash) - { - case CB_CORE_UPDATER_DOWNLOAD: - generic_action_ok_command(CMD_EVENT_CORE_INFO_INIT); - break; - case CB_UPDATE_ASSETS: - generic_action_ok_command(CMD_EVENT_REINIT); - break; - } + if (string_is_equal(msg, + msg_hash_to_str(MENU_ENUM_LABEL_CB_CORE_UPDATER_DOWNLOAD))) + generic_action_ok_command(CMD_EVENT_CORE_INFO_INIT); + else if (string_is_equal(msg, + msg_hash_to_str(MENU_ENUM_LABEL_CB_UPDATE_ASSETS))) + generic_action_ok_command(CMD_EVENT_REINIT); } + if (user_data) + free(user_data); + if (err) RARCH_ERR("%s", err); @@ -2538,10 +2539,13 @@ static void cb_generic_download(void *task_data, if (path_is_compressed_file(output_path)) { + enum msg_hash_enums *idx = (enum msg_hash_enums*)calloc(1, sizeof(*idx)); + + *idx = transf->enum_idx; + if (!task_push_decompress(output_path, dir_path, NULL, NULL, NULL, - cb_decompressed, (void*)(uintptr_t) - msg_hash_calculate(msg_hash_to_str(transf->enum_idx)))) + cb_decompressed, idx)) { err = msg_hash_to_str(MSG_DECOMPRESSION_FAILED); goto finish; diff --git a/msg_hash.h b/msg_hash.h index c1188ed066..bd252f8c90 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1735,12 +1735,6 @@ enum msg_hash_enums MSG_LAST }; - -/* Callback strings */ - -#define CB_CORE_UPDATER_DOWNLOAD 0x7412da7dU -#define CB_UPDATE_ASSETS 0xbf85795eU - /* Deferred */ #define MENU_LABEL_DEFERRED_VIDEO_FILTER 0x966ad201U diff --git a/tasks/task_decompress.c b/tasks/task_decompress.c index a0d610cebc..2c3cca0962 100644 --- a/tasks/task_decompress.c +++ b/tasks/task_decompress.c @@ -243,7 +243,7 @@ bool task_check_decompress(const char *source_file) task_finder_data_t find_data; /* Prepare find parameters */ - find_data.func = task_decompress_finder; + find_data.func = task_decompress_finder; find_data.userdata = (void *)source_file; /* Return whether decompressing is in progress or not */