Skip to content

Commit

Permalink
src: use non-deprecated v8::Uint8Array::kMaxLength
Browse files Browse the repository at this point in the history
PR-URL: #50115
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
targos committed Jan 4, 2024
1 parent 7166986 commit 1528846
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 @@ -220,9 +221,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 1528846

Please sign in to comment.