Le ven. 29 mars 2019 13:53, Andrew Randrianasulu <[email protected]>
a écrit :

> В сообщении от Friday 29 March 2019 11:40:42 Alex Bennée написал(а):
> >
> > Andrew Randrianasulu <[email protected]> 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));
>

Can you simply use uint16_t instead?  UCS-2 chars fit in 16bit.

>
> > >          return 0xFFFD;
> > >      }
> >
>
>
> This worked for me with 32-bit gcc. Thanks!
>
> >
> > --
> > Alex Bennée
> >
>
>
>
>

Reply via email to