mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-04-28 13:08:19 +00:00
Fix user_io_ext_idx
This commit is contained in:
17
fat_compat.c
17
fat_compat.c
@@ -5,6 +5,7 @@
|
||||
#include "fat_compat.h"
|
||||
#include "fpga.h"
|
||||
#include "attrs.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "FatFs/ff.h"
|
||||
|
||||
@@ -246,22 +247,6 @@ static DIR dir;
|
||||
static FILINFO fil;
|
||||
static unsigned char nNewEntries = 0; // indicates if a new entry has been found (used in scroll mode)
|
||||
|
||||
FAST static int _strnicmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
char c1, c2;
|
||||
int v;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
v = (unsigned int)tolower(c1) - (unsigned int)tolower(c2);
|
||||
}
|
||||
while (v == 0 && c1 != '\0' && --n > 0);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
FAST static int CompareDirEntries(FILINFO *pDirEntry1, FILINFO *pDirEntry2)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -2197,7 +2197,7 @@ unsigned char user_io_ext_idx(const char *name, const char* ext) {
|
||||
const char *nameext = GetExtension(name);
|
||||
if (!nameext) return 0;
|
||||
while((len>3) && *ext) {
|
||||
if(!strncmp(nameext,ext,3)) return idx;
|
||||
if(!_strnicmp(nameext,ext,3)) return idx;
|
||||
if(strlen(ext)<=3) break;
|
||||
idx++;
|
||||
ext +=3;
|
||||
|
||||
19
utils.c
19
utils.c
@@ -1,4 +1,7 @@
|
||||
#include <stddef.h>
|
||||
#include <ctype.h>
|
||||
#include "utils.h"
|
||||
#include "attrs.h"
|
||||
|
||||
unsigned char bin2bcd(unsigned char in) {
|
||||
return 16*(in/10) + (in % 10);
|
||||
@@ -7,3 +10,19 @@ unsigned char bin2bcd(unsigned char in) {
|
||||
unsigned char bcd2bin(unsigned char in) {
|
||||
return 10*(in >> 4) + (in & 0x0f);
|
||||
}
|
||||
|
||||
FAST int _strnicmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
char c1, c2;
|
||||
int v;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
v = (unsigned int)tolower(c1) - (unsigned int)tolower(c2);
|
||||
}
|
||||
while (v == 0 && c1 != '\0' && --n > 0);
|
||||
|
||||
return v;
|
||||
}
|
||||
Reference in New Issue
Block a user