R0.13c patch 2
January 9, 2019 f_readdir() function returns file names with wrong case conversion. When the directory item to be read has a file name within 8.3 format, the extension of file name returned in fname[] is in wrong case conversion depends on the body length and the case.
This commit is contained in:
+4
-2
@@ -2649,6 +2649,7 @@ static void get_fileinfo (
|
|||||||
{
|
{
|
||||||
UINT si, di;
|
UINT si, di;
|
||||||
#if FF_USE_LFN
|
#if FF_USE_LFN
|
||||||
|
BYTE lcf;
|
||||||
WCHAR wc, hs;
|
WCHAR wc, hs;
|
||||||
FATFS *fs = dp->obj.fs;
|
FATFS *fs = dp->obj.fs;
|
||||||
#else
|
#else
|
||||||
@@ -2709,9 +2710,10 @@ static void get_fileinfo (
|
|||||||
if (di == 0) { /* If LFN and SFN both are invalid, this object is inaccesible */
|
if (di == 0) { /* If LFN and SFN both are invalid, this object is inaccesible */
|
||||||
fno->fname[di++] = '?';
|
fno->fname[di++] = '?';
|
||||||
} else {
|
} else {
|
||||||
for (si = di = 0; fno->altname[si]; si++, di++) { /* Copy altname[] to fname[] with case information */
|
for (si = di = 0, lcf = NS_BODY; fno->altname[si]; si++, di++) { /* Copy altname[] to fname[] with case information */
|
||||||
wc = (WCHAR)fno->altname[si];
|
wc = (WCHAR)fno->altname[si];
|
||||||
if (IsUpper(wc) && (dp->dir[DIR_NTres] & ((si >= 9) ? NS_EXT : NS_BODY))) wc += 0x20;
|
if (wc == '.') lcf = NS_EXT;
|
||||||
|
if (IsUpper(wc) && (dp->dir[DIR_NTres] & lcf)) wc += 0x20;
|
||||||
fno->fname[di] = (TCHAR)wc;
|
fno->fname[di] = (TCHAR)wc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user