From 1119559f7abf93b668703c99a78faabe99548ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Thu, 28 Sep 2023 15:03:19 +0200 Subject: [PATCH] src: use non-deprecated v8::Uint8Array::kMaxLength --- src/node_buffer.h | 2 +- src/node_errors.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/node_buffer.h b/src/node_buffer.h index 606a6f5caa3..81ed9481db6 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -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); diff --git a/src/node_errors.h b/src/node_errors.h index 0f4a2d0cc6e..6fa8b7230ff 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -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 @@ -210,9 +211,10 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env, inline v8::Local 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); }