From 0e7ba080b4c33c1d5f99268328dbc981595cb6c3 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 29 Jul 2013 05:27:44 +0200 Subject: [PATCH] unix, windows: make buf arg to uv_fs_write const Change the uv_fs_write() prototype so the 'buf' argument is now `const void*` rather than `void*`. The argument is stored in a non-const field in the uv_fs_t but that's inconsequential because the memory it points to is not touched. --- include/uv.h | 2 +- src/unix/fs.c | 4 ++-- src/win/fs.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/uv.h b/include/uv.h index 18fdb319..5c993b45 100644 --- a/include/uv.h +++ b/include/uv.h @@ -1632,7 +1632,7 @@ UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb); UV_EXTERN int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, - void* buf, size_t length, int64_t offset, uv_fs_cb cb); + const void* buf, size_t length, int64_t offset, uv_fs_cb cb); UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb); diff --git a/src/unix/fs.c b/src/unix/fs.c index 75b23437..142e4a0b 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -934,13 +934,13 @@ int uv_fs_utime(uv_loop_t* loop, int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, - void* buf, + const void* buf, size_t len, int64_t off, uv_fs_cb cb) { INIT(WRITE); req->file = file; - req->buf = buf; + req->buf = (void*) buf; req->len = len; req->off = off; POST; diff --git a/src/win/fs.c b/src/win/fs.c index 2ea2cb1c..9d4d7ff8 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -1521,12 +1521,12 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf, } -int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf, +int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file fd, const void* buf, size_t length, int64_t offset, uv_fs_cb cb) { uv_fs_req_init(loop, req, UV_FS_WRITE, cb); req->fd = fd; - req->buf = buf; + req->buf = (void*) buf; req->length = length; req->offset = offset;