All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v5 4/4] treewide: Use 16-bit unicode strings
Date: Thu, 3 Feb 2022 19:56:46 +0100	[thread overview]
Message-ID: <53aed8cc-6223-3277-4601-31f6735ea474@gmx.de> (raw)
In-Reply-To: <20220123195514.3152022-5-sjg@chromium.org>

On 1/23/22 20:55, Simon Glass wrote:
> At present we use wide characters for unicode but this is not necessary.

nits:
%s/unicode/Unicode/

> Change the code to use the 'u' literal instead. This helps to fix build
> warnings for sandbox on rpi.

%s/rpi/the Raspberry Pi/

>
> Note: This applies tree-wide

Why do we need this in the commit message? You patch changes lib/ and
test/ only.

>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Otherwise
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>
> (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"<NULL>";
> +	const u16 *str = s ? s : u"<NULL>";
>   	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));


  reply	other threads:[~2022-02-03 18:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 19:55 [PATCH v5 0/4] Fix compiler warnings for 32-bit ARM Simon Glass
2022-01-23 19:55 ` [PATCH v5 1/4] scripts/checkpatch.pl: Resync with v5.16 Simon Glass
2022-02-04  0:40   ` Tom Rini
2022-01-23 19:55 ` [PATCH v5 2/4] efi: Use 16-bit unicode strings Simon Glass
2022-02-04  0:40   ` [PATCH v5 2/4] efi: Use 16-bit Unicode strings Tom Rini
2022-01-23 19:55 ` [PATCH v5 3/4] sandbox: Detect the host bit size automatically Simon Glass
2022-02-03 17:12   ` Tom Rini
2022-02-03 18:51   ` Heinrich Schuchardt
2022-01-23 19:55 ` [PATCH v5 4/4] treewide: Use 16-bit unicode strings Simon Glass
2022-02-03 18:56   ` Heinrich Schuchardt [this message]
2022-02-04  0:40   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53aed8cc-6223-3277-4601-31f6735ea474@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.