bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wide characters, get_wch() and form_driver() - cannot get them worki


From: Adam Spragg
Subject: Re: wide characters, get_wch() and form_driver() - cannot get them working together.
Date: Thu, 19 Jun 2008 14:08:38 +0100
User-agent: KMail/1.9.9

Hiya.

On Thursday 19 June 2008 00:37:58 Thomas Dickey wrote:
> Using ncurses's trace, I can see that the form_driver is seeing the
> parameter passed to it as sign-extended.  That's happening in this
> line:
>
>                      if ((i = form_driver(form, buf[j])) != E_OK) {
>
> since 'buf' is a (by default on some platforms) signed char.
> A quick check with that changed to unsigned char seems to work.

Ah - that fixes it for me too. Thanks!

I can't see anything about needing to cast the "i" parameter of 
form_driver() to "unsigned char" in any of the guides, the FAQ, the 
form_driver(3) man page, the get_wch(3) man page (might this be needed 
for other functions in order for them to accept wide characters?), or 
the general ncurses(3) man page. Is it documented somewhere that I 
missed?

If not, might this be worth adding do the documentation? Perhaps with a 
note that you also need to convert the wide character you get from 
get_wch() to a multibyte sequence with wctomb(3) or wcrtomb(3) first, 
before the bytes can be passed as unsigned chars to form_driver().

Adam

-- 
Adam Spragg                      mailto:address@hidden
Developer
Octal Telecom                           http://www.octaltelecom.co.uk/


It reverses the logical flow of conversation!
> Why?
> > No.
> > > Should I top post?

http://www.google.com/search?q=%22top+posting%22




reply via email to

[Prev in Thread] Current Thread [Next in Thread]