[PATCH] Cygwin: pty: Fix ESC[?3h and ESC[?3l handling again.

Takashi Yano takashi.yano@nifty.ne.jp
Sat Dec 21 02:42:00 GMT 2019


On Thu, 19 Dec 2019 15:50:07 +0000
"Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin-patches" wrote:
> Just noticed that in the patch below and couldn't help it, sorry..
> 
> Things like
> 
> char* p0;
> 
> and later:
> 
> isdigit(*p0))  or  isalpha(*p0)
> 
> are usually not a good (correct) way of coding, because of possible sign extension of *p0
> which you normally wouldn't want to have (remember the ctype calls/macros actually expect
> an "int", not a character, input).  So it should be either "unsigned char* p0" or
> "isdigit((unsigned char)(*p0))", generally.

Thanks for the advice. In general, you are right.

However, in cygwin, ALLOW_NEGATIVE_CTYPE_INDEX is defined
in ctype library in newlib, and the lookup table is extended
in the negative direction.

So, in terms of results, the code works as expected. 

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>



More information about the Cygwin-patches mailing list