From 02a3f958dbecf4505b9a87f59227b37d9572e63c Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 13 Jan 2022 13:39:06 -0800 Subject: [PATCH] Use 0 instead of NULL for comparison to char16_t musl libc defines NULL as nullptr, which is explicitly allowed by C++11. nullptr_t cannot be implicitly cast to an integral type. Use 0 instead. Bug: 190084016 Test: m USE_HOST_MUSL=true host-native Change-Id: I0c3b6c94cd69262f574414bf52494333f2f2645a --- libutils/Unicode_test.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libutils/Unicode_test.cpp b/libutils/Unicode_test.cpp index b92eef866..8b994d9af 100644 --- a/libutils/Unicode_test.cpp +++ b/libutils/Unicode_test.cpp @@ -100,7 +100,7 @@ TEST_F(UnicodeTest, UTF8toUTF16Normal) { 0xF0, 0x90, 0x80, 0x80, // U+10000, 2 UTF-16 character }; - char16_t output[1 + 1 + 1 + 2 + 1]; // Room for NULL + char16_t output[1 + 1 + 1 + 2 + 1]; // Room for null utf8_to_utf16(str, sizeof(str), output, sizeof(output) / sizeof(output[0])); @@ -114,8 +114,7 @@ TEST_F(UnicodeTest, UTF8toUTF16Normal) { << "should be first half of surrogate U+10000"; EXPECT_EQ(0xDC00, output[4]) << "should be second half of surrogate U+10000"; - EXPECT_EQ(NULL, output[5]) - << "should be NULL terminated"; + EXPECT_EQ(0, output[5]) << "should be null terminated"; } TEST_F(UnicodeTest, strstr16EmptyTarget) {