Browse Source

curses: fix wchar_t printf warning

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>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 2019040207.17747-1-kraxel@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Gerd Hoffmann 1 month ago
parent
commit
e1be98540e
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      ui/curses.c

+ 2
- 2
ui/curses.c View File

@@ -453,8 +453,8 @@ static uint16_t get_ucs(wchar_t wch, iconv_t conv)
453 453
     swch = sizeof(wch);
454 454
 
455 455
     if (iconv(conv, &pwch, &swch, &pch, &sch) == (size_t) -1) {
456
-        fprintf(stderr, "Could not convert 0x%02x from WCHAR_T to UCS-2: %s\n",
457
-                        wch, strerror(errno));
456
+        fprintf(stderr, "Could not convert 0x%02lx from WCHAR_T to UCS-2: %s\n",
457
+                (unsigned long)wch, strerror(errno));
458 458
         return 0xFFFD;
459 459
     }
460 460
 

Loading…
Cancel
Save