VFile write should use const void*

This commit is contained in:
Jeffrey Pfau 2014-10-14 03:08:39 -07:00
parent 18e67378fe
commit 69d041d373
3 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ static bool _vfdClose(struct VFile* vf);
static off_t _vfdSeek(struct VFile* vf, off_t offset, int whence); 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 _vfdRead(struct VFile* vf, void* buffer, size_t size);
static ssize_t _vfdReadline(struct VFile* vf, char* 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 ssize_t _vfdWrite(struct VFile* vf, const void* buffer, size_t size);
static void* _vfdMap(struct VFile* vf, size_t size, int flags); static void* _vfdMap(struct VFile* vf, size_t size, int flags);
static void _vfdUnmap(struct VFile* vf, void* memory, size_t size); static void _vfdUnmap(struct VFile* vf, void* memory, size_t size);
static void _vfdTruncate(struct VFile* vf, size_t size); static void _vfdTruncate(struct VFile* vf, size_t size);
@ -96,7 +96,7 @@ ssize_t _vfdReadline(struct VFile* vf, char* buffer, size_t size) {
return buffer[bytesRead] = '\0'; return buffer[bytesRead] = '\0';
} }
ssize_t _vfdWrite(struct VFile* vf, void* buffer, size_t size) { ssize_t _vfdWrite(struct VFile* vf, const void* buffer, size_t size) {
struct VFileFD* vfd = (struct VFileFD*) vf; struct VFileFD* vfd = (struct VFileFD*) vf;
return write(vfd->fd, buffer, size); return write(vfd->fd, buffer, size);
} }

View File

@ -13,7 +13,7 @@ struct VFile {
off_t (*seek)(struct VFile* vf, off_t offset, int whence); off_t (*seek)(struct VFile* vf, off_t offset, int whence);
ssize_t (*read)(struct VFile* vf, void* buffer, size_t size); ssize_t (*read)(struct VFile* vf, void* buffer, size_t size);
ssize_t (*readline)(struct VFile* vf, char* 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); ssize_t (*write)(struct VFile* vf, const void* buffer, size_t size);
void* (*map)(struct VFile* vf, size_t size, int flags); void* (*map)(struct VFile* vf, size_t size, int flags);
void (*unmap)(struct VFile* vf, void* memory, size_t size); void (*unmap)(struct VFile* vf, void* memory, size_t size);
void (*truncate)(struct VFile* vf, size_t size); void (*truncate)(struct VFile* vf, size_t size);

View File

@ -34,7 +34,7 @@ static bool _vfzClose(struct VFile* vf);
static off_t _vfzSeek(struct VFile* vf, off_t offset, int whence); static off_t _vfzSeek(struct VFile* vf, off_t offset, int whence);
static ssize_t _vfzRead(struct VFile* vf, void* buffer, size_t size); static ssize_t _vfzRead(struct VFile* vf, void* buffer, size_t size);
static ssize_t _vfzReadline(struct VFile* vf, char* buffer, size_t size); static ssize_t _vfzReadline(struct VFile* vf, char* buffer, size_t size);
static ssize_t _vfzWrite(struct VFile* vf, void* buffer, size_t size); static ssize_t _vfzWrite(struct VFile* vf, const void* buffer, size_t size);
static void* _vfzMap(struct VFile* vf, size_t size, int flags); static void* _vfzMap(struct VFile* vf, size_t size, int flags);
static void _vfzUnmap(struct VFile* vf, void* memory, size_t size); static void _vfzUnmap(struct VFile* vf, void* memory, size_t size);
static void _vfzTruncate(struct VFile* vf, size_t size); static void _vfzTruncate(struct VFile* vf, size_t size);
@ -194,7 +194,7 @@ ssize_t _vfzReadline(struct VFile* vf, char* buffer, size_t size) {
return buffer[bytesRead] = '\0'; return buffer[bytesRead] = '\0';
} }
ssize_t _vfzWrite(struct VFile* vf, void* buffer, size_t size) { ssize_t _vfzWrite(struct VFile* vf, const void* buffer, size_t size) {
// TODO // TODO
UNUSED(vf); UNUSED(vf);
UNUSED(buffer); UNUSED(buffer);