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 F033DC433EF for ; Sat, 22 Jan 2022 01:28:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EEE4A837C4; Sat, 22 Jan 2022 02:27:55 +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="aja148Go"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B75CC835F4; Sat, 22 Jan 2022 02:27:49 +0100 (CET) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (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 9992C830D0 for ; Sat, 22 Jan 2022 02:27:46 +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-io1-xd2c.google.com with SMTP id v6so12799990iom.6 for ; Fri, 21 Jan 2022 17:27:46 -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=SX9cfoQLkTmOwsd3GFZ+OjLD0s7bIkTR0NZAQonQ1zg=; b=aja148GoASGruLPhFSzfq78unUy9efAC5MGK6iGQkxU13b8YfxkHjYfwcs6ThJHTBG jfiCe9bmwCpogz7GMo2ukWdD7iBdodkjfOYQsqFekbI1lxCiavnnTWmD8fq593gTvqhA Y0JJIiElFLjkTvq6BVnKE/dzipjksjCGMLwko= 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=SX9cfoQLkTmOwsd3GFZ+OjLD0s7bIkTR0NZAQonQ1zg=; b=eErTtcMMplFrYAZh4IIzbB3oyaJuyle9chhulqN9/cR/BeaQAZiig/Bbig1gcQPQdD TZzcYcaVpwBiebzjw4YMStgZbN61o9W+V2WSjZEl+47T/r9tn+TuF4L8doOnTzuQK8l/ PGGm3IyZYY9hHg3FqpbFLVY8zBl7uJZIF79CJf5ru3qdslnVImKnEf39AodVyU9+yuTr +2ky/5nLucbbg1yldqkcQEBF/kmWqmMGKz9udBh4QNWQbsXzjxisAEMShVMQkwsM/tF3 +9L2lAkkLTvRadDbx4MuVgMwO2Jxoo/HYei8EC/r4cj277Fmx7h9KkTuV/s0Cq4sM0cO WgnA== X-Gm-Message-State: AOAM530EU2v7XwQf3vO7KHs3Mg+bAWDY1P6COqilZDiw4Hw7lUWz902+ 0qkCTFgWlRZYPXOPMxKUvgGaISqPtLco/g== X-Google-Smtp-Source: ABdhPJwmK+5tEhomEBH7ymfP3EMQd5bouRgF6We0ji/0w7EcIKQou4ihN6KubTGzTvMEe4itwHqqzw== X-Received: by 2002:a05:6602:2d49:: with SMTP id d9mr3444064iow.64.1642814865237; Fri, 21 Jan 2022 17:27:45 -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 k17sm2153586ioj.1.2022.01.21.17.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 17:27:44 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v4 4/4] treewide: Use 16-bit unicode strings Date: Fri, 21 Jan 2022 18:27:36 -0700 Message-Id: <20220122012736.2725994-5-sjg@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220122012736.2725994-1-sjg@chromium.org> References: <20220122012736.2725994-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 de9f236b908..861923c703a 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -279,7 +279,7 @@ static char *string(char *buf, char *end, 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 7b2e7bb152c..dd2d4620f7d 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -106,7 +106,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