From b2fc3b556c5004bb33e211d4347ce07b2e9b187a Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 7 Mar 2018 09:25:38 -0800 Subject: [PATCH] doc: fix n-api example string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - using a length of 6 for `"hello"` includes a terminating null yielding `"hello\u0000"` - length of 5 would work, but comparing to the N-API docs gives `NAPI_AUTO_LENGTH` instead PR-URL: https://github.com/nodejs/node/pull/19205 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index d2f312b06e72fb..4a68b151e4fafa 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -246,7 +246,7 @@ napi_value Method(napi_env env, napi_callback_info args) { napi_value greeting; napi_status status; - status = napi_create_string_utf8(env, "hello", 6, &greeting); + status = napi_create_string_utf8(env, "hello", NAPI_AUTO_LENGTH, &greeting); if (status != napi_ok) return nullptr; return greeting; }