From f8a8046948aedc9d96ad81b3894c55d914dbef0f Mon Sep 17 00:00:00 2001 From: ekeeke Date: Tue, 25 Aug 2020 15:56:17 +0200 Subject: [PATCH] [Core/CD] optimized CUE and CHD file detection --- core/cd_hw/cdd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/cd_hw/cdd.c b/core/cd_hw/cdd.c index 32b936f..9b8e821 100644 --- a/core/cd_hw/cdd.c +++ b/core/cd_hw/cdd.c @@ -318,7 +318,7 @@ int cdd_load(char *filename, char *header) return (-1); #if defined(USE_LIBCHDR) - if (!memcmp(".chd", &filename[strlen(filename) - 4], 4) || !memcmp(".CHD", &filename[strlen(filename) - 4], 4)) + if (!memcmp("chd", &filename[strlen(filename) - 3], 3) || !memcmp("CHD", &filename[strlen(filename) - 3], 3)) { int sectors = 0; char metadata[256]; @@ -480,7 +480,7 @@ int cdd_load(char *filename, char *header) strncpy(fname, filename, 256); /* check loaded file extension */ - if (memcmp(".cue", &filename[strlen(filename) - 4], 4) && memcmp(".CUE", &filename[strlen(filename) - 4], 4)) + if (memcmp("cue", &filename[strlen(filename) - 3], 3) && memcmp("CUE", &filename[strlen(filename) - 3], 3)) { int len;