Skip to content

[N-API] napi_get_value_string_length return length as type too small #13458

Description

@dead-claudia

As specified in the N-API documentation, napi_get_value_string_length returns the string length as an int, but the JS spec mandates it to be an unsigned integer at most 253-1. It may be more appropriate here to return a uint64_t instead.

(BTW, I use "return" loosely, in reference to its out parameter.)

Activity

  1. addaleax commented on Jun 4, 2017

    @addaleax
    Member

    That should probably be removed from the API documentation, it’s no longer part of what Node exports. Also, you’re right, and we do use size_t now, which is the appropriate type for this kind of value.

  2. jasongin commented on Jun 5, 2017

    @jasongin
    Member

    Yes, that API was removed because it was ambiguous about the encoding used to determine the length, and it was redundant with napi_get_value_string_utf8/16. The doc is out of date.

    See also #13469 about other areas the doc needs updating.

  3. added
    docIssues and PRs related to Node.js documentation.
    on Jun 5, 2017
  4. mhdawson commented on Jun 5, 2017

    @mhdawson
    Member

    I'll take a look at updating the docs tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.node-apiIssues and PRs related to Node-API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo