summaryrefslogtreecommitdiff
path: root/test/js-native-api
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2019-03-09 05:59:24 +0100
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-03-12 06:12:07 +0100
commitb1dce4cfe784344bc012cc4403dc52fb659ff8f4 (patch)
treeee27a45e95fdba158e13a586c9625074b35498ab /test/js-native-api
parent0d94c23c49218d8bff9a8086134356e76903c5fb (diff)
downloadandroid-node-v8-b1dce4cfe784344bc012cc4403dc52fb659ff8f4.tar.gz
android-node-v8-b1dce4cfe784344bc012cc4403dc52fb659ff8f4.tar.bz2
android-node-v8-b1dce4cfe784344bc012cc4403dc52fb659ff8f4.zip
test: fix compiler warning in test_string.c
Currently, the following compiler warnings is generated: ../test_string.c:235:50: warning: incompatible pointer types passing 'char [1]' to parameter of type 'const char16_t *' (aka 'const unsigned short *') [-Wincompatible-pointer-types] NAPI_CALL(env, napi_create_string_utf16(env, "", ((size_t)INT_MAX) + 1, &output)); ^~ ../../common.h:50:23: note: expanded from macro 'NAPI_CALL' NAPI_CALL_BASE(env, the_call, NULL) ^~~~~~~~ ../../common.h:42:10: note: expanded from macro 'NAPI_CALL_BASE' if ((the_call) != napi_ok) { \ ^~~~~~~~ /node/src/js_native_api.h:80:66: note: passing argument to parameter 'str' here const char16_t* str, ^ 1 warning generated. This commit adds a cast to silence this warning. PR-URL: https://github.com/nodejs/node/pull/26539 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/js-native-api')
-rw-r--r--test/js-native-api/test_string/test_string.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/js-native-api/test_string/test_string.c b/test/js-native-api/test_string/test_string.c
index 1f08559140..471678c251 100644
--- a/test/js-native-api/test_string/test_string.c
+++ b/test/js-native-api/test_string/test_string.c
@@ -232,7 +232,9 @@ static napi_value TestLargeLatin1(napi_env env, napi_callback_info info) {
static napi_value TestLargeUtf16(napi_env env, napi_callback_info info) {
napi_value output;
if (SIZE_MAX > INT_MAX) {
- NAPI_CALL(env, napi_create_string_utf16(env, "", ((size_t)INT_MAX) + 1, &output));
+ NAPI_CALL(env, napi_create_string_utf16(env,
+ ((const char16_t*)""),
+ ((size_t)INT_MAX) + 1, &output));
} else {
// just throw the expected error as there is nothing to test
// in this case since we can't overflow