summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2012-05-09 03:54:28 +0200
committerBert Belder <bertbelder@gmail.com>2012-05-09 04:00:02 +0200
commit726ebad9bc89061b20f7b3f857e9683f727c70f9 (patch)
tree46ca374931e70676bf9c33aa40cac3a0ca71ade4 /src
parent0e57aafbb1c4ad9c8157bfe7f5718e867861492e (diff)
downloadnode-726ebad9bc89061b20f7b3f857e9683f727c70f9.tar.gz
StreamWrap::WriteBuffer: remove superfluous arguments
Diffstat (limited to 'src')
-rw-r--r--src/stream_wrap.cc40
1 files changed, 6 insertions, 34 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index e67396c12..7a5e84b56 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -249,23 +249,12 @@ Handle<Value> StreamWrap::WriteBuffer(const Arguments& args) {
UNWRAP
- bool ipc_pipe = wrap->stream_->type == UV_NAMED_PIPE &&
- ((uv_pipe_t*)wrap->stream_)->ipc;
-
// The first argument is a buffer.
- assert(Buffer::HasInstance(args[0]));
+ assert(args.Length() >= 1 && Buffer::HasInstance(args[0]));
Local<Object> buffer_obj = args[0]->ToObject();
size_t offset = 0;
size_t length = Buffer::Length(buffer_obj);
- if (args.Length() > 1) {
- offset = args[1]->IntegerValue();
- }
-
- if (args.Length() > 2) {
- length = args[2]->IntegerValue();
- }
-
if (length > INT_MAX) {
uv_err_t err;
err.code = UV_ENOBUFS;
@@ -282,28 +271,11 @@ Handle<Value> StreamWrap::WriteBuffer(const Arguments& args) {
buf.base = Buffer::Data(buffer_obj) + offset;
buf.len = length;
- int r;
-
- if (!ipc_pipe) {
- r = uv_write(&req_wrap->req_, wrap->stream_, &buf, 1, StreamWrap::AfterWrite);
- } else {
- uv_stream_t* send_stream = NULL;
-
- if (args[3]->IsObject()) {
- Local<Object> send_stream_obj = args[3]->ToObject();
- assert(send_stream_obj->InternalFieldCount() > 0);
- StreamWrap* send_stream_wrap = static_cast<StreamWrap*>(
- send_stream_obj->GetPointerFromInternalField(0));
- send_stream = send_stream_wrap->GetStream();
- }
-
- r = uv_write2(&req_wrap->req_,
- wrap->stream_,
- &buf,
- 1,
- send_stream,
- StreamWrap::AfterWrite);
- }
+ int r = uv_write(&req_wrap->req_,
+ wrap->stream_,
+ &buf,
+ 1,
+ StreamWrap::AfterWrite);
req_wrap->Dispatched();
req_wrap->object_->Set(bytes_sym, Number::New((uint32_t) length));