diff options
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r-- | firmware/drivers/fat.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 465adec479..cf2665494f 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -1588,8 +1588,10 @@ static int parse_direntry(struct fat_direntry *de, const unsigned char *buf) | |||
1588 | de->wrtdate = BYTES2INT16(buf,FATDIR_WRTDATE); | 1588 | de->wrtdate = BYTES2INT16(buf,FATDIR_WRTDATE); |
1589 | de->wrttime = BYTES2INT16(buf,FATDIR_WRTTIME); | 1589 | de->wrttime = BYTES2INT16(buf,FATDIR_WRTTIME); |
1590 | de->filesize = BYTES2INT32(buf,FATDIR_FILESIZE); | 1590 | de->filesize = BYTES2INT32(buf,FATDIR_FILESIZE); |
1591 | de->firstcluster = ((long)BYTES2INT16(buf,FATDIR_FSTCLUSLO)) | | 1591 | de->firstcluster = ((long)(unsigned)BYTES2INT16(buf,FATDIR_FSTCLUSLO)) | |
1592 | ((long)BYTES2INT16(buf,FATDIR_FSTCLUSHI) << 16); | 1592 | ((long)(unsigned)BYTES2INT16(buf,FATDIR_FSTCLUSHI) << 16); |
1593 | /* The double cast is to prevent a sign-extension to be done on CalmRISC16. | ||
1594 | (the result of the shift is always considered signed) */ | ||
1593 | 1595 | ||
1594 | /* fix the name */ | 1596 | /* fix the name */ |
1595 | for (i=0; (i<8) && (buf[FATDIR_NAME+i] != ' '); i++) | 1597 | for (i=0; (i<8) && (buf[FATDIR_NAME+i] != ' '); i++) |