[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Fix 32-bit compilation with gcc 5.5
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PATCH] Fix 32-bit compilation with gcc 5.5 |
Date: |
Fri, 29 Mar 2019 08:40:42 +0000 |
User-agent: |
mu4e 1.1.0; emacs 26.1 |
Andrew Randrianasulu <address@hidden> writes:
> ---
> ui/curses.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ui/curses.c b/ui/curses.c
> index cc6d6da684..b25814f3fb 100644
> --- a/ui/curses.c
> +++ b/ui/curses.c
> @@ -453,7 +453,7 @@ static uint16_t get_ucs(wchar_t wch, iconv_t conv)
> swch = sizeof(wch);
>
> if (iconv(conv, &pwch, &swch, &pch, &sch) == (size_t) -1) {
> - fprintf(stderr, "Could not convert 0x%02x from WCHAR_T to UCS-2:
> %s\n",
> + fprintf(stderr, "Could not convert 0x%02lx from WCHAR_T to UCS-2:
> %s\n",
> wch, strerror(errno));
This will break 64 bit compiles:
ui/curses.c: In function ‘get_ucs’:
ui/curses.c:456:50: error: format ‘%lx’ expects argument of type ‘long
unsigned int’, but argument 3 has type ‘wchar_t’ {aka ‘int’} [-Werror=format=]
Annoyingly it seems wchar_t can be various sizes on various platforms.
Maybe the simplest solution would be to upcast to a known size?
fprintf(stderr, "Could not convert %" PRIx32 " from WCHAR_T to UCS-2:
%s\n",
(uint32_t) wch, strerror(errno));
> return 0xFFFD;
> }
--
Alex Bennée