diff --git a/configure b/configure index 38a88c93f33..f24ac6bcc55 100755 --- a/configure +++ b/configure @@ -560,6 +560,9 @@ def configure_libuv(o): # assume shared libuv if one of these is set? if options.shared_libuv_libpath: o['libraries'] += ['-L%s' % options.shared_libuv_libpath] + else: + o['variables']['uv_library'] = 'static_library' + if options.shared_libuv_libname: o['libraries'] += ['-l%s' % options.shared_libuv_libname] elif options.shared_libuv: diff --git a/src/node_file.cc b/src/node_file.cc index 9476a1340cb..c860950e343 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -769,12 +769,14 @@ static void WriteBuffer(const FunctionCallbackInfo& args) { buf += off; + uv_buf_t uvbuf = uv_buf_init(const_cast(buf), len); + if (cb->IsFunction()) { - ASYNC_CALL(write, cb, fd, buf, len, pos) + ASYNC_CALL(write, cb, fd, &uvbuf, 1, pos) return; } - SYNC_CALL(write, NULL, fd, buf, len, pos) + SYNC_CALL(write, NULL, fd, &uvbuf, 1, pos) args.GetReturnValue().Set(SYNC_RESULT); } @@ -818,8 +820,10 @@ static void WriteString(const FunctionCallbackInfo& args) { pos = GET_OFFSET(args[2]); cb = args[4]; + uv_buf_t uvbuf = uv_buf_init(const_cast(buf), len); + if (!cb->IsFunction()) { - SYNC_CALL(write, NULL, fd, buf, len, pos) + SYNC_CALL(write, NULL, fd, &uvbuf, 1, pos) if (must_free) delete[] buf; return args.GetReturnValue().Set(SYNC_RESULT); @@ -829,8 +833,8 @@ static void WriteString(const FunctionCallbackInfo& args) { int err = uv_fs_write(env->event_loop(), &req_wrap->req_, fd, - buf, - len, + &uvbuf, + 1, pos, After); req_wrap->object()->Set(env->oncomplete_string(), cb); @@ -896,12 +900,14 @@ static void Read(const FunctionCallbackInfo& args) { buf = buffer_data + off; + uv_buf_t uvbuf = uv_buf_init(const_cast(buf), len); + cb = args[5]; if (cb->IsFunction()) { - ASYNC_CALL(read, cb, fd, buf, len, pos); + ASYNC_CALL(read, cb, fd, &uvbuf, 1, pos); } else { - SYNC_CALL(read, 0, fd, buf, len, pos) + SYNC_CALL(read, 0, fd, &uvbuf, 1, pos) args.GetReturnValue().Set(SYNC_RESULT); } }