From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: clavin Date: Wed, 12 May 2021 12:43:07 -0600 Subject: nan_string_test_alignment Modifies a NAN test to avoid a debug check pertaining to efficient string alignment. diff --git a/test/cpp/strings.cpp b/test/cpp/strings.cpp index 95edeac91a4ec6a5f5cd80aa36dca8a55eb53f2a..0ad5cb7095490ac1eb454318582a9a683cb14be1 100644 --- a/test/cpp/strings.cpp +++ b/test/cpp/strings.cpp @@ -26,7 +26,9 @@ NAN_METHOD(EncodeHex) { } NAN_METHOD(EncodeUCS2) { - info.GetReturnValue().Set(Encode("h\0e\0l\0l\0o\0", 10, UCS2)); + // This odd declaration is to get the string data aligned to a 2-byte boundary + const uint16_t str[] = {'h', 'e', 'l', 'l', 'o'}; + info.GetReturnValue().Set(Encode(reinterpret_cast(str), 10, UCS2)); } Persistent returnUtf8String_persistent;