mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-01-13 15:17:43 +00:00
user_io: fix user_io_get_ext_idx for the nth time
...fix handling of short extensions when one extension is a prefix of the next (like GB with GBC).
This commit is contained in:
parent
207b4570af
commit
4fa14f0fa2
@ -2655,14 +2655,19 @@ char user_io_key_remap(char *s, char action, int tag) {
|
||||
|
||||
unsigned char user_io_ext_idx(const char *name, const char* ext) {
|
||||
unsigned char idx = 0;
|
||||
char ext3[4]; // extension truncated or extended to 3 chars
|
||||
int len = strlen(ext);
|
||||
int extlen;
|
||||
|
||||
const char *nameext = GetExtension(name);
|
||||
if (!nameext) return 0;
|
||||
extlen = strlen(nameext);
|
||||
for (int i=0; i<3; i++) {
|
||||
ext3[i] = i<extlen ? nameext[i] : ' ';
|
||||
}
|
||||
ext3[3] = 0;
|
||||
while((len>3) && *ext) {
|
||||
if(!_strnicmp(nameext,ext,extlen > 3 ? 3 : extlen)) return idx;
|
||||
if(!_strnicmp(ext3,ext,3)) return idx;
|
||||
if(strlen(ext)<=3) break;
|
||||
idx++;
|
||||
ext +=3;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user