aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/ext/byte_buffer.cc
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2017-01-20 13:39:08 -0800
committerGravatar GitHub <noreply@github.com>2017-01-20 13:39:08 -0800
commit28ec869b5a2567cd30a6e3bcc0efbee0ab0ae7f5 (patch)
treebe591d8c9033c3c4aa064b458acc8e7fe62d7598 /src/node/ext/byte_buffer.cc
parentbd827887ffbb57a95990130f585913b13f44a5b7 (diff)
parent2b5cf1ff2681bb94fa1e3651f8ccfc14bdfa71b2 (diff)
Merge pull request #8842 from ctiller/metadata_filter
Metadata handling rewrite
Diffstat (limited to 'src/node/ext/byte_buffer.cc')
-rw-r--r--src/node/ext/byte_buffer.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc
index fc339fc462..7d6fb19860 100644
--- a/src/node/ext/byte_buffer.cc
+++ b/src/node/ext/byte_buffer.cc
@@ -40,6 +40,7 @@
#include "grpc/slice.h"
#include "byte_buffer.h"
+#include "slice.h"
namespace grpc {
namespace node {
@@ -54,10 +55,7 @@ using v8::Value;
grpc_byte_buffer *BufferToByteBuffer(Local<Value> buffer) {
Nan::HandleScope scope;
- int length = ::node::Buffer::Length(buffer);
- char *data = ::node::Buffer::Data(buffer);
- grpc_slice slice = grpc_slice_malloc(length);
- memcpy(GRPC_SLICE_START_PTR(slice), data, length);
+ grpc_slice slice = CreateSliceFromBuffer(buffer);
grpc_byte_buffer *byte_buffer(grpc_raw_byte_buffer_create(&slice, 1));
grpc_slice_unref(slice);
return byte_buffer;