|
|
@ -232,7 +232,8 @@ Handle<Value> Buffer::AsciiSlice(const Arguments &args) { |
|
|
|
SLICE_ARGS(args[0], args[1]) |
|
|
|
|
|
|
|
char* data = parent->data_ + start; |
|
|
|
Local<String> string = String::New(data, end - start); |
|
|
|
size_t len = strnlen(data, end - start); |
|
|
|
Local<String> string = String::New(data, len); |
|
|
|
|
|
|
|
return scope.Close(string); |
|
|
|
} |
|
|
@ -242,11 +243,13 @@ 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; |
|
|
|
Local<String> string = String::New(data, end - start); |
|
|
|
char* data = parent->data_ + start; |
|
|
|
size_t len = strnlen(data, end - start); |
|
|
|
Local<String> string = String::New(data, len); |
|
|
|
return scope.Close(string); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Handle<Value> Buffer::Ucs2Slice(const Arguments &args) { |
|
|
|
HandleScope scope; |
|
|
|
Buffer *parent = ObjectWrap::Unwrap<Buffer>(args.This()); |
|
|
@ -256,6 +259,7 @@ Handle<Value> Buffer::Ucs2Slice(const Arguments &args) { |
|
|
|
return scope.Close(string); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const char *base64_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
|
|
|
"abcdefghijklmnopqrstuvwxyz" |
|
|
|
"0123456789+/"; |
|
|
|