aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
authorDundar Goc <gocdundar@gmail.com>2022-05-04 22:35:50 +0200
committerDundar Goc <gocdundar@gmail.com>2022-05-07 14:54:01 +0200
commit2a378e6e82cececb12339f2df51ffe107039d867 (patch)
treeacf9250e683b303d2a22ff32455100cc4f6802cf /src/nvim
parentd9ec57e16a13f66a4b17edd872786e2c67348752 (diff)
downloadrneovim-2a378e6e82cececb12339f2df51ffe107039d867.tar.gz
rneovim-2a378e6e82cececb12339f2df51ffe107039d867.tar.bz2
rneovim-2a378e6e82cececb12339f2df51ffe107039d867.zip
refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/api/extmark.c2
-rw-r--r--src/nvim/api/private/helpers.c12
-rw-r--r--src/nvim/api/ui.c2
-rw-r--r--src/nvim/api/vim.c4
-rw-r--r--src/nvim/buffer.c10
-rw-r--r--src/nvim/change.c18
-rw-r--r--src/nvim/charset.c24
-rw-r--r--src/nvim/cursor.c2
-rw-r--r--src/nvim/diff.c10
-rw-r--r--src/nvim/edit.c49
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/eval/decode.c4
-rw-r--r--src/nvim/eval/encode.c8
-rw-r--r--src/nvim/eval/funcs.c52
-rw-r--r--src/nvim/ex_cmds.c10
-rw-r--r--src/nvim/ex_docmd.c14
-rw-r--r--src/nvim/ex_getln.c40
-rw-r--r--src/nvim/file_search.c8
-rw-r--r--src/nvim/fileio.c6
-rw-r--r--src/nvim/fold.c4
-rw-r--r--src/nvim/getchar.c30
-rw-r--r--src/nvim/hardcopy.c8
-rw-r--r--src/nvim/input.c2
-rw-r--r--src/nvim/keymap.c4
-rw-r--r--src/nvim/macros.h4
-rw-r--r--src/nvim/mark.c2
-rw-r--r--src/nvim/match.c10
-rw-r--r--src/nvim/mbyte.c91
-rw-r--r--src/nvim/memline.c4
-rw-r--r--src/nvim/message.c60
-rw-r--r--src/nvim/mouse.c16
-rw-r--r--src/nvim/normal.c20
-rw-r--r--src/nvim/ops.c34
-rw-r--r--src/nvim/option.c16
-rw-r--r--src/nvim/path.c18
-rw-r--r--src/nvim/popupmnu.c2
-rw-r--r--src/nvim/regexp.c32
-rw-r--r--src/nvim/regexp_bt.c56
-rw-r--r--src/nvim/regexp_nfa.c34
-rw-r--r--src/nvim/screen.c30
-rw-r--r--src/nvim/search.c68
-rw-r--r--src/nvim/sign.c6
-rw-r--r--src/nvim/spell.c140
-rw-r--r--src/nvim/spellfile.c8
-rw-r--r--src/nvim/strings.c12
-rw-r--r--src/nvim/syntax.c8
-rw-r--r--src/nvim/tag.c2
-rw-r--r--src/nvim/terminal.c4
-rw-r--r--src/nvim/testing.c2
-rw-r--r--src/nvim/version.c2
-rw-r--r--src/nvim/window.c2
51 files changed, 508 insertions, 506 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index bbc1ee9d71..12b5ea2e97 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -584,7 +584,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
String c = opts->conceal.data.string;
decor.conceal = true;
if (c.size) {
- decor.conceal_char = utf_ptr2char((const char_u *)c.data);
+ decor.conceal_char = utf_ptr2char(c.data);
}
} else if (HAS_KEY(opts->conceal)) {
api_set_error(err, kErrorTypeValidation, "conceal is not a String");
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 9f894d5533..a2ee4f91bc 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -654,9 +654,9 @@ void modify_keymap(uint64_t channel_id, Buffer buffer, bool is_unmap, String mod
int mode_val; // integer value of the mapping mode, to be passed to do_map()
char *p = (mode.size) ? mode.data : "m";
if (STRNCMP(p, "!", 2) == 0) {
- mode_val = get_map_mode((char_u **)&p, true); // mapmode-ic
+ mode_val = get_map_mode(&p, true); // mapmode-ic
} else {
- mode_val = get_map_mode((char_u **)&p, false);
+ mode_val = get_map_mode(&p, false);
if ((mode_val == VISUAL + SELECTMODE + NORMAL + OP_PENDING)
&& mode.size > 0) {
// get_map_mode() treats unrecognized mode shortnames as ":map".
@@ -1128,7 +1128,7 @@ ArrayOf(Dictionary) keymap_array(String mode, buf_T *buf, bool from_lua)
// Convert the string mode to the integer mode
// that is stored within each mapblock
- char_u *p = (char_u *)mode.data;
+ char *p = mode.data;
int int_mode = get_map_mode(&p, 0);
// Determine the desired buffer value
@@ -1666,11 +1666,11 @@ int init_sign_text(char **sign_text, char *text)
// Count cells and check for non-printable chars
int cells = 0;
- for (s = text; s < endp; s += utfc_ptr2len((char_u *)s)) {
- if (!vim_isprintc(utf_ptr2char((char_u *)s))) {
+ for (s = text; s < endp; s += utfc_ptr2len(s)) {
+ if (!vim_isprintc(utf_ptr2char(s))) {
break;
}
- cells += utf_ptr2cells((char_u *)s);
+ cells += utf_ptr2cells(s);
}
// Currently must be empty, one or two display cells
if (s != endp || cells > 2) {
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index d1b86ed328..b4d20ed975 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -665,7 +665,7 @@ static void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startc
remote_ui_cursor_goto(ui, row, startcol + i);
remote_ui_highlight_set(ui, attrs[i]);
remote_ui_put(ui, (const char *)chunk[i]);
- if (utf_ambiguous_width(utf_ptr2char(chunk[i]))) {
+ if (utf_ambiguous_width(utf_ptr2char((char *)chunk[i]))) {
data->client_col = -1; // force cursor update
}
}
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 7f4fafa71b..185c043b06 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -2287,12 +2287,12 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
if (HAS_KEY(opts->fillchar)) {
if (opts->fillchar.type != kObjectTypeString || opts->fillchar.data.string.size == 0
- || ((size_t)utf_ptr2len((char_u *)opts->fillchar.data.string.data)
+ || ((size_t)utf_ptr2len(opts->fillchar.data.string.data)
!= opts->fillchar.data.string.size)) {
api_set_error(err, kErrorTypeValidation, "fillchar must be a single character");
return result;
}
- fillchar = utf_ptr2char((char_u *)opts->fillchar.data.string.data);
+ fillchar = utf_ptr2char(opts->fillchar.data.string.data);
}
if (HAS_KEY(opts->highlights)) {
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 1ae1811772..2e30f7f8ec 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3456,7 +3456,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
wp->w_cursor.coladd = 0;
byteval = 0;
} else {
- byteval = utf_ptr2char(line_ptr + wp->w_cursor.col);
+ byteval = utf_ptr2char((char *)line_ptr + wp->w_cursor.col);
}
int groupdepth = 0;
@@ -3616,7 +3616,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
long n = 0;
while (group_len >= stl_items[stl_groupitems[groupdepth]].maxwid) {
group_len -= ptr2cells(t + n);
- n += utfc_ptr2len(t + n);
+ n += utfc_ptr2len((char *)t + n);
}
// }
@@ -4176,7 +4176,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (l > maxwid) {
while (l >= maxwid) {
l -= ptr2cells(t);
- t += utfc_ptr2len(t);
+ t += utfc_ptr2len((char *)t);
}
// Early out if there isn't enough room for the truncation marker
@@ -4374,7 +4374,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// Note: Only advance the pointer if the next
// character will fit in the available output space
- trunc_p += utfc_ptr2len(trunc_p);
+ trunc_p += utfc_ptr2len((char *)trunc_p);
}
// Ignore any items in the statusline that occur after
@@ -4396,7 +4396,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
long trunc_len = 0;
while (width >= maxwidth) {
width -= ptr2cells(trunc_p + trunc_len);
- trunc_len += utfc_ptr2len(trunc_p + trunc_len);
+ trunc_len += utfc_ptr2len((char *)trunc_p + trunc_len);
}
// }
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 2d5ece8880..1ddb83db0b 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -599,7 +599,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
if (vcol > new_vcol && oldp[col + oldlen] == TAB) {
break;
}
- oldlen += (size_t)utfc_ptr2len(oldp + col + oldlen);
+ oldlen += (size_t)utfc_ptr2len((char *)oldp + col + oldlen);
// Deleted a bit too much, insert spaces.
if (vcol > new_vcol) {
newlen += (size_t)(vcol - new_vcol);
@@ -608,7 +608,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
curwin->w_p_list = old_list;
} else if (oldp[col] != NUL) {
// normal replace
- oldlen = (size_t)utfc_ptr2len(oldp + col);
+ oldlen = (size_t)utfc_ptr2len((char *)oldp + col);
}
@@ -655,7 +655,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
if (p_sm && (State & INSERT)
&& msg_silent == 0
&& !ins_compl_active()) {
- showmatch(utf_ptr2char(buf));
+ showmatch(utf_ptr2char((char *)buf));
}
if (!p_ri || (State & REPLACE_FLAG)) {
@@ -715,7 +715,7 @@ int del_chars(long count, int fixpos)
int bytes = 0;
char_u *p = get_cursor_pos_ptr();
for (long i = 0; i < count && *p != NUL; i++) {
- int l = utfc_ptr2len(p);
+ int l = utfc_ptr2len((char *)p);
bytes += l;
p += l;
}
@@ -756,7 +756,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
// If 'delcombine' is set and deleting (less than) one character, only
// delete the last combining character.
if (p_deco && use_delcombine
- && utfc_ptr2len(oldp + col) >= count) {
+ && utfc_ptr2len((char *)oldp + col) >= count) {
int cc[MAX_MCO];
(void)utfc_ptr2char(oldp + col, cc);
@@ -765,7 +765,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
int n = col;
do {
col = n;
- count = utf_ptr2len(oldp + n);
+ count = utf_ptr2len((char *)oldp + n);
n += count;
} while (utf_composinglike(oldp + col, oldp + n));
fixpos = false;
@@ -1436,7 +1436,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
int l;
for (i = 0; i < lead_len && p[i] != NUL; i += l) {
- l = utfc_ptr2len(p + i);
+ l = utfc_ptr2len((char *)p + i);
if (vim_strnsize(p, i + l) > repl_size) {
break;
}
@@ -1459,7 +1459,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
lead_len--;
memmove(p, p + 1, (size_t)(leader + lead_len - p));
} else {
- int l = utfc_ptr2len(p);
+ int l = utfc_ptr2len((char *)p);
if (l > 1) {
if (ptr2cells(p) > 1) {
@@ -1565,7 +1565,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES)) {
while ((*p_extra == ' ' || *p_extra == '\t')
- && !utf_iscomposing(utf_ptr2char(p_extra + 1))) {
+ && !utf_iscomposing(utf_ptr2char((char *)p_extra + 1))) {
if (REPLACE_NORMAL(State)) {
replace_push(*p_extra);
}
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 31c61a1398..6012c2ebc6 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -275,7 +275,7 @@ void trans_characters(char_u *buf, int bufsize)
while (*buf != 0) {
int trs_len; // length of trs[]
// Assume a multi-byte character doesn't need translation.
- if ((trs_len = utfc_ptr2len(buf)) > 1) {
+ if ((trs_len = utfc_ptr2len((char *)buf)) > 1) {
len -= trs_len;
} else {
trs = transchar_byte(*buf);
@@ -311,7 +311,7 @@ size_t transstr_len(const char *const s, bool untab)
size_t len = 0;
while (*p) {
- const size_t l = (size_t)utfc_ptr2len((const char_u *)p);
+ const size_t l = (size_t)utfc_ptr2len(p);
if (l > 1) {
int pcc[MAX_MCO + 1];
pcc[0] = utfc_ptr2char((const char_u *)p, &pcc[1]);
@@ -354,7 +354,7 @@ size_t transstr_buf(const char *const s, char *const buf, const size_t len, bool
char *const buf_e = buf_p + len - 1;
while (*p != NUL && buf_p < buf_e) {
- const size_t l = (size_t)utfc_ptr2len((const char_u *)p);
+ const size_t l = (size_t)utfc_ptr2len(p);
if (l > 1) {
if (buf_p + l > buf_e) {
break; // Exceeded `buf` size.
@@ -424,7 +424,7 @@ char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
int i;
int len = orglen;
-#define GA_CHAR(i) ((char_u *)ga.ga_data)[i]
+#define GA_CHAR(i) ((char *)ga.ga_data)[i]
#define GA_PTR(i) ((char_u *)ga.ga_data + (i))
#define STR_CHAR(i) (buf == NULL ? GA_CHAR(i) : buf[i])
#define STR_PTR(i) (buf == NULL ? GA_PTR(i) : buf + (i))
@@ -453,8 +453,8 @@ char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
// Make each character lower case.
i = 0;
while (STR_CHAR(i) != NUL) {
- int c = utf_ptr2char(STR_PTR(i));
- int olen = utf_ptr2len(STR_PTR(i));
+ int c = utf_ptr2char((char *)STR_PTR(i));
+ int olen = utf_ptr2len((char *)STR_PTR(i));
int lc = mb_tolower(c);
// Only replace the character when it is not an invalid
@@ -492,7 +492,7 @@ char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
}
// skip to next multi-byte char
- i += utfc_ptr2len(STR_PTR(i));
+ i += utfc_ptr2len((char *)STR_PTR(i));
}
@@ -693,7 +693,7 @@ int ptr2cells(const char_u *p)
{
// For UTF-8 we need to look at more bytes if the first byte is >= 0x80.
if (*p >= 0x80) {
- return utf_ptr2cells(p);
+ return utf_ptr2cells((char *)p);
}
// For DBCS we can tell the cell count from the first byte.
@@ -727,7 +727,7 @@ int vim_strnsize(char_u *s, int len)
assert(s != NULL);
int size = 0;
while (*s != NUL && --len >= 0) {
- int l = utfc_ptr2len(s);
+ int l = utfc_ptr2len((char *)s);
size += ptr2cells(s);
s += l;
len -= l - 1;
@@ -806,7 +806,7 @@ bool vim_iswordp_buf(const char_u *const p, buf_T *const buf)
int c = *p;
if (MB_BYTE2LEN(c) > 1) {
- c = utf_ptr2char(p);
+ c = utf_ptr2char((char *)p);
}
return vim_iswordc_buf(c, buf);
}
@@ -957,7 +957,7 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
// For utf-8, if the byte is >= 0x80, need to look at
// further bytes to find the cell width.
if (c >= 0x80) {
- incr = utf_ptr2cells(ptr);
+ incr = utf_ptr2cells((char *)ptr);
} else {
incr = g_chartab[c] & CT_CELL_MASK;
}
@@ -1070,7 +1070,7 @@ void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *e
char_u *ptr = ml_get_buf(wp->w_buffer, pos->lnum, false);
if (pos->col < (colnr_T)STRLEN(ptr)) {
- int c = utf_ptr2char(ptr + pos->col);
+ int c = utf_ptr2char((char *)ptr + pos->col);
if ((c != TAB) && vim_isprintc(c)) {
endadd = (colnr_T)(char2cells(c) - 1);
if (coladd > endadd) {
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index 87835ec50a..6208efc9c8 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -459,7 +459,7 @@ bool leftcol_changed(void)
int gchar_cursor(void)
{
- return utf_ptr2char(get_cursor_pos_ptr());
+ return utf_ptr2char((char *)get_cursor_pos_ptr());
}
/// Write a character at the current cursor position.
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 6b606f50a1..7e296ebf52 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -750,10 +750,10 @@ static int diff_write_buffer(buf_T *buf, diffin_T *din)
c = NUL;
} else {
// xdiff doesn't support ignoring case, fold-case the text.
- c = utf_ptr2char(s);
+ c = utf_ptr2char((char *)s);
c = utf_fold(c);
}
- const int orig_len = utfc_ptr2len(s);
+ const int orig_len = utfc_ptr2len((char *)s);
if (utf_char2bytes(c, cbuf) != orig_len) {
// TODO(Bram): handle byte length difference
memmove(ptr + len, s, (size_t)orig_len);
@@ -1937,15 +1937,15 @@ static bool diff_equal_entry(diff_T *dp, int idx1, int idx2)
// ignoring case) return true and set "len" to the number of bytes.
static bool diff_equal_char(const char_u *const p1, const char_u *const p2, int *const len)
{
- const int l = utfc_ptr2len(p1);
+ const int l = utfc_ptr2len((char *)p1);
- if (l != utfc_ptr2len(p2)) {
+ if (l != utfc_ptr2len((char *)p2)) {
return false;
}
if (l > 1) {
if (STRNCMP(p1, p2, l) != 0
&& (!(diff_flags & DIFF_ICASE)
- || utf_fold(utf_ptr2char(p1)) != utf_fold(utf_ptr2char(p2)))) {
+ || utf_fold(utf_ptr2char((char *)p1)) != utf_fold(utf_ptr2char((char *)p2)))) {
return false;
}
*len = l;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index ab80f09228..950270c14a 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -440,7 +440,7 @@ static void insert_enter(InsertState *s)
if (s->ptr[1] == NUL) {
curwin->w_cursor.col++;
} else {
- s->i = utfc_ptr2len(s->ptr);
+ s->i = utfc_ptr2len((char *)s->ptr);
if (s->ptr[s->i] == NUL) {
curwin->w_cursor.col += s->i;
}
@@ -727,7 +727,7 @@ static int insert_execute(VimState *state, int key)
if (str != NULL) {
for (p = str; *p != NUL; MB_PTR_ADV(p)) {
- ins_compl_addleader(utf_ptr2char(p));
+ ins_compl_addleader(utf_ptr2char((char *)p));
}
xfree(str);
} else {
@@ -1332,7 +1332,7 @@ normalchar:
if (*str != NUL && stop_arrow() != FAIL) {
// Insert the new value of v:char literally.
for (p = str; *p != NUL; MB_PTR_ADV(p)) {
- s->c = utf_ptr2char(p);
+ s->c = utf_ptr2char((char *)p);
if (s->c == CAR || s->c == K_KENTER || s->c == NL) {
ins_eol(s->c);
} else {
@@ -1891,7 +1891,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
while (vcol <= (int)curwin->w_virtcol) {
last_vcol = vcol;
if (new_cursor_col >= 0) {
- new_cursor_col += utfc_ptr2len(ptr + new_cursor_col);
+ new_cursor_col += utfc_ptr2len((char *)ptr + new_cursor_col);
} else {
new_cursor_col++;
}
@@ -2061,7 +2061,7 @@ static bool del_char_after_col(int limit_col)
// composing character.
mb_adjust_cursor();
while (curwin->w_cursor.col < (colnr_T)limit_col) {
- int l = utf_ptr2len(get_cursor_pos_ptr());
+ int l = utf_ptr2len((char *)get_cursor_pos_ptr());
if (l == 0) { // end of line
break;
@@ -2566,8 +2566,8 @@ static void ins_compl_longest_match(compl_T *match)
p = compl_leader;
s = match->cp_str;
while (*p != NUL) {
- c1 = utf_ptr2char(p);
- c2 = utf_ptr2char(s);
+ c1 = utf_ptr2char((char *)p);
+ c2 = utf_ptr2char((char *)s);
if ((match->cp_flags & CP_ICASE)
? (mb_tolower(c1) != mb_tolower(c2))
@@ -3108,7 +3108,7 @@ static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
// different classes, only separate words
// with single-byte non-word characters.
while (*ptr != NUL) {
- const int l = utfc_ptr2len(ptr);
+ const int l = utfc_ptr2len((char *)ptr);
if (l < 2 && !vim_iswordc(*ptr)) {
break;
@@ -3150,7 +3150,7 @@ char_u *find_word_start(char_u *ptr)
FUNC_ATTR_PURE
{
while (*ptr != NUL && *ptr != '\n' && mb_get_class(ptr) <= 1) {
- ptr += utfc_ptr2len(ptr);
+ ptr += utfc_ptr2len((char *)ptr);
}
return ptr;
}
@@ -3165,7 +3165,7 @@ char_u *find_word_end(char_u *ptr)
const int start_class = mb_get_class(ptr);
if (start_class > 1) {
while (*ptr != NUL) {
- ptr += utfc_ptr2len(ptr);
+ ptr += utfc_ptr2len((char *)ptr);
if (mb_get_class(ptr) != start_class) {
break;
}
@@ -3602,7 +3602,7 @@ static void ins_compl_addfrommatch(void)
}
}
p += len;
- c = utf_ptr2char(p);
+ c = utf_ptr2char((char *)p);
ins_compl_addleader(c);
}
@@ -5251,10 +5251,10 @@ static int ins_complete(int c, bool enable_pum)
char_u *p = line + startcol;
MB_PTR_BACK(line, p);
- while (p > line && vim_isfilec(utf_ptr2char(p))) {
+ while (p > line && vim_isfilec(utf_ptr2char((char *)p))) {
MB_PTR_BACK(line, p);
}
- if (p == line && vim_isfilec(utf_ptr2char(p))) {
+ if (p == line && vim_isfilec(utf_ptr2char((char *)p))) {
startcol = 0;
} else {
startcol = (int)(p - line) + 1;
@@ -5590,7 +5590,7 @@ static unsigned quote_meta(char_u *dest, char_u *src, int len)
*dest++ = *src;
}
// Copy remaining bytes of a multibyte character.
- const int mb_len = utfc_ptr2len(src) - 1;
+ const int mb_len = utfc_ptr2len((char *)src) - 1;
if (mb_len > 0 && len >= mb_len) {
for (int i = 0; i < mb_len; i++) {
len--;
@@ -5759,9 +5759,8 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
*/
#define ISSPECIAL(c) ((c) < ' ' || (c) >= DEL || (c) == '0' || (c) == '^')
-#define WHITECHAR(cc) ( \
- ascii_iswhite(cc) \
- && !utf_iscomposing(utf_ptr2char(get_cursor_pos_ptr() + 1)))
+#define WHITECHAR(cc) (ascii_iswhite(cc) \
+ && !utf_iscomposing(utf_ptr2char((char *)get_cursor_pos_ptr() + 1)))
///
/// "flags": INSCHAR_FORMAT - force formatting
@@ -6903,7 +6902,7 @@ int oneright(void)
// Adjust for multi-wide char (excluding TAB)
ptr = get_cursor_pos_ptr();
- coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(utf_ptr2char(ptr))) ?
+ coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(utf_ptr2char((char *)ptr))) ?
ptr2cells(ptr) : 1));
curwin->w_set_curswant = true;
// Return OK if the cursor moved, FAIL otherwise (at window edge).
@@ -6916,7 +6915,7 @@ int oneright(void)
return FAIL; // already at the very end
}
- l = utfc_ptr2len(ptr);
+ l = utfc_ptr2len((char *)ptr);
// move "l" bytes right, but don't end up on the NUL, unless 'virtualedit'
// contains "onemore".
@@ -6957,7 +6956,7 @@ int oneleft(void)
// Adjust for multi-wide char (not a TAB)
ptr = get_cursor_pos_ptr();
- if (*ptr != TAB && vim_isprintc(utf_ptr2char(ptr))
+ if (*ptr != TAB && vim_isprintc(utf_ptr2char((char *)ptr))
&& ptr2cells(ptr) > 1) {
curwin->w_cursor.coladd = 0;
}
@@ -7249,7 +7248,7 @@ void replace_push(int c)
*/
int replace_push_mb(char_u *p)
{
- int l = utfc_ptr2len(p);
+ int l = utfc_ptr2len((char *)p);
int j;
for (j = l - 1; j >= 0; --j) {
@@ -7337,7 +7336,7 @@ static void mb_replace_pop_ins(int cc)
for (i = 1; i < n; i++) {
buf[i] = (char_u)replace_pop();
}
- if (utf_iscomposing(utf_ptr2char(buf))) {
+ if (utf_iscomposing(utf_ptr2char((char *)buf))) {
ins_bytes_len(buf, (size_t)n);
} else {
// Not a composing char, put it back.
@@ -7403,7 +7402,7 @@ static void replace_do_bs(int limit_col)
vcol = start_vcol;
for (i = 0; i < ins_len; i++) {
vcol += win_chartabsize(curwin, p + i, vcol);
- i += utfc_ptr2len(p) - 1;
+ i += utfc_ptr2len((char *)p) - 1;
}
vcol -= start_vcol;
@@ -8796,7 +8795,7 @@ static void ins_right(void)
if (virtual_active()) {
oneright();
} else {
- curwin->w_cursor.col += utfc_ptr2len(get_cursor_pos_ptr());
+ curwin->w_cursor.col += utfc_ptr2len((char *)get_cursor_pos_ptr());
}
revins_legal++;
@@ -9305,7 +9304,7 @@ int ins_copychar(linenr_T lnum)
ptr = prev_ptr;
}
- c = utf_ptr2char(ptr);
+ c = utf_ptr2char((char *)ptr);
if (c == NUL) {
vim_beep(BO_COPY);
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index d910b47c57..c79afe41ed 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2656,7 +2656,7 @@ bool next_for_item(void *fi_void, char *arg)
}
if (fi->fi_string != NULL) {
- const int len = utfc_ptr2len((char_u *)fi->fi_string + fi->fi_byte_idx);
+ const int len = utfc_ptr2len(fi->fi_string + fi->fi_byte_idx);
if (len == 0) {
return false;
}
@@ -7681,7 +7681,7 @@ int buf_byteidx_to_charidx(buf_T *buf, int lnum, int byteidx)
char *t = str;
int count;
for (count = 0; *t != NUL && t <= str + byteidx; count++) {
- t += utfc_ptr2len((char_u *)t);
+ t += utfc_ptr2len(t);
}
/