diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-02-15 12:07:43 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-02-15 12:07:43 -0800 |
commit | 0474ce67908c9afddab69d3f0eb53564b10e2ad1 (patch) | |
tree | 1001922e4cd50887b0c908cbf359d631e2be2586 /src/node_buffer.cc | |
parent | 909a5b39d20f3cb72ed8c102b181ee46b886a54e (diff) | |
download | nodejs-0474ce67908c9afddab69d3f0eb53564b10e2ad1.tar.gz nodejs-0474ce67908c9afddab69d3f0eb53564b10e2ad1.tar.bz2 nodejs-0474ce67908c9afddab69d3f0eb53564b10e2ad1.zip |
Revert "buffer.toString() shouldn't include null values"
This reverts commit 909a5b39d20f3cb72ed8c102b181ee46b886a54e.
Will fix inside V8's String::New instead.
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r-- | src/node_buffer.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc index b7c5d859a..8b48f2a2e 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -232,8 +232,7 @@ Handle<Value> Buffer::AsciiSlice(const Arguments &args) { SLICE_ARGS(args[0], args[1]) char* data = parent->data_ + start; - size_t len = strnlen(data, end - start); - Local<String> string = String::New(data, len); + Local<String> string = String::New(data, end - start); return scope.Close(string); } @@ -243,13 +242,11 @@ Handle<Value> Buffer::Utf8Slice(const Arguments &args) { HandleScope scope; Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This()); SLICE_ARGS(args[0], args[1]) - char* data = parent->data_ + start; - size_t len = strnlen(data, end - start); - Local<String> string = String::New(data, len); + char *data = parent->data_ + start; + Local<String> string = String::New(data, end - start); return scope.Close(string); } - Handle<Value> Buffer::Ucs2Slice(const Arguments &args) { HandleScope scope; Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This()); @@ -259,7 +256,6 @@ Handle<Value> Buffer::Ucs2Slice(const Arguments &args) { return scope.Close(string); } - static const char *base64_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; |