From e7d3099f17b667c1cb2647121f4dcc4ec9f028d2 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 7 Mar 2024 08:32:25 +0000 Subject: [PATCH] Fix: Ignore case of filename extension. This allows decoding `SAMPLE.CAT` as well as `sample.cat`. --- src/catcodec.cpp | 2 +- src/stdafx.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/catcodec.cpp b/src/catcodec.cpp index 0d6a0dc..e96f8e6 100644 --- a/src/catcodec.cpp +++ b/src/catcodec.cpp @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) char sfo_file[1024]; strncpy(sfo_file, argv[2], sizeof(sfo_file)); char *ext = strrchr(sfo_file, '.'); - if (ext == NULL || strlen(ext) != 4 || strcmp(ext, ".cat") != 0) { + if (ext == NULL || strlen(ext) != 4 || strcasecmp(ext, ".cat") != 0) { throw std::string("Unexpected extension; expected \".cat\""); } strcpy(ext, ".sfo"); diff --git a/src/stdafx.h b/src/stdafx.h index d8b4534..b673eea 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -37,6 +37,7 @@ # define UNUSED # define fileno _fileno +# define strcasecmp _stricmp # pragma warning(disable : 4996) // 'strdup' was declared deprecated #elif defined(__GNUC__) # include