Commit 0a404976 authored by Erant's avatar Erant
Browse files

Fix getFSF to abide by the function contract

parent a8166228
...@@ -659,13 +659,19 @@ typedef struct LoadFSF { ...@@ -659,13 +659,19 @@ typedef struct LoadFSF {
static const char *getFSF (lua_State *L, void *ud, size_t *size) { static const char *getFSF (lua_State *L, void *ud, size_t *size) {
LoadFSF *lf = (LoadFSF *)ud; LoadFSF *lf = (LoadFSF *)ud;
(void)L; (void)L;
if (L == NULL && size == NULL) // Direct mode check
return NULL;
if (lf->extraline) { if (lf->extraline) {
lf->extraline = 0; lf->extraline = 0;
*size = 1; *size = 1;
return "\n"; return "\n";
} }
if (fs_eof(lf->f)) return NULL; if (fs_eof(lf->f)) return NULL;
*size = fs_read(lf->f, lf->buff, sizeof(lf->buff)); *size = fs_read(lf->f, lf->buff, sizeof(lf->buff));
return (*size > 0) ? lf->buff : NULL; return (*size > 0) ? lf->buff : NULL;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment