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

test: fix warning in n-api reference test #12730

Closed
wants to merge 2 commits into from

Conversation

mhdawson
Copy link
Member

Add cast to avoid warning during build of addon.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test, n-api

Add cast to avoid warning during build of addon.
@nodejs-github-bot nodejs-github-bot added node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests. labels Apr 28, 2017
@@ -61,7 +61,7 @@ napi_value CheckExternal(napi_env env, napi_callback_info info) {
NAPI_ASSERT(env, argtype == napi_external, "Expected an external value.")

int* data;
NAPI_CALL(env, napi_get_value_external(env, arg, &data));
NAPI_CALL(env, napi_get_value_external(env, arg, (void*)&data));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be void**, not void*. Alternatively, you could also lose the pointer-to-pointer cast and do it the safe way:

void* data;
napi_get_value_external(env, arg, &data);
data != NULL && *(int*)data == test_value

@mhdawson
Copy link
Member Author

mhdawson commented May 1, 2017

@addaleax pushed commit to fix.

@addaleax
Copy link
Member

addaleax commented May 3, 2017

Landed in 8aca66a

@addaleax addaleax closed this May 3, 2017
addaleax pushed a commit that referenced this pull request May 3, 2017
Add cast to avoid warning during build of addon.

PR-URL: #12730
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
anchnk pushed a commit to anchnk/node that referenced this pull request May 6, 2017
Add cast to avoid warning during build of addon.

PR-URL: nodejs#12730
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@jasnell jasnell mentioned this pull request May 11, 2017
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
@mhdawson mhdawson deleted the fix-napi-warnings branch June 28, 2017 19:24
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
Add cast to avoid warning during build of addon.

PR-URL: nodejs#12730
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
Add cast to avoid warning during build of addon.

Backport-PR-URL: #19447
PR-URL: #12730
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node-api Issues and PRs related to the Node-API. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants