aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c12
-rw-r--r--src/nvim/getchar.c10
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/option.c22
4 files changed, 25 insertions, 21 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 18aa5bf763..c4baf3f653 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -12117,9 +12117,11 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
xfree(keys_buf);
if (!get_dict) {
- /* Return a string. */
- if (rhs != NULL)
- rettv->vval.v_string = str2special_save(rhs, FALSE);
+ // Return a string.
+ if (rhs != NULL) {
+ rettv->vval.v_string = (char_u *)str2special_save(
+ (const char *)rhs, false);
+ }
} else {
tv_dict_alloc_ret(rettv);
@@ -12154,7 +12156,7 @@ void mapblock_fill_dict(dict_T *const dict,
bool compatible)
FUNC_ATTR_NONNULL_ALL
{
- char_u *lhs = str2special_save(mp->m_keys, true);
+ char *const lhs = str2special_save((const char *)mp->m_keys, true);
char *const mapmode = map_mode_to_chars(mp->m_mode);
varnumber_T noremap_value;
@@ -12168,7 +12170,7 @@ void mapblock_fill_dict(dict_T *const dict,
noremap_value = mp->m_noremap == REMAP_SCRIPT ? 2 : !!mp->m_noremap;
}
- tv_dict_add_str(dict, S_LEN("lhs"), (const char *)lhs);
+ tv_dict_add_str(dict, S_LEN("lhs"), lhs);
tv_dict_add_str(dict, S_LEN("rhs"), (const char *)mp->m_orig_str);
tv_dict_add_nr(dict, S_LEN("noremap"), noremap_value);
tv_dict_add_nr(dict, S_LEN("expr"), mp->m_expr ? 1 : 0);
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 4e42042959..1d1af69c94 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1806,7 +1806,7 @@ static int vgetorpeek(int advance)
* <M-a> and then changing 'encoding'. Beware
* that 0x80 is escaped. */
char_u *p1 = mp->m_keys;
- char_u *p2 = mb_unescape(&p1);
+ char_u *p2 = (char_u *)mb_unescape((const char **)&p1);
if (has_mbyte && p2 != NULL && MB_BYTE2LEN(c1) > MB_PTR2LEN(p2))
mlen = 0;
@@ -4000,11 +4000,9 @@ int put_escstr(FILE *fd, char_u *strstart, int what)
}
for (; *str != NUL; ++str) {
- char_u *p;
-
- /* Check for a multi-byte character, which may contain escaped
- * K_SPECIAL and CSI bytes */
- p = mb_unescape(&str);
+ // Check for a multi-byte character, which may contain escaped
+ // K_SPECIAL and CSI bytes.
+ const char *p = mb_unescape((const char **)&str);
if (p != NULL) {
while (*p != NUL)
if (fputc(*p++, fd) < 0)
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 656f1adaf8..feb2fb214e 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1269,7 +1269,7 @@ msg_outtrans_special (
string = "<Space>";
str++;
} else {
- string = (const char *)str2special((char_u **)&str, from);
+ string = str2special((const char **)&str, from);
}
const int len = vim_strsize((char_u *)string);
// Highlight special keys
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b48ffae85b..bc101ba703 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -5175,9 +5175,12 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, int e
* CTRL-V or backslash */
if (valuep == &p_pt) {
s = *valuep;
- while (*s != NUL)
- if (put_escstr(fd, str2special(&s, FALSE), 2) == FAIL)
+ while (*s != NUL) {
+ if (put_escstr(fd, (char_u *)str2special((const char **)&s, false), 2)
+ == FAIL) {
return FAIL;
+ }
+ }
} else if (expand) {
buf = xmalloc(MAXPATHL);
home_replace(NULL, *valuep, buf, MAXPATHL, FALSE);
@@ -6173,15 +6176,16 @@ option_value2string (
}
} else { // P_STRING
varp = *(char_u **)(varp);
- if (varp == NULL) /* just in case */
+ if (varp == NULL) { // Just in case.
NameBuff[0] = NUL;
- else if (opp->flags & P_EXPAND)
- home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE);
- /* Translate 'pastetoggle' into special key names */
- else if ((char_u **)opp->var == &p_pt)
- str2specialbuf(p_pt, NameBuff, MAXPATHL);
- else
+ } else if (opp->flags & P_EXPAND) {
+ home_replace(NULL, varp, NameBuff, MAXPATHL, false);
+ // Translate 'pastetoggle' into special key names.
+ } else if ((char_u **)opp->var == &p_pt) {
+ str2specialbuf((const char *)p_pt, (char *)NameBuff, MAXPATHL);
+ } else {
STRLCPY(NameBuff, varp, MAXPATHL);
+ }
}
}