Browse Source

src: update to latest libuv api

libuv gyp builds now require you to define the library disposition
(static or shared).

Also, libuv now supports vectored IO for file system reads and writes,
update to those function signatures
v0.11.12-release
Timothy J Fontaine 11 years ago
parent
commit
afc29ed397
  1. 3
      configure
  2. 20
      src/node_file.cc

3
configure

@ -560,6 +560,9 @@ def configure_libuv(o):
# assume shared libuv if one of these is set? # assume shared libuv if one of these is set?
if options.shared_libuv_libpath: if options.shared_libuv_libpath:
o['libraries'] += ['-L%s' % options.shared_libuv_libpath] o['libraries'] += ['-L%s' % options.shared_libuv_libpath]
else:
o['variables']['uv_library'] = 'static_library'
if options.shared_libuv_libname: if options.shared_libuv_libname:
o['libraries'] += ['-l%s' % options.shared_libuv_libname] o['libraries'] += ['-l%s' % options.shared_libuv_libname]
elif options.shared_libuv: elif options.shared_libuv:

20
src/node_file.cc

@ -769,12 +769,14 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
buf += off; buf += off;
uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(buf), len);
if (cb->IsFunction()) { if (cb->IsFunction()) {
ASYNC_CALL(write, cb, fd, buf, len, pos) ASYNC_CALL(write, cb, fd, &uvbuf, 1, pos)
return; return;
} }
SYNC_CALL(write, NULL, fd, buf, len, pos) SYNC_CALL(write, NULL, fd, &uvbuf, 1, pos)
args.GetReturnValue().Set(SYNC_RESULT); args.GetReturnValue().Set(SYNC_RESULT);
} }
@ -818,8 +820,10 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
pos = GET_OFFSET(args[2]); pos = GET_OFFSET(args[2]);
cb = args[4]; cb = args[4];
uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(buf), len);
if (!cb->IsFunction()) { if (!cb->IsFunction()) {
SYNC_CALL(write, NULL, fd, buf, len, pos) SYNC_CALL(write, NULL, fd, &uvbuf, 1, pos)
if (must_free) if (must_free)
delete[] buf; delete[] buf;
return args.GetReturnValue().Set(SYNC_RESULT); return args.GetReturnValue().Set(SYNC_RESULT);
@ -829,8 +833,8 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
int err = uv_fs_write(env->event_loop(), int err = uv_fs_write(env->event_loop(),
&req_wrap->req_, &req_wrap->req_,
fd, fd,
buf, &uvbuf,
len, 1,
pos, pos,
After); After);
req_wrap->object()->Set(env->oncomplete_string(), cb); req_wrap->object()->Set(env->oncomplete_string(), cb);
@ -896,12 +900,14 @@ static void Read(const FunctionCallbackInfo<Value>& args) {
buf = buffer_data + off; buf = buffer_data + off;
uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(buf), len);
cb = args[5]; cb = args[5];
if (cb->IsFunction()) { if (cb->IsFunction()) {
ASYNC_CALL(read, cb, fd, buf, len, pos); ASYNC_CALL(read, cb, fd, &uvbuf, 1, pos);
} else { } else {
SYNC_CALL(read, 0, fd, buf, len, pos) SYNC_CALL(read, 0, fd, &uvbuf, 1, pos)
args.GetReturnValue().Set(SYNC_RESULT); args.GetReturnValue().Set(SYNC_RESULT);
} }
} }

Loading…
Cancel
Save