aboutsummaryrefslogtreecommitdiff
path: root/src/stream_wrap.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-02-20 22:06:41 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2013-02-20 22:17:36 +0100
commit9d10bf58a3cd5a61a501e29efd174b4c8fe2b474 (patch)
tree76124f04709ed487b5e364e20085af715714403e /src/stream_wrap.cc
parent6ad792610b9e3a0c96206fc1f6968b0eb69956c1 (diff)
downloadandroid-node-v8-9d10bf58a3cd5a61a501e29efd174b4c8fe2b474.tar.gz
android-node-v8-9d10bf58a3cd5a61a501e29efd174b4c8fe2b474.tar.bz2
android-node-v8-9d10bf58a3cd5a61a501e29efd174b4c8fe2b474.zip
stream_wrap: remove superfluous buffer len check
It's a buffer so it's never bigger than Buffer::kMaxLength bytes, which in turn is always < INT_MAX.
Diffstat (limited to 'src/stream_wrap.cc')
-rw-r--r--src/stream_wrap.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index fc9218e2e6..79b058356d 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -293,14 +293,6 @@ Handle<Value> StreamWrap::WriteBuffer(const Arguments& args) {
Local<Object> buffer_obj = args[0]->ToObject();
size_t offset = 0;
size_t length = Buffer::Length(buffer_obj);
-
- if (length > INT_MAX) {
- uv_err_t err;
- err.code = UV_ENOBUFS;
- SetErrno(err);
- return scope.Close(v8::Null(node_isolate));
- }
-
char* storage = new char[sizeof(WriteWrap)];
WriteWrap* req_wrap = new (storage) WriteWrap();
@@ -317,7 +309,8 @@ Handle<Value> StreamWrap::WriteBuffer(const Arguments& args) {
StreamWrap::AfterWrite);
req_wrap->Dispatched();
- req_wrap->object_->Set(bytes_sym, Number::New((uint32_t) length));
+ req_wrap->object_->Set(bytes_sym,
+ Integer::NewFromUnsigned(length, node_isolate));
wrap->UpdateWriteQueueSize();