Skip to content

Commit e653520

Browse files
committed
Fix uv_buf_t declaration on win32
The fields of this structure are mysteriously defined in the opposite order on windows as on unix
1 parent 4178e52 commit e653520

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/rt/rust_uv.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,15 @@ static void write_complete(request *req, int status) {
276276
extern "C" CDECL void aio_writedata(rust_task *task, socket_data *data,
277277
char *buf, size_t size, rust_chan *chan) {
278278
LOG_UPCALL_ENTRY(task);
279+
280+
// uv_buf_t is defined backwards on win32...
281+
// maybe an indication we shouldn't be building directly?
282+
#if defined(__WIN32__)
283+
uv_buf_t buffer = { size, buf };
284+
#else
279285
uv_buf_t buffer = { buf, size };
286+
#endif
287+
280288
request *req = new (data->task, "write request")
281289
request(data, chan, write_complete);
282290
if (!req) {

0 commit comments

Comments
 (0)