Skip to content

Commit

Permalink
src: use non-deprecated v8::Uint8Array::kMaxLength
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored and nodejs-github-bot committed Oct 20, 2023
1 parent b5d96ae commit 60147e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/node_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace node {

namespace Buffer {

static const size_t kMaxLength = v8::TypedArray::kMaxLength;
static const size_t kMaxLength = v8::Uint8Array::kMaxLength;

typedef void (*FreeCallback)(char* data, void* hint);

Expand Down
8 changes: 5 additions & 3 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "debug_utils-inl.h"
#include "env.h"
#include "node_buffer.h"
#include "v8.h"

// Use ostringstream to print exact-width integer types
Expand Down Expand Up @@ -210,9 +211,10 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,

inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",
v8::TypedArray::kMaxLength);
snprintf(message,
sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",
Buffer::kMaxLength);
return ERR_BUFFER_TOO_LARGE(isolate, message);
}

Expand Down

0 comments on commit 60147e1

Please sign in to comment.