diff --git a/src/util/vfile.c b/src/util/vfile.c index 60b2356b8..83b7d69cd 100644 --- a/src/util/vfile.c +++ b/src/util/vfile.c @@ -18,10 +18,10 @@ struct VFileFD { }; static bool _vfdClose(struct VFile* vf); -static size_t _vfdSeek(struct VFile* vf, off_t offset, int whence); -static size_t _vfdRead(struct VFile* vf, void* buffer, size_t size); -static size_t _vfdReadline(struct VFile* vf, char* buffer, size_t size); -static size_t _vfdWrite(struct VFile* vf, void* buffer, size_t size); +static off_t _vfdSeek(struct VFile* vf, off_t offset, int whence); +static ssize_t _vfdRead(struct VFile* vf, void* buffer, size_t size); +static ssize_t _vfdReadline(struct VFile* vf, char* buffer, size_t size); +static ssize_t _vfdWrite(struct VFile* vf, void* buffer, size_t size); static void* _vfdMap(struct VFile* vf, size_t size, int flags); static void _vfdUnmap(struct VFile* vf, void* memory, size_t size); static void _vfdTruncate(struct VFile* vf, size_t size); @@ -63,17 +63,17 @@ bool _vfdClose(struct VFile* vf) { return true; } -size_t _vfdSeek(struct VFile* vf, off_t offset, int whence) { +off_t _vfdSeek(struct VFile* vf, off_t offset, int whence) { struct VFileFD* vfd = (struct VFileFD*) vf; return lseek(vfd->fd, offset, whence); } -size_t _vfdRead(struct VFile* vf, void* buffer, size_t size) { +ssize_t _vfdRead(struct VFile* vf, void* buffer, size_t size) { struct VFileFD* vfd = (struct VFileFD*) vf; return read(vfd->fd, buffer, size); } -size_t _vfdReadline(struct VFile* vf, char* buffer, size_t size) { +ssize_t _vfdReadline(struct VFile* vf, char* buffer, size_t size) { struct VFileFD* vfd = (struct VFileFD*) vf; size_t bytesRead = 0; while (bytesRead < size - 1) { @@ -86,7 +86,7 @@ size_t _vfdReadline(struct VFile* vf, char* buffer, size_t size) { return buffer[bytesRead] = '\0'; } -size_t _vfdWrite(struct VFile* vf, void* buffer, size_t size) { +ssize_t _vfdWrite(struct VFile* vf, void* buffer, size_t size) { struct VFileFD* vfd = (struct VFileFD*) vf; return write(vfd->fd, buffer, size); } diff --git a/src/util/vfile.h b/src/util/vfile.h index c80aa9483..a2c176716 100644 --- a/src/util/vfile.h +++ b/src/util/vfile.h @@ -7,10 +7,10 @@ struct VFile { bool (*close)(struct VFile* vf); - size_t (*seek)(struct VFile* vf, off_t offset, int whence); - size_t (*read)(struct VFile* vf, void* buffer, size_t size); - size_t (*readline)(struct VFile* vf, char* buffer, size_t size); - size_t (*write)(struct VFile* vf, void* buffer, size_t size); + off_t (*seek)(struct VFile* vf, off_t offset, int whence); + ssize_t (*read)(struct VFile* vf, void* buffer, size_t size); + ssize_t (*readline)(struct VFile* vf, char* buffer, size_t size); + ssize_t (*write)(struct VFile* vf, void* buffer, size_t size); void* (*map)(struct VFile* vf, size_t size, int flags); void (*unmap)(struct VFile* vf, void* memory, size_t size); void (*truncate)(struct VFile* vf, size_t size);