From 90bcb9427cdbf66caba448d8a7718943cd322aa7 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 1 Apr 2020 17:23:32 -0400 Subject: [PATCH 1/9] doc: clarify behavior of napi_get_typedarray_info Signed-off-by: Michael Dawson Fixes: https://github.com/nodejs/node/issues/32089 --- doc/api/n-api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 6989bcdeab6c69..82d0ac262a422b 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2532,7 +2532,8 @@ napi_status napi_get_typedarray_info(napi_env env, * `[out] length`: The number of elements in the `TypedArray`. * `[out] data`: The data buffer underlying the `TypedArray` adjusted by the `byte_offset` value so that it points to the first element in the - `TypedArray`. + `TypedArray`. If the length of the array is 0 this may be NULL or any + other pointer value. * `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`. * `[out] byte_offset`: The byte offset within the underlying native array at which the first element of the arrays is located. The value for the data From f9bf2e4a2860a63914dbe176e1c805b68c39a815 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 2 Apr 2020 17:52:32 -0400 Subject: [PATCH 2/9] squash:address comments --- doc/api/n-api.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 82d0ac262a422b..ceba7157ab33c1 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2447,7 +2447,8 @@ napi_status napi_get_arraybuffer_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried. -* `[out] data`: The underlying data buffer of the `ArrayBuffer`. +* `[out] data`: The underlying data buffer of the `ArrayBuffer`. If byte_length + is 0 this may be NULL or any other pointer value. * `[out] byte_length`: Length in bytes of the underlying data buffer. Returns `napi_ok` if the API succeeded. @@ -2479,6 +2480,7 @@ napi_status napi_get_buffer_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] value`: `napi_value` representing the `node::Buffer` being queried. * `[out] data`: The underlying data buffer of the `node::Buffer`. + If length is 0 this may be NULL or any other pointer value. * `[out] length`: Length in bytes of the underlying data buffer. Returns `napi_ok` if the API succeeded. @@ -2568,6 +2570,7 @@ napi_status napi_get_dataview_info(napi_env env, properties to query. * `[out] byte_length`: `Number` of bytes in the `DataView`. * `[out] data`: The data buffer underlying the `DataView`. +If byte_length is 0 this may be NULL or any other pointer value. * `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`. * `[out] byte_offset`: The byte offset within the data buffer from which to start projecting the `DataView`. From ee1222e779cb9378ce7ddb50a78b6bd26a60ccfd Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sun, 5 Apr 2020 21:11:42 +0200 Subject: [PATCH 3/9] fixup! doc: clarify behavior of napi_get_typedarray_info --- doc/api/n-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index ceba7157ab33c1..45944df25c8ecb 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2570,7 +2570,7 @@ napi_status napi_get_dataview_info(napi_env env, properties to query. * `[out] byte_length`: `Number` of bytes in the `DataView`. * `[out] data`: The data buffer underlying the `DataView`. -If byte_length is 0 this may be NULL or any other pointer value. + If byte_length is 0 this may be NULL or any other pointer value. * `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`. * `[out] byte_offset`: The byte offset within the data buffer from which to start projecting the `DataView`. From 537e0ac6c60fbd82e5aae29a075494dbb2222d1a Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 8 Apr 2020 10:58:58 -0400 Subject: [PATCH 4/9] Update doc/api/n-api.md Co-Authored-By: Rich Trott --- doc/api/n-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 45944df25c8ecb..0250e5744dae61 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2570,7 +2570,7 @@ napi_status napi_get_dataview_info(napi_env env, properties to query. * `[out] byte_length`: `Number` of bytes in the `DataView`. * `[out] data`: The data buffer underlying the `DataView`. - If byte_length is 0 this may be NULL or any other pointer value. + If byte_length is 0, this may be NULL or any other pointer value. * `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`. * `[out] byte_offset`: The byte offset within the data buffer from which to start projecting the `DataView`. From f385cda4a4a4e596bc89ae93bd095c68e1a84d13 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 8 Apr 2020 10:59:07 -0400 Subject: [PATCH 5/9] Update doc/api/n-api.md Co-Authored-By: Rich Trott --- doc/api/n-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 0250e5744dae61..9344fcf8603622 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2534,7 +2534,7 @@ napi_status napi_get_typedarray_info(napi_env env, * `[out] length`: The number of elements in the `TypedArray`. * `[out] data`: The data buffer underlying the `TypedArray` adjusted by the `byte_offset` value so that it points to the first element in the - `TypedArray`. If the length of the array is 0 this may be NULL or any + `TypedArray`. If the length of the array is 0, this may be NULL or any other pointer value. * `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`. * `[out] byte_offset`: The byte offset within the underlying native array From 49f497d0414eb6339bb9e72ffb6db0969d48cb7d Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 8 Apr 2020 10:59:15 -0400 Subject: [PATCH 6/9] Update doc/api/n-api.md Co-Authored-By: Rich Trott --- doc/api/n-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 9344fcf8603622..500496c208be27 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2480,7 +2480,7 @@ napi_status napi_get_buffer_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] value`: `napi_value` representing the `node::Buffer` being queried. * `[out] data`: The underlying data buffer of the `node::Buffer`. - If length is 0 this may be NULL or any other pointer value. + If length is 0, this may be NULL or any other pointer value. * `[out] length`: Length in bytes of the underlying data buffer. Returns `napi_ok` if the API succeeded. From 5fbd1f0a437ff0c0d70817de4fdcb45292ce2c87 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 8 Apr 2020 10:59:23 -0400 Subject: [PATCH 7/9] Update doc/api/n-api.md Co-Authored-By: Rich Trott --- doc/api/n-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 500496c208be27..73e9242ca48287 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2448,7 +2448,7 @@ napi_status napi_get_arraybuffer_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried. * `[out] data`: The underlying data buffer of the `ArrayBuffer`. If byte_length - is 0 this may be NULL or any other pointer value. + is 0, this may be NULL or any other pointer value. * `[out] byte_length`: Length in bytes of the underlying data buffer. Returns `napi_ok` if the API succeeded. From 0fc56c5cd64436cb88ff8bbd131ed11cc921f892 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 8 Apr 2020 11:18:07 -0400 Subject: [PATCH 8/9] squash: address comments --- doc/api/n-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 73e9242ca48287..88b3bf3a9d20e2 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2448,7 +2448,7 @@ napi_status napi_get_arraybuffer_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] arraybuffer`: `napi_value` representing the `ArrayBuffer` being queried. * `[out] data`: The underlying data buffer of the `ArrayBuffer`. If byte_length - is 0, this may be NULL or any other pointer value. + is `0`, this may be `NULL` or any other pointer value. * `[out] byte_length`: Length in bytes of the underlying data buffer. Returns `napi_ok` if the API succeeded. @@ -2480,7 +2480,7 @@ napi_status napi_get_buffer_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] value`: `napi_value` representing the `node::Buffer` being queried. * `[out] data`: The underlying data buffer of the `node::Buffer`. - If length is 0, this may be NULL or any other pointer value. + If length is `0`, this may be `NULL` or any other pointer value. * `[out] length`: Length in bytes of the underlying data buffer. Returns `napi_ok` if the API succeeded. From c83af7474d3b03657ac24b854782eb769ec0b783 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 8 Apr 2020 11:19:29 -0400 Subject: [PATCH 9/9] squash: address comments --- doc/api/n-api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 88b3bf3a9d20e2..a38ebbd6f8614b 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2534,8 +2534,8 @@ napi_status napi_get_typedarray_info(napi_env env, * `[out] length`: The number of elements in the `TypedArray`. * `[out] data`: The data buffer underlying the `TypedArray` adjusted by the `byte_offset` value so that it points to the first element in the - `TypedArray`. If the length of the array is 0, this may be NULL or any - other pointer value. + `TypedArray`. If the length of the array is `0`, this may be `NULL` or + any other pointer value. * `[out] arraybuffer`: The `ArrayBuffer` underlying the `TypedArray`. * `[out] byte_offset`: The byte offset within the underlying native array at which the first element of the arrays is located. The value for the data @@ -2570,7 +2570,7 @@ napi_status napi_get_dataview_info(napi_env env, properties to query. * `[out] byte_length`: `Number` of bytes in the `DataView`. * `[out] data`: The data buffer underlying the `DataView`. - If byte_length is 0, this may be NULL or any other pointer value. + If byte_length is `0`, this may be `NULL` or any other pointer value. * `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`. * `[out] byte_offset`: The byte offset within the data buffer from which to start projecting the `DataView`.