From 0474ce67908c9afddab69d3f0eb53564b10e2ad1 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 15 Feb 2011 12:07:43 -0800 Subject: Revert "buffer.toString() shouldn't include null values" This reverts commit 909a5b39d20f3cb72ed8c102b181ee46b886a54e. Will fix inside V8's String::New instead. --- src/node_buffer.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/node_buffer.cc') 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 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::New(data, len); + Local string = String::New(data, end - start); return scope.Close(string); } @@ -243,13 +242,11 @@ Handle Buffer::Utf8Slice(const Arguments &args) { HandleScope scope; Buffer *parent = ObjectWrap::Unwrap(args.This()); SLICE_ARGS(args[0], args[1]) - char* data = parent->data_ + start; - size_t len = strnlen(data, end - start); - Local string = String::New(data, len); + char *data = parent->data_ + start; + Local string = String::New(data, end - start); return scope.Close(string); } - Handle Buffer::Ucs2Slice(const Arguments &args) { HandleScope scope; Buffer *parent = ObjectWrap::Unwrap(args.This()); @@ -259,7 +256,6 @@ Handle Buffer::Ucs2Slice(const Arguments &args) { return scope.Close(string); } - static const char *base64_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; -- cgit v1.2.3