Merge pull request #915 from sonninnos/less-strict-ext
Some checks failed
Crowdin Translation Integration / create_intl_file (push) Has been cancelled

Use less strict extension matching
This commit is contained in:
DarthMew 2024-10-12 12:54:49 +02:00 committed by GitHub
commit 46a8887f91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -4254,13 +4254,13 @@ static bool MDFNI_LoadGame(const char *name)
RFILE *GameFile = NULL;
size_t name_len = strlen(name);
if(name_len > 4 && (
!strcasecmp(name + name_len - 4, ".cue") ||
!strcasecmp(name + name_len - 4, ".ccd") ||
!strcasecmp(name + name_len - 4, ".toc") ||
!strcasecmp(name + name_len - 4, ".m3u") ||
!strcasecmp(name + name_len - 4, ".chd") ||
!strcasecmp(name + name_len - 4, ".pbp")
if(name_len > 3 && (
!strcasecmp(name + name_len - 3, "cue") ||
!strcasecmp(name + name_len - 3, "ccd") ||
!strcasecmp(name + name_len - 3, "toc") ||
!strcasecmp(name + name_len - 3, "m3u") ||
!strcasecmp(name + name_len - 3, "chd") ||
!strcasecmp(name + name_len - 3, "pbp")
))
return MDFNI_LoadCD(name);

View File

@ -48,14 +48,14 @@ CDAccess::~CDAccess()
CDAccess *cdaccess_open_image(bool *success, const char *path, bool image_memcache)
{
size_t path_len = strlen(path);
if (path_len >= 4 && !strcasecmp(path + path_len - 4, ".ccd"))
if (path_len >= 3 && !strcasecmp(path + path_len - 3, "ccd"))
return new CDAccess_CCD(success, path, image_memcache);
#ifdef HAVE_PBP
else if (path_len >= 4 && !strcasecmp(path + path_len - 4, ".pbp"))
else if (path_len >= 3 && !strcasecmp(path + path_len - 3, "pbp"))
return new CDAccess_PBP(path, image_memcache);
#endif
#ifdef HAVE_CHD
else if (path_len >= 4 && !strcasecmp(path + path_len - 4, ".chd"))
else if (path_len >= 3 && !strcasecmp(path + path_len - 3, "chd"))
return new CDAccess_CHD(path, image_memcache);
#endif
return new CDAccess_Image(success, path, image_memcache);