This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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
  • Loading branch information...
tjfontaine committed Feb 26, 2014
1 parent cd08c8a commit afc29ed397f71ff2ba4fa4518ab546b19123fece
Showing with 16 additions and 7 deletions.
  1. +3 −0 configure
  2. +13 −7 src/node_file.cc
View
@@ -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:
View
@@ -769,12 +769,14 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
buf += off;
+ uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(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<Value>& args) {
pos = GET_OFFSET(args[2]);
cb = args[4];
+ uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(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<Value>& 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<Value>& args) {
buf = buffer_data + off;
+ uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(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);
}
}

0 comments on commit afc29ed

Please sign in to comment.