From 8da8ba5a1cc7adf3ad5a4576510aae5c31ae0a6e Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Mon, 14 Feb 2022 10:41:07 +0000 Subject: Fix various instances of implicit conversions. The implicit conversions were discovered with Clang's UBSan (with the -fsanitizer=implicit-conversion option). * gc.c (sweep_one): Convert only the inverted REACHABLE, since block->t.type is already of the right type. * hash.c (eql_hash, eq_hash, hash_iter_init, us_hash_iter_init): Explicitly convert to ucnum. * linenoise/linenoise.c (enable_raw_mode): Explicitly convert the inverted flag sets to tcflag_t. * mpi/mpi.c (mp_set_uintptr): Explicitly convert to uint_ptr_t. * regex.c (char_set_add): Explicitly convert to bitcell_t. * struct.c (struct_inst_hash): Correct type of hash from cnum to ucnum. --- linenoise/linenoise.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linenoise/linenoise.c') diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 920c45d9..b3645a18 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -283,13 +283,13 @@ static int enable_raw_mode(lino_t *ls) { raw = ls->orig_termios; /* modify the original mode */ /* input modes: no break, no CR to NL, no parity check, no strip char, * no start/stop output control. */ - raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); + raw.c_iflag &= convert(tcflag_t, ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)); /* we don't change any output modes (c_oflag) */ /* control modes - set 8 bit chars */ raw.c_cflag |= (CS8); /* local modes - choing off, canonical off, no extended functions, * no signal chars (^Z,^C) */ - raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); + raw.c_lflag &= convert(tcflag_t, ~(ECHO | ICANON | IEXTEN | ISIG)); /* control chars - set return condition: min number of bytes and timer. * We want read to return every single byte, without timeout. */ raw.c_cc[VMIN] = 1; raw.c_cc[VTIME] = 0; /* 1 byte, no timer */ -- cgit v1.2.3