Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ginchereau <jasongin@microsoft.com>2017-06-02 22:32:18 +0300
committerJason Ginchereau <jasongin@microsoft.com>2017-06-06 02:34:13 +0300
commitddba969321ba19576eae4455f5093b4bc4d1ff25 (patch)
tree563daa764ac3dd256ce7b7485751602954a1cce5 /test/addons-napi/test_object
parentf29406d735405cc9f3d5f1083e84ecf2914d678d (diff)
test: fix build warning in addons-napi/test_object
PR-URL: https://github.com/nodejs/node/pull/13412 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/addons-napi/test_object')
-rw-r--r--test/addons-napi/test_object/test_object.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/addons-napi/test_object/test_object.c b/test/addons-napi/test_object/test_object.c
index dd2db123f74..383fe46342a 100644
--- a/test/addons-napi/test_object/test_object.c
+++ b/test/addons-napi/test_object/test_object.c
@@ -3,6 +3,8 @@
#include <string.h>
#include <stdlib.h>
+static int test_value = 3;
+
napi_value Get(napi_env env, napi_callback_info info) {
size_t argc = 2;
napi_value args[2];
@@ -145,7 +147,7 @@ napi_value Wrap(napi_env env, napi_callback_info info) {
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL));
int32_t* data = malloc(sizeof(int32_t));
- *data = 3;
+ *data = test_value;
NAPI_CALL(env, napi_wrap(env, arg, data, NULL, NULL, NULL));
return NULL;
}
@@ -155,11 +157,12 @@ napi_value Unwrap(napi_env env, napi_callback_info info) {
napi_value arg;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL));
- int32_t* data;
+ void* data;
NAPI_CALL(env, napi_unwrap(env, arg, &data));
+ bool is_expected = (data != NULL && *(int*)data == 3);
napi_value result;
- NAPI_CALL(env, napi_get_boolean(env, data != NULL && *data == 3, &result));
+ NAPI_CALL(env, napi_get_boolean(env, is_expected, &result));
return result;
}