Re: [dev] [st] [PATCH] Fix techo handling of control and multibyte characters.

From: <noname_AT_inventati.org>
Date: Fri, 25 Apr 2014 17:23:59 +0400

On Thu, Apr 24, 2014 at 07:29:35AM +0200, Roberto E. Vargas Caballero wrote:
> Hello,
>
> > u suffix was here for a purpose. The patch has comment about multibyte
> > characters. As 0x20u is unsigned, c was converted to unsigned char
> > before comparison so multibyte characters were not considered control
> > characters.
>
> I realized it after send the patch. I prefer use uchar instead of
> suffix u. I known that gcc will complaint with a warning about pointer
> to data with different signess, but I think we are the programmers
> and not gcc, so using uchar is the way.

We can modify it as follows:
        if(BETWEEN(c, 0x00, 0x1f) || c == 0x7f) { /* control code */

I also thought about using incntrl(). It should work the same way
everywhere but it is still possible to break it with locales.
Received on Fri Apr 25 2014 - 15:23:59 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 25 2014 - 15:36:06 CEST