Skip to content

Commit 74de0cb

Browse files
Sampson Gaomhdawson
authored andcommitted
Make Buffer extend Uint8Array
Make Buffer extend Uint8Array instead of directly extending Object PR-URL: #188 Fixes: #109 Reviewed-By: Michael Dawson <[email protected]>
1 parent 7ecab46 commit 74de0cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

napi-inl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,17 +1524,17 @@ inline Buffer<T> Buffer<T>::Copy(napi_env env, const T* data, size_t length) {
15241524
}
15251525

15261526
template <typename T>
1527-
inline Buffer<T>::Buffer() : Object(), _length(0), _data(nullptr) {
1527+
inline Buffer<T>::Buffer() : Uint8Array(), _length(0), _data(nullptr) {
15281528
}
15291529

15301530
template <typename T>
15311531
inline Buffer<T>::Buffer(napi_env env, napi_value value)
1532-
: Object(env, value), _length(0), _data(nullptr) {
1532+
: Uint8Array(env, value), _length(0), _data(nullptr) {
15331533
}
15341534

15351535
template <typename T>
15361536
inline Buffer<T>::Buffer(napi_env env, napi_value value, size_t length, T* data)
1537-
: Object(env, value), _length(length), _data(data) {
1537+
: Uint8Array(env, value), _length(length), _data(data) {
15381538
}
15391539

15401540
template <typename T>

napi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ namespace Napi {
835835
};
836836

837837
template <typename T>
838-
class Buffer : public Object {
838+
class Buffer : public Uint8Array {
839839
public:
840840
static Buffer<T> New(napi_env env, size_t length);
841841
static Buffer<T> New(napi_env env, T* data, size_t length);

0 commit comments

Comments
 (0)