On Fri, Aug 20, 2021 at 02:19:21PM +0100, gerrit wrote:
>       for (unsigned int i = 0; i < buf_len; i++) {
> -             if (!isprint(buf[i]))
> +             if (!isprint((int)buf[i]))

This is not the correct change. You need to first cast to unsigned char,
as the int argument to isprint either is EOF (typically: -1) or an
unsigned char value. All other int values are undefined.

So portable code needs to use the ugly:

                if (!isprint((int)(unsigned char)buf[i]))

unfortunately.

Martin

Reply via email to