len = do_esc_char(c, flags | orflags, quotes, io_ch, arg);
len = do_esc_char(c, (unsigned char)(flags | orflags), quotes, io_ch, arg);
static int do_buf(unsigned char *buf, int buflen,			int type, unsigned char flags, char *quotes, char_io *io_ch, void *arg){	int i, outlen, len;	unsigned char orflags, *p, *q;	unsigned long c;	p = buf;	q = buf + buflen;	outlen = 0;	while(p != q) {		if(p == buf) orflags = CHARTYPE_FIRST_ESC_2253;		else orflags = 0;		switch(type & BUF_TYPE_WIDTH_MASK) {			case 4:			c = ((unsigned long)*p++) << 24;			c |= ((unsigned long)*p++) << 16;			c |= ((unsigned long)*p++) << 8;			c |= *p++;			break;			case 2:			c = ((unsigned long)*p++) << 8;			c |= *p++;			break;			case 1:			c = *p++;			break;						case 0:			i = UTF8_getc(p, buflen, &c);			if(i < 0) return -1;	/* Invalid UTF8String */			p += i;			break;		}		if (p == q) orflags = CHARTYPE_LAST_ESC_2253;		if(type & BUF_TYPE_CONVUTF8) {			unsigned char utfbuf[6];			int utflen;			utflen = UTF8_putc(utfbuf, 6, c);			for(i = 0; i < utflen; i++) {				/* We don't need to worry about setting orflags correctly				 * because if utflen==1 its value will be correct anyway 				 * otherwise each character will be > 0x7f and so the 				 * character will never be escaped on first and last.				 */				len = do_esc_char(utfbuf[i], flags | orflags, quotes, io_ch, arg);				if(len < 0) return -1;				outlen += len;			}		} else {			len = do_esc_char(c, flags | orflags, quotes, io_ch, arg);			if(len < 0) return -1;			outlen += len;		}	}	return outlen;}