Warning fix
This commit is contained in:
+3
-5
@@ -250,14 +250,12 @@ static int io_open (lua_State *L) {
|
|||||||
LStream *p = newfile(L);
|
LStream *p = newfile(L);
|
||||||
#if defined(USE_FATFS)
|
#if defined(USE_FATFS)
|
||||||
BYTE mode;
|
BYTE mode;
|
||||||
if (!strcmp(md, "r"))
|
if (strchr(md, 'w') || strchr(md, 'a'))
|
||||||
mode = FA_READ;
|
|
||||||
else if (!strcmp(md, "w") || !strcmp(md, "a"))
|
|
||||||
mode = FA_WRITE;
|
mode = FA_WRITE;
|
||||||
else
|
else
|
||||||
luaL_argerror(L, (2), ("invalid mode"));
|
mode = FA_READ;
|
||||||
FRESULT result = f_open(&p->f, filename, mode);
|
FRESULT result = f_open(&p->f, filename, mode);
|
||||||
if (result == FR_OK && !strcmp(md, "a"))
|
if (result == FR_OK && strchr(md, 'a'))
|
||||||
result = f_lseek(&p->f, f_size(&p->f));
|
result = f_lseek(&p->f, f_size(&p->f));
|
||||||
return result == FR_OK ? 1 : 0;
|
return result == FR_OK ? 1 : 0;
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user