Skip to content

Commit

Permalink
I think fs is finally fully fixed ;D
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachase committed Oct 17, 2017
1 parent c3350e4 commit fe03355
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/fsLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,16 @@ static int fsObjRead(lua_State *L) {
}

size_t dataBufLen = lineStrlen(dataBuf, FS_LINE_INCR);
if (dataBuf[dataBufLen - 1] == '\n' || dataBuf[dataBufLen - 1] == '\r') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
} else if (feof(data->fileStream)) {
if (feof(data->fileStream)) {
data->eof = true;
dataBufLen = ftell(data->fileStream);
lua_pushlstring(L, dataBuf, dataBufLen - st);
free(dataBuf);
return 1;
} else if (dataBuf[dataBufLen - 1] == '\n' || dataBuf[dataBufLen - 1] == '\r') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
}

st = ftell(data->fileStream);
Expand All @@ -341,16 +341,16 @@ static int fsObjRead(lua_State *L) {
}

size_t dataBufLen = lineStrlen(dataBuf, bufLen / sizeof(char));
if (dataBuf[dataBufLen - 1] == '\n') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
} else if (feof(data->fileStream)) {
if (feof(data->fileStream)) {
data->eof = true;
dataBufLen = ftell(data->fileStream);
lua_pushlstring(L, dataBuf, dataBufLen - st);
free(dataBuf);
return 1;
} else if (dataBuf[dataBufLen - 1] == '\n') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
}
}

Expand Down Expand Up @@ -399,16 +399,16 @@ static int fsObjRead(lua_State *L) {
}

size_t dataBufLen = lineStrlen(dataBuf, FS_LINE_INCR);
if (dataBuf[dataBufLen - 1] == '\n' || dataBuf[dataBufLen - 1] == '\r') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
} else if (feof(data->fileStream)) {
if (feof(data->fileStream)) {
data->eof = true;
dataBufLen = ftell(data->fileStream);
lua_pushlstring(L, dataBuf, dataBufLen - st);
free(dataBuf);
return 1;
} else if (dataBuf[dataBufLen - 1] == '\n' || dataBuf[dataBufLen - 1] == '\r') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
}

st = ftell(data->fileStream);
Expand All @@ -427,16 +427,16 @@ static int fsObjRead(lua_State *L) {
}

size_t dataBufLen = lineStrlen(dataBuf, bufLen / sizeof(char));
if (dataBuf[dataBufLen - 1] == '\n' || dataBuf[dataBufLen - 1] == '\r') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
} else if (feof(data->fileStream)) {
if (feof(data->fileStream)) {
data->eof = true;
dataBufLen = ftell(data->fileStream);
lua_pushlstring(L, dataBuf, dataBufLen - st);
free(dataBuf);
return 1;
} else if (dataBuf[dataBufLen - 1] == '\n' || dataBuf[dataBufLen - 1] == '\r') {
lua_pushlstring(L, dataBuf, dataBufLen - 1);
free(dataBuf);
return 1;
}
}
} else {
Expand Down Expand Up @@ -593,7 +593,7 @@ LUALIB_API int luaopen_fs(lua_State *L) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to initialize cwd");
return 2;
}

free(fpath);

luaL_newmetatable(L, "Riko4.fsObj");
Expand Down

0 comments on commit fe03355

Please sign in to comment.