From 9b0e08cb2b50fe104ba038e288911f1409c444b6 Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Tue, 14 Nov 2023 15:21:49 +0100 Subject: [PATCH] Avoid deprecated TypedArray::kMaxLength field (#170) Use TypedArray::kMaxByteLength instead. --- src/node_buffer.h | 2 +- src/node_errors.h | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/node_buffer.h b/src/node_buffer.h index 81ed9481db656b..080dcce21da05c 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::Uint8Array::kMaxLength; +static const size_t kMaxLength = v8::TypedArray::kMaxByteLength; typedef void (*FreeCallback)(char* data, void* hint); diff --git a/src/node_errors.h b/src/node_errors.h index 681e07f2d21711..17725efc2eb165 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -226,10 +226,9 @@ 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", - 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); }