qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] curses: fix wchar_t printf warning
@ 2019-04-02  7:30 Gerd Hoffmann
  2019-04-02 12:57 ` Eric Blake
  2019-04-12 12:37 ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2019-04-02  7:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

On some systems wchar_t is "long int", on others just "int".
So go cast to "long int" and adjust the printf format accordingly.

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/curses.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/curses.c b/ui/curses.c
index cc6d6da68463..fb63945188b2 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -453,8 +453,8 @@ 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",
-                        wch, strerror(errno));
+        fprintf(stderr, "Could not convert 0x%02lx from WCHAR_T to UCS-2: %s\n",
+                (unsigned long)wch, strerror(errno));
         return 0xFFFD;
     }
 
-- 
2.18.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-12 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-02  7:30 [Qemu-devel] [PATCH] curses: fix wchar_t printf warning Gerd Hoffmann
2019-04-02 12:57 ` Eric Blake
2019-04-02 14:54   ` Philippe Mathieu-Daudé
2019-04-12 12:37 ` Peter Maydell
2019-04-12 12:37   ` Peter Maydell

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).