From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PULL 1/5] ui/curses: Fix build with -m32
Date: Fri, 7 Jun 2019 15:18:57 +0200 [thread overview]
Message-ID: <20190607131901.20107-2-kraxel@redhat.com> (raw)
In-Reply-To: <20190607131901.20107-1-kraxel@redhat.com>
From: Max Reitz <mreitz@redhat.com>
wchar_t may resolve to be an unsigned long on 32-bit architectures.
Using the %x conversion specifier will then give a compiler warning:
ui/curses.c: In function ‘get_ucs’:
ui/curses.c:492:49: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘wchar_t’ {aka ‘long int’} [-Werror=format=]
492 | fprintf(stderr, "Could not convert 0x%04x "
| ~~~^
| |
| unsigned int
| %04lx
493 | "from wchar_t to a multibyte character: %s\n",
494 | wch, strerror(errno));
| ~~~
| |
| wchar_t {aka long int}
ui/curses.c:504:49: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘wchar_t’ {aka ‘long int’} [-Werror=format=]
504 | fprintf(stderr, "Could not convert 0x%04x "
| ~~~^
| |
| unsigned int
| %04lx
505 | "from a multibyte character to UCS-2 : %s\n",
506 | wch, strerror(errno));
| ~~~
| |
| wchar_t {aka long int}
Fix this by casting the wchar_t value to an unsigned long and using %lx
as the conversion specifier.
Fixes: b7b664a4fe9a955338f2e11a0f7433b29c8cbad0
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-id: 20190527142540.23255-1-mreitz@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/curses.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/curses.c b/ui/curses.c
index 1f3fcabb004b..e9319eb8ae19 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -489,9 +489,9 @@ static uint16_t get_ucs(wchar_t wch, iconv_t conv)
memset(&ps, 0, sizeof(ps));
ret = wcrtomb(mbch, wch, &ps);
if (ret == -1) {
- fprintf(stderr, "Could not convert 0x%04x "
+ fprintf(stderr, "Could not convert 0x%04lx "
"from wchar_t to a multibyte character: %s\n",
- wch, strerror(errno));
+ (unsigned long)wch, strerror(errno));
return 0xFFFD;
}
@@ -501,9 +501,9 @@ static uint16_t get_ucs(wchar_t wch, iconv_t conv)
such = sizeof(uch);
if (iconv(conv, &pmbch, &smbch, &puch, &such) == (size_t) -1) {
- fprintf(stderr, "Could not convert 0x%04x "
+ fprintf(stderr, "Could not convert 0x%04lx "
"from a multibyte character to UCS-2 : %s\n",
- wch, strerror(errno));
+ (unsigned long)wch, strerror(errno));
return 0xFFFD;
}
--
2.18.1
next prev parent reply other threads:[~2019-06-07 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-07 13:18 [Qemu-devel] [PULL 0/5] Ui 20190607 patches Gerd Hoffmann
2019-06-07 13:18 ` Gerd Hoffmann [this message]
2019-06-07 13:18 ` [Qemu-devel] [PULL 2/5] console: add dmabuf modifier field Gerd Hoffmann
2019-06-07 13:18 ` [Qemu-devel] [PULL 3/5] vfio/display: set " Gerd Hoffmann
2019-06-07 13:19 ` [Qemu-devel] [PULL 4/5] egl-helpers: add modifier support to egl_get_fd_for_texture() Gerd Hoffmann
2019-06-07 13:19 ` [Qemu-devel] [PULL 5/5] egl-helpers: add modifier support to egl_dmabuf_import_texture() Gerd Hoffmann
2019-06-07 14:23 ` [Qemu-devel] [PULL 0/5] Ui 20190607 patches Peter Maydell
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=20190607131901.20107-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).