From 1eafb0c596cd0905c31b27483fe68f2fdd1b15bf Mon Sep 17 00:00:00 2001 From: John French Date: Mon, 20 Nov 2017 11:50:23 -0500 Subject: [PATCH] Make Buffer extend Uint8Array Make Buffer extend Uint8Array instead of directly extending Object PR-URL: https://github.com/nodejs/node-addon-api/pull/188 Fixes: https://github.com/nodejs/node-addon-api/issues/109 Reviewed-By: Michael Dawson --- napi-inl.h | 6 +++--- napi.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/napi-inl.h b/napi-inl.h index 6888a6d..4f66cad 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -1524,17 +1524,17 @@ inline Buffer Buffer::Copy(napi_env env, const T* data, size_t length) { } template -inline Buffer::Buffer() : Object(), _length(0), _data(nullptr) { +inline Buffer::Buffer() : Uint8Array(), _length(0), _data(nullptr) { } template inline Buffer::Buffer(napi_env env, napi_value value) - : Object(env, value), _length(0), _data(nullptr) { + : Uint8Array(env, value), _length(0), _data(nullptr) { } template inline Buffer::Buffer(napi_env env, napi_value value, size_t length, T* data) - : Object(env, value), _length(length), _data(data) { + : Uint8Array(env, value), _length(length), _data(data) { } template diff --git a/napi.h b/napi.h index 1fefaa8..0ce29f6 100644 --- a/napi.h +++ b/napi.h @@ -835,7 +835,7 @@ namespace Napi { }; template - class Buffer : public Object { + class Buffer : public Uint8Array { public: static Buffer New(napi_env env, size_t length); static Buffer New(napi_env env, T* data, size_t length);