Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D17DAC433EF for ; Sun, 23 Jan 2022 19:56:03 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F2F8C837E2; Sun, 23 Jan 2022 20:55:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZSL/C0W3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9D32830CE; Sun, 23 Jan 2022 20:55:30 +0100 (CET) Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 66B2E835EA for ; Sun, 23 Jan 2022 20:55:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id r15so12118060ilj.7 for ; Sun, 23 Jan 2022 11:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pnvl1bL1UNIQKklrriOtptUdcWVnHJoSCfLGKhMgBpY=; b=ZSL/C0W3P1AfKXYrZ9WYp8TuieLVVYIQOnlwqpw5PYEkF/oRrMWaslyI/houZuVPDK /PC1GgQftYs4g6mMPktaW7M/5tpbqPRZ4mZweO6hqwxBAbIJCdZ0HEf5mnyImPBiP04+ QzuMV8KCfOaeyZPCueum8XidIrwj80DHBZwm0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pnvl1bL1UNIQKklrriOtptUdcWVnHJoSCfLGKhMgBpY=; b=hwn/imSlfHZJEdwHdP0q5EQMYFU2RAywk/WTBDz0Slm4KCpkIHaxWJVX6t0wjsB6rk m9HcQDZxAz6YuuA1uHg6ALMTS50FMbJbVfC7ceTJVWcwTiZtBtK+2JNwI/8CFUWnlvtB FtzTy/G4xTUAsa8xzJiNXyvHo94/cfuqzQ7naVLH4rkBv2aLM2braiqwJ6goxH7EXqYG DkQkYHiNyMGc6an/yOVjXLcCOpirIOAGl3sOJBaWCZb1Ch6cMCbwvFIVg+Wke4R0fdU7 Sbq+7k7+xN+DNUZVWXdHqP2AVCdDKAgrVqG0T3oLuw8hIQgvW4OTA8Z4NKNYRCOux9+W BgCQ== X-Gm-Message-State: AOAM533yVFY9Aqr6Z732nDG9MNRpk4R/9F2hz1b/mQw48E1Gew/DVWEP wVDTvBilsvA6cWnKkWUBEOVBzWGKMB3r8A== X-Google-Smtp-Source: ABdhPJzFr4Ts8W1U2TOLN2A0xNJoj6gyL0MyjgBNgWOtUxr0E7jRhjUu6ZF4sqp2v51MLR1E01iN1g== X-Received: by 2002:a05:6e02:2165:: with SMTP id s5mr6631680ilv.323.1642967721931; Sun, 23 Jan 2022 11:55:21 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id z6sm6152147ilz.64.2022.01.23.11.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 11:55:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v5 4/4] treewide: Use 16-bit unicode strings Date: Sun, 23 Jan 2022 12:55:14 -0700 Message-Id: <20220123195514.3152022-5-sjg@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220123195514.3152022-1-sjg@chromium.org> References: <20220123195514.3152022-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean At present we use wide characters for unicode but this is not necessary. Change the code to use the 'u' literal instead. This helps to fix build warnings for sandbox on rpi. Note: This applies tree-wide Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Add a new patch to change non-EFI occurences lib/lzma/Types.h | 4 ++-- lib/vsprintf.c | 2 +- test/print_ut.c | 2 +- test/unicode_ut.c | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/lzma/Types.h b/lib/lzma/Types.h index 8afcba556eb..04f894a8ca9 100644 --- a/lib/lzma/Types.h +++ b/lib/lzma/Types.h @@ -225,9 +225,9 @@ typedef struct #else #define CHAR_PATH_SEPARATOR '/' -#define WCHAR_PATH_SEPARATOR L'/' +#define WCHAR_PATH_SEPARATOR u'/' #define STRING_PATH_SEPARATOR "/" -#define WSTRING_PATH_SEPARATOR L"/" +#define WSTRING_PATH_SEPARATOR u"/" #endif diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 2c84649fa8a..69b2f6a1adc 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -279,7 +279,7 @@ static char *string(char *buf, char *end, const char *s, int field_width, static __maybe_unused char *string16(char *buf, char *end, u16 *s, int field_width, int precision, int flags) { - const u16 *str = s ? s : L""; + const u16 *str = s ? s : u""; ssize_t i, len = utf16_strnlen(str, precision); if (!(flags & LEFT)) diff --git a/test/print_ut.c b/test/print_ut.c index 194387f169f..a133907674d 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -118,7 +118,7 @@ static int print_printf(struct unit_test_state *uts) snprintf(str, 0, "testing none"); ut_asserteq('x', *str); - sprintf(big_str, "_%ls_", L"foo"); + sprintf(big_str, "_%ls_", u"foo"); ut_assertok(strcmp("_foo_", big_str)); /* Test the banner function */ diff --git a/test/unicode_ut.c b/test/unicode_ut.c index 617eed8cfa0..f821e5a6be8 100644 --- a/test/unicode_ut.c +++ b/test/unicode_ut.c @@ -299,17 +299,17 @@ static int unicode_test_utf8_utf16_strcpy(struct unit_test_state *uts) pos = buf; utf8_utf16_strcpy(&pos, j1); ut_asserteq(4, pos - buf); - ut_assert(!unicode_test_u16_strcmp(buf, L"j1?l", SIZE_MAX)); + ut_assert(!unicode_test_u16_strcmp(buf, u"j1?l", SIZE_MAX)); pos = buf; utf8_utf16_strcpy(&pos, j2); ut_asserteq(4, pos - buf); - ut_assert(!unicode_test_u16_strcmp(buf, L"j2?l", SIZE_MAX)); + ut_assert(!unicode_test_u16_strcmp(buf, u"j2?l", SIZE_MAX)); pos = buf; utf8_utf16_strcpy(&pos, j3); ut_asserteq(3, pos - buf); - ut_assert(!unicode_test_u16_strcmp(buf, L"j3?", SIZE_MAX)); + ut_assert(!unicode_test_u16_strcmp(buf, u"j3?", SIZE_MAX)); return 0; } @@ -584,13 +584,13 @@ UNICODE_TEST(unicode_test_utf_to_upper); static int unicode_test_u16_strncmp(struct unit_test_state *uts) { - ut_assert(u16_strncmp(L"abc", L"abc", 3) == 0); - ut_assert(u16_strncmp(L"abcdef", L"abcghi", 3) == 0); - ut_assert(u16_strncmp(L"abcdef", L"abcghi", 6) < 0); - ut_assert(u16_strncmp(L"abcghi", L"abcdef", 6) > 0); - ut_assert(u16_strcmp(L"abc", L"abc") == 0); - ut_assert(u16_strcmp(L"abcdef", L"deghi") < 0); - ut_assert(u16_strcmp(L"deghi", L"abcdef") > 0); + ut_assert(u16_strncmp(u"abc", u"abc", 3) == 0); + ut_assert(u16_strncmp(u"abcdef", u"abcghi", 3) == 0); + ut_assert(u16_strncmp(u"abcdef", u"abcghi", 6) < 0); + ut_assert(u16_strncmp(u"abcghi", u"abcdef", 6) > 0); + ut_assert(u16_strcmp(u"abc", u"abc") == 0); + ut_assert(u16_strcmp(u"abcdef", u"deghi") < 0); + ut_assert(u16_strcmp(u"deghi", u"abcdef") > 0); return 0; } UNICODE_TEST(unicode_test_u16_strncmp); @@ -713,7 +713,7 @@ UNICODE_TEST(unicode_test_utf8_to_utf32_stream); static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts) { u16 buf[16]; - u16 const expected[] = L"Capsule0AF9"; + u16 const expected[] = u"Capsule0AF9"; u16 *pos; memset(buf, 0xeb, sizeof(buf)); -- 2.35.0.rc0.227.g00780c9af4-goog