Move more code over to menu_hash_to_file_type

This commit is contained in:
twinaphex 2016-06-17 23:27:17 +02:00
parent 14b0b75fe9
commit f76e7549ce
3 changed files with 15 additions and 7 deletions

View File

@ -1771,7 +1771,6 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
char elem1[PATH_MAX_LENGTH] = {0};
bool match_found = false;
struct string_list *tmp_str_list = NULL;
uint32_t hash_value = 0;
playlist_get_index(playlist, j,
NULL, NULL, NULL, NULL,
@ -1787,22 +1786,22 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
if (tmp_str_list->size > 1)
strlcpy(elem1, tmp_str_list->elems[1].data, sizeof(elem1));
hash_value = menu_hash_calculate(elem1);
switch (hash_value)
switch (menu_hash_to_file_type(menu_hash_calculate(elem1)))
{
case MENU_VALUE_CRC:
case MENU_FILE_CRC:
if (string_is_equal(crc_str, elem0))
match_found = true;
break;
case MENU_VALUE_SHA1:
case MENU_FILE_SHA1:
if (string_is_equal(db_info_entry->sha1, elem0))
match_found = true;
break;
case MENU_VALUE_MD5:
case MENU_FILE_MD5:
if (string_is_equal(db_info_entry->md5, elem0))
match_found = true;
break;
default:
break;
}
string_list_free(tmp_str_list);

View File

@ -993,6 +993,12 @@ enum menu_file_type menu_hash_to_file_type(uint32_t hash)
return MENU_FILE_SHADER_PRESET_HLSLP;
case MENU_VALUE_SLANGP:
return MENU_FILE_SHADER_PRESET_SLANGP;
case MENU_VALUE_CRC:
return MENU_FILE_CRC;
case MENU_VALUE_SHA1:
return MENU_FILE_SHA1;
case MENU_VALUE_MD5:
return MENU_FILE_MD5;
default:
break;
}

View File

@ -249,6 +249,9 @@ enum menu_file_type
MENU_FILE_DOWNLOAD_THUMBNAIL,
MENU_FILE_MORE,
MENU_FILE_COMPRESSED,
MENU_FILE_SHA1,
MENU_FILE_MD5,
MENU_FILE_CRC,
MENU_FILE_TYPE_T_LAST
};