Hi all,
Can anyone tell me what filename mangling for 8.3 DOS-style filenames has been introduced in recent versions of the FLASHFS?
One of my filenames is being inexplicably renamed from snapshot.dat to SNAPSHOT.DAT, perhaps as a consequence of opening it for append - but I need to investigate a little more.
I am using a parallel FLASH device, not an SPI memory card. I am using the FLASH FS from RTL V3.22.
The FLASH FS from RTL V3.05 did not do this filename alteration.
Many thanks for any info.
Christopher Hicks
I think I have found the bug.
ffind is documented as having the signature:
int ffind ( const char *pattern, /* pattern to match files to */ FINFO *info); /* file info structure */
In the source code fs_ffind.c we find that pattern is copied to a const char *pat (OK, line 49) but then on line 80 the "const" qualifier on the pat is cast away and then pattern is modified in place.
/* Convert pattern to uppercase. */ chr_ptr = (char *) pat; while (*chr_ptr) { if (*chr_ptr >= 'a' && *chr_ptr <= 'z') *chr_ptr &= ~0x20; chr_ptr++; }
Will report this directly to Keil.
CH ==
I checked the release notes for RL-ARM
http://www.keil.com/update/relnotes/rlarmv340.htm
[Flash File System] Changed ffind() function to process filename parameter case insensitive.
It appears Keil did this to be more in line with DOS case insensitivity
Yes, I found that too. However, to implement this new behaviour by casting away a const like this is wrong!
CH
Definitely bad behaviour to try to write to a const pointer - the string may be stored in flash...
This problem has already been corrected in RL-ARM V3.24
I don't think it has been fixed, even in 3.40, but since I am now in direct communication with Keil support about it I will not post here further until I have a definitive answer.
Correction. The bug IS fixed in 3.40, but NOT in 3.24.