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.
This commit is contained in:
Ben Noordhuis 2013-07-29 05:27:44 +02:00
parent c82cea1ec5
commit 0e7ba080b4
3 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;