refactor: fix clang-tidy bugprone-signed-char-misuse warnings

Prefer to declare variables with correct type instead of explicit casts
wherever possible.
This commit is contained in:
Dundar Göc
2022-02-27 12:29:33 +01:00
parent 83fc914337
commit 4d2744ffe3
13 changed files with 24 additions and 30 deletions

View File

@@ -1907,9 +1907,6 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
// complete match
if (keylen >= 0 && keylen <= typebuf.tb_len) {
char_u *map_str = NULL;
int save_m_expr;
int save_m_noremap;
int save_m_silent;
// Write chars to script file(s).
// Note: :lmap mappings are written *after* being applied. #5658
@@ -1946,9 +1943,9 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
// Copy the values from *mp that are used, because evaluating the
// expression may invoke a function that redefines the mapping, thereby
// making *mp invalid.
save_m_expr = mp->m_expr;
save_m_noremap = mp->m_noremap;
save_m_silent = mp->m_silent;
char save_m_expr = mp->m_expr;
int save_m_noremap = mp->m_noremap;
char save_m_silent = mp->m_silent;
char_u *save_m_keys = NULL; // only saved when needed
char_u *save_m_str = NULL; // only saved when needed
LuaRef save_m_luaref = mp->m_luaref;
@@ -2661,9 +2658,9 @@ int fix_input_buffer(char_u *buf, int len)
/// @param[in] orig_rhs_len `strlen` of orig_rhs.
/// @param[in] cpo_flags See param docs for @ref replace_termcodes.
/// @param[out] mapargs MapArguments struct holding the replaced strings.
void set_maparg_lhs_rhs(const char_u *orig_lhs, const size_t orig_lhs_len,
const char_u *orig_rhs, const size_t orig_rhs_len,
LuaRef rhs_lua, int cpo_flags, MapArguments *mapargs)
void set_maparg_lhs_rhs(const char_u *orig_lhs, const size_t orig_lhs_len, const char_u *orig_rhs,
const size_t orig_rhs_len, LuaRef rhs_lua, int cpo_flags,
MapArguments *mapargs)
{
char_u *lhs_buf = NULL;
char_u *rhs_buf = NULL;
@@ -3988,7 +3985,7 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
/// special characters.
///
/// @param c NUL or typed character for abbreviation
static char_u *eval_map_expr(mapblock_T *mp, int c)
static char_u *eval_map_expr(mapblock_T *mp, int c)
{
char_u *res;
char_u *p = NULL;