all repos — mgba @ af6ead2c97941b73899ab77c399fa7db2d02c6f8

mGBA Game Boy Advance Emulator

Util: Fix VFile.readline
Jeffrey Pfau jeffrey@endrift.com
Thu, 05 Feb 2015 03:18:37 -0800
commit

af6ead2c97941b73899ab77c399fa7db2d02c6f8

parent

8eeaa11256c9ac4a16eb4bc92188db631a9332f4

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M src/util/vfs.csrc/util/vfs.c

@@ -104,12 +104,13 @@ struct VFileFD* vfd = (struct VFileFD*) vf;

size_t bytesRead = 0; while (bytesRead < size - 1) { size_t newRead = read(vfd->fd, &buffer[bytesRead], 1); - bytesRead += newRead; if (!newRead || buffer[bytesRead] == '\n') { break; } + bytesRead += newRead; } - return buffer[bytesRead] = '\0'; + buffer[bytesRead] = '\0'; + return bytesRead; } ssize_t _vfdWrite(struct VFile* vf, const void* buffer, size_t size) {