diff --git a/src/libstd/uv.rs b/src/libstd/uv.rs index 906771d53c87..30c8cbd9c4e0 100644 --- a/src/libstd/uv.rs +++ b/src/libstd/uv.rs @@ -282,7 +282,7 @@ native mod rustrt { addr: *libc::c_void, after_cb: *u8) -> libc::c_int; fn rust_uv_write(req: *libc::c_void, stream: *libc::c_void, - buf_in: *uv_buf_t, buf_cnt: libc::c_int, + buf_in: **libc::c_void, buf_cnt: libc::c_int, cb: *u8) -> libc::c_int; // sizeof testing helpers @@ -336,8 +336,11 @@ mod direct { address, after_connect_cb); } + // TODO github #1402 -- the buf_in is a vector of pointers + // to malloc'd buffers .. these will have to be translated + // back into their value types in c. sigh. unsafe fn write(req: *libc::c_void, stream: *libc::c_void, - buf_in: *[uv_buf_t], cb: *u8) -> libc::c_int { + buf_in: *[*libc::c_void], cb: *u8) -> libc::c_int { let buf_ptr = vec::unsafe::to_ptr(*buf_in); let buf_cnt = vec::len(*buf_in) as i32; ret rustrt::rust_uv_write(req, stream, buf_ptr, buf_cnt, cb); @@ -945,7 +948,7 @@ fn test_uv_timer() { type request_wrapper = { write_req: *uv_write_t, - req_buf: *[uv_buf_t] + req_buf: *[*libc::c_void] }; crust fn on_alloc(handle: *libc::c_void, diff --git a/src/rt/rust_uv.cpp b/src/rt/rust_uv.cpp index 54b95ac6fcbc..c62af8edf405 100644 --- a/src/rt/rust_uv.cpp +++ b/src/rt/rust_uv.cpp @@ -302,9 +302,15 @@ rust_uv_tcp_connect(uv_connect_t* connect_ptr, extern "C" int rust_uv_write(uv_write_t* req, uv_stream_t* handle, - uv_buf_t* bufs, int buf_cnt, + void** bufs, int buf_cnt, uv_write_cb cb) { - return uv_write(req, handle, bufs, buf_cnt, cb); + // TODO github #1402 -- convert this array of pointers to + // uv_buf_t into an array of uv_buf_t values + uv_buf_t buf_vals[buf_cnt]; + for(int ctr = 0; ctr < buf_cnt; ctr++) { + buf_vals[ctr] = *((uv_buf_t*)bufs[ctr]); + } + return uv_write(req, handle, buf_vals, buf_cnt, cb); } extern "C" sockaddr_in