diff --git a/lib/sw_services/xilffs/src/ff.c b/lib/sw_services/xilffs/src/ff.c index 7862a67a..e4f42e3c 100644 --- a/lib/sw_services/xilffs/src/ff.c +++ b/lib/sw_services/xilffs/src/ff.c @@ -1658,13 +1658,13 @@ FRESULT dir_find ( dp->lfn_idx = dp->index; /* Start index of LFN */ } /* Check validity of the LFN entry and compare it with given name */ - ord = (c == ord && sum == directory[LDIR_Chksum] && cmp_lfn(dp->lfn, dir)) ? ord - 1 : 0xFF; + ord = (c == ord && sum == directory[LDIR_Chksum] && cmp_lfn(dp->lfn, directory)) ? ord - 1 : 0xFF; } } else { /* An SFN entry is found */ if (!ord && sum == sum_sfn(directory)) { break; /* LFN matched? */ } - if (!(dp->fn[NS] & NS_LOSS) && !mem_cmp(dir, dp->fn, 11)) { + if (!(dp->fn[NS] & NS_LOSS) && !mem_cmp(directory, dp->fn, 11)) { break; /* SFN matched? */ } ord = 0xFF; dp->lfn_idx = 0xFFFF; /* Reset LFN sequence */ @@ -3516,8 +3516,9 @@ FRESULT f_lseek ( if (clst == 0U) { /* When disk gets full, clip file size */ LocOfs = bcs; break; } - } else { + } else #endif + { clst = get_fat(fp->fs, clst); /* Follow cluster chain if not in write mode */ } if (clst == 0xFFFFFFFFU) { @@ -5128,7 +5129,6 @@ int f_printf ( } if (c != '%') { /* Non escape character */ putc_bfd(&pb, c); - } continue; } w = f = 0; diff --git a/lib/sw_services/xilffs/src/include/ff.h b/lib/sw_services/xilffs/src/include/ff.h index 31f04658..f082cd57 100644 --- a/lib/sw_services/xilffs/src/include/ff.h +++ b/lib/sw_services/xilffs/src/include/ff.h @@ -272,7 +272,7 @@ FRESULT f_fdisk (BYTE pdrv, const DWORD szt[], void* work); /* Divide a physic #endif #endif #if _USE_STRFUNC -TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */ +TCHAR* f_gets (TCHAR* buff, s32 len, FIL* fp); /* Get a string from the file */ #if !_FS_READONLY int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */ int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */ diff --git a/lib/sw_services/xilffs/src/include/ffconf.h b/lib/sw_services/xilffs/src/include/ffconf.h index 1c59faca..3002a350 100644 --- a/lib/sw_services/xilffs/src/include/ffconf.h +++ b/lib/sw_services/xilffs/src/include/ffconf.h @@ -5,6 +5,11 @@ #ifndef _FFCONF #define _FFCONF 8051 /* Revision ID */ +#ifdef __cplusplus +extern "C" { +#endif + +#include "xparameters.h" /*---------------------------------------------------------------------------/ / Functions and Buffer Configurations @@ -16,8 +21,11 @@ / the file system object (FATFS) instead of private sector buffer eliminated / from the file object (FIL). */ - -#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */ +#ifdef FILE_SYSTEM_READ_ONLY +#define _FS_READONLY 1 /* 1:Read only */ +#else +#define _FS_READONLY 0 /* 0:Read/Write */ +#endif /* Setting _FS_READONLY to 1 defines read only configuration. This removes / writing functions, f_write(), f_sync(), f_unlink(), f_mkdir(), f_chmod(), / f_rename(), f_truncate() and useless f_getfree(). */ @@ -224,5 +232,8 @@ / PIC32 0 H8/300H 0 x86 0/1 */ +#ifdef __cplusplus +} +#endif #endif /* _FFCONF */