Get rid of callback function hashes

This commit is contained in:
twinaphex 2018-02-05 19:14:55 +01:00
parent 45cde3c49e
commit 457d543cb1
3 changed files with 19 additions and 21 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 */