Skip to content

Commit cccd3a3

Browse files
danbevBridgeAR
authored andcommitted
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: #26539 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 0fc975d commit cccd3a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: test/js-native-api/test_string/test_string.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ static napi_value TestLargeLatin1(napi_env env, napi_callback_info info) {
232232
static napi_value TestLargeUtf16(napi_env env, napi_callback_info info) {
233233
napi_value output;
234234
if (SIZE_MAX > INT_MAX) {
235-
NAPI_CALL(env, napi_create_string_utf16(env, "", ((size_t)INT_MAX) + 1, &output));
235+
NAPI_CALL(env, napi_create_string_utf16(env,
236+
((const char16_t*)""),
237+
((size_t)INT_MAX) + 1, &output));
236238
} else {
237239
// just throw the expected error as there is nothing to test
238240
// in this case since we can't overflow

0 commit comments

Comments
 (0)