From 69d041d3737dafd0d3e6d637c7f234c1ea914ec9 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 14 Oct 2014 03:08:39 -0700 Subject: [PATCH] VFile write should use const void* --- src/util/vfs.c | 4 ++-- src/util/vfs.h | 2 +- src/util/vfs/vfs-zip.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/vfs.c b/src/util/vfs.c index ac8fe4c34..7902d55c0 100644 --- a/src/util/vfs.c +++ b/src/util/vfs.c @@ -24,7 +24,7 @@ static bool _vfdClose(struct VFile* vf); 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 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 _vfdUnmap(struct VFile* vf, void* memory, 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'; } -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; return write(vfd->fd, buffer, size); } diff --git a/src/util/vfs.h b/src/util/vfs.h index 853de9058..cea38aedf 100644 --- a/src/util/vfs.h +++ b/src/util/vfs.h @@ -13,7 +13,7 @@ struct VFile { 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); + ssize_t (*write)(struct VFile* vf, const 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); diff --git a/src/util/vfs/vfs-zip.c b/src/util/vfs/vfs-zip.c index 0a5d34406..21f703690 100644 --- a/src/util/vfs/vfs-zip.c +++ b/src/util/vfs/vfs-zip.c @@ -34,7 +34,7 @@ static bool _vfzClose(struct VFile* vf); 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 _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 _vfzUnmap(struct VFile* vf, void* memory, 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'; } -ssize_t _vfzWrite(struct VFile* vf, void* buffer, size_t size) { +ssize_t _vfzWrite(struct VFile* vf, const void* buffer, size_t size) { // TODO UNUSED(vf); UNUSED(buffer);