Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcoded napi_no_external_buffers_allowed value for Node 21 and below #508

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions source/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ AWS_STATIC_ASSERT(NAPI_VERSION >= 4);

/* TODO:
* Hardcoded enum value for `napi_no_external_buffers_allowed`.
* The enum `napi_no_external_buffers_allowed` is introduced in node14.
* Use it for external buffer related changes after bump to node 14 */
* The enum `napi_no_external_buffers_allowed` is introduced in node21 and backport
graebm marked this conversation as resolved.
Show resolved Hide resolved
* to node 14.21.2, 16.19.0, 18.13.0.
* Use `napi_no_external_buffers_allowed` for external buffer related changes after bump to node 21 */
#define NAPI_NO_EXTERNAL_BUFFER_ENUM_VALUE 22

static bool s_tsfn_enabled = false;
Expand Down Expand Up @@ -873,7 +874,7 @@ const char *aws_napi_status_to_str(napi_status status) {
case napi_bigint_expected:
reason = "napi_bigint_expected";
break;
case napi_no_external_buffers_allowed:
case NAPI_NO_EXTERNAL_BUFFER_ENUM_VALUE:
reason = "napi_no_external_buffers_allowed";
break;
}
Expand Down Expand Up @@ -976,7 +977,7 @@ napi_status aws_napi_create_external_arraybuffer(
napi_status external_buffer_status =
napi_create_external_arraybuffer(env, external_data, byte_length, finalize_cb, finalize_hint, result);

if (external_buffer_status == napi_no_external_buffers_allowed) {
if (external_buffer_status == NAPI_NO_EXTERNAL_BUFFER_ENUM_VALUE) {

// The external buffer is disabled, manually copy the external_data into Node
void *napi_buf_data = NULL;
Expand Down
Loading