Update to latest FatFS version

This commit is contained in:
Bertrand Songis
2019-10-02 17:53:22 +02:00
parent 0c339cf4ca
commit 3581dce96b
17 changed files with 2831 additions and 2198 deletions
+5 -5
View File
@@ -42,8 +42,8 @@ extern bool compare_nocase(const std::string &first, const std::string &second);
char *getFullPath(const std::string &filename)
{
static char full_path[_MAX_LFN + 1]; // TODO optimize that!
f_getcwd(full_path, _MAX_LFN);
static char full_path[FF_MAX_LFN + 1]; // TODO optimize that!
f_getcwd(full_path, FF_MAX_LFN);
strcat(full_path, "/");
strcat(full_path, filename.c_str());
return full_path;
@@ -270,7 +270,7 @@ bool menuRadioSdManagerInfo(event_t event)
#if 0
void onSdManagerMenu(const char * result)
{
TCHAR lfn[_MAX_LFN+1];
TCHAR lfn[FF_MAX_LFN+1];
// TODO possible buffer overflows here!
@@ -284,7 +284,7 @@ void onSdManagerMenu(const char * result)
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
}
else if (result == STR_PASTE) {
f_getcwd(lfn, _MAX_LFN);
f_getcwd(lfn, FF_MAX_LFN);
// if destination is dir, copy into that dir
if (IS_DIRECTORY(line)) {
strcat(lfn, PSTR("/"));
@@ -310,7 +310,7 @@ void onSdManagerMenu(const char * result)
storageDirty(EE_MODEL);
}
else if (result == STR_ASSIGN_SPLASH) {
f_getcwd(lfn, _MAX_LFN);
f_getcwd(lfn, FF_MAX_LFN);
sdCopyFile(line, lfn, SPLASH_FILE, BITMAPS_PATH);
}
else if (result == STR_VIEW_TEXT) {
+1 -1
View File
@@ -136,7 +136,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
FRESULT res = f_opendir(&dir, SCRIPTS_TOOLS_PATH);
if (res == FR_OK) {
for (;;) {
TCHAR path[_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
TCHAR path[FF_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
res = f_readdir(&dir, &fno); /* Read a directory item */
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
if (fno.fattrib & AM_DIR) continue; /* Skip subfolders */
+1 -1
View File
@@ -66,7 +66,7 @@ ZoneOptionValue * ThemeBase::getOptionValue(unsigned int index) const
const char * ThemeBase::getFilePath(const char * filename) const
{
static char path[_MAX_LFN+1] = THEMES_PATH "/";
static char path[FF_MAX_LFN+1] = THEMES_PATH "/";
strcpy(path + sizeof(THEMES_PATH), getName());
int len = sizeof(THEMES_PATH) + strlen(path + sizeof(THEMES_PATH));
path[len] = '/';
@@ -69,7 +69,7 @@ inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
void getSelectionFullPath(char * lfn)
{
f_getcwd(lfn, _MAX_LFN);
f_getcwd(lfn, FF_MAX_LFN);
strcat(lfn, "/");
strcat(lfn, reusableBuffer.sdManager.lines[menuVerticalPosition - HEADER_LINE - menuVerticalOffset]);
}
@@ -135,7 +135,7 @@ void onUpdateStateChanged()
void onSdManagerMenu(const char * result)
{
TCHAR lfn[_MAX_LFN+1];
TCHAR lfn[FF_MAX_LFN+1];
// TODO possible buffer overflows here!
@@ -154,7 +154,7 @@ void onSdManagerMenu(const char * result)
strncpy(clipboard.data.sd.filename, line, CLIPBOARD_PATH_LEN-1);
}
else if (result == STR_PASTE) {
f_getcwd(lfn, _MAX_LFN);
f_getcwd(lfn, FF_MAX_LFN);
// if destination is dir, copy into that dir
if (IS_DIRECTORY(line)) {
strcat(lfn, "/");
@@ -367,7 +367,7 @@ void menuRadioSdManager(event_t _event)
#endif
#if defined(PCBTARANIS)
else if (!READ_ONLY() && !strcasecmp(ext, FIRMWARE_EXT)) {
TCHAR lfn[_MAX_LFN + 1];
TCHAR lfn[FF_MAX_LFN + 1];
getSelectionFullPath(lfn);
if (isBootloader(lfn)) {
POPUP_MENU_ADD_ITEM(STR_FLASH_BOOTLOADER);
+2 -2
View File
@@ -58,7 +58,7 @@ void addRadioScriptTool(uint8_t index, const char * path)
}
if (addRadioTool(index, toolName)) {
char toolPath[_MAX_LFN];
char toolPath[FF_MAX_LFN];
strcpy(toolPath, path);
*((char *)getBasename(toolPath)-1) = '\0';
f_chdir(toolPath);
@@ -105,7 +105,7 @@ void menuRadioTools(event_t event)
FRESULT res = f_opendir(&dir, SCRIPTS_TOOLS_PATH);
if (res == FR_OK) {
for (;;) {
TCHAR path[_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
TCHAR path[FF_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
res = f_readdir(&dir, &fno); /* Read a directory item */
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
if (fno.fattrib & AM_DIR) continue; /* Skip subfolders */