Skip to content

Commit

Permalink
Avoid deprecated TypedArray::kMaxLength field (nodejs#170)
Browse files Browse the repository at this point in the history
Use TypedArray::kMaxByteLength instead.
  • Loading branch information
backes authored and victorgomes committed Apr 23, 2024
1 parent 60a00a8 commit 9b0e08c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 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::Uint8Array::kMaxLength;
static const size_t kMaxLength = v8::TypedArray::kMaxByteLength;

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

Expand Down
7 changes: 3 additions & 4 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,9 @@ 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",
Buffer::kMaxLength);
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%zx bytes",
v8::TypedArray::kMaxByteLength);
return ERR_BUFFER_TOO_LARGE(isolate, message);
}

Expand Down

0 comments on commit 9b0e08c

Please sign in to comment.