diff options
| author | dundargoc <gocdundar@gmail.com> | 2023-09-29 14:58:48 +0200 |
|---|---|---|
| committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-11-05 20:19:06 +0100 |
| commit | acc646ad8fc3ef11fcc63b69f3d8484e4a91accd (patch) | |
| tree | 613753f19fe6f6fa45884750eb176c1517269ec2 /src | |
| parent | c513cbf361000e6f09cd5b71b718e9de3f88904d (diff) | |
| download | rneovim-acc646ad8fc3ef11fcc63b69f3d8484e4a91accd.tar.gz rneovim-acc646ad8fc3ef11fcc63b69f3d8484e4a91accd.tar.bz2 rneovim-acc646ad8fc3ef11fcc63b69f3d8484e4a91accd.zip | |
refactor: the long goodbye
long is 32 bits on windows, while it is 64 bits on other architectures.
This makes the type suboptimal for a codebase meant to be
cross-platform. Replace it with more appropriate integer types.
Diffstat (limited to 'src')
57 files changed, 362 insertions, 367 deletions
diff --git a/src/nvim/assert.h b/src/nvim/assert.h index 1941f4c33c..90d242fd3e 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -57,7 +57,7 @@ // the easiest case, when the mode is C11 (generic compiler) or Clang // advertises explicit support for c_static_assert, meaning it won't warn. -#if __STDC_VERSION__ >= 201112L || __has_feature(c_static_assert) +#if __STDC_VERSION__ >= 201112 || __has_feature(c_static_assert) # define STATIC_ASSERT_STATEMENT(cond, msg) _Static_assert(cond, msg) // if we're dealing with gcc >= 4.6 in C99 mode, we can still use // _Static_assert but we need to suppress warnings, this is pretty ugly. diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 076cf63913..86b16c18da 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -987,7 +987,7 @@ void handle_swap_exists(bufref_T *old_curbuf) || old_curbuf->br_buf == curbuf) { // Block autocommands here because curwin->w_buffer is NULL. block_autocmds(); - buf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED); + buf = buflist_new(NULL, NULL, 1, BLN_CURBUF | BLN_LISTED); unblock_autocmds(); } else { buf = old_curbuf->br_buf; @@ -1886,7 +1886,7 @@ buf_T *buflist_new(char *ffname_arg, char *sfname_arg, linenr_T lnum, int flags) emsg(_("W14: Warning: List of file names overflow")); if (emsg_silent == 0 && !in_assert_fails) { ui_flush(); - os_delay(3001L, true); // make sure it is noticed + os_delay(3001, true); // make sure it is noticed } top_file_num = 1; } @@ -3496,9 +3496,9 @@ void get_rel_pos(win_T *wp, char *buf, int buflen) } else if (above <= 0) { xstrlcpy(buf, _("Top"), (size_t)buflen); } else { - int perc = (above > 1000000L - ? (int)(above / ((above + below) / 100L)) - : (int)(above * 100L / (above + below))); + int perc = (above > 1000000 + ? (above / ((above + below) / 100)) + : (above * 100 / (above + below))); char *p = buf; size_t l = (size_t)buflen; diff --git a/src/nvim/change.c b/src/nvim/change.c index acc657a1c2..a2657b86aa 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -92,7 +92,7 @@ void change_warning(buf_T *buf, int col) (void)msg_end(); if (msg_silent == 0 && !silent_mode && ui_active()) { ui_flush(); - os_delay(1002L, true); // give the user time to think about it + os_delay(1002, true); // give the user time to think about it } buf->b_did_warn = true; redraw_cmdline = false; // don't redraw and erase the message @@ -131,7 +131,7 @@ void changed(buf_T *buf) // and don't let the emsg() set msg_scroll. if (need_wait_return && emsg_silent == 0 && !in_assert_fails) { ui_flush(); - os_delay(2002L, true); + os_delay(2002, true); wait_return(true); msg_scroll = save_msg_scroll; } else { @@ -457,7 +457,7 @@ void appended_lines(linenr_T lnum, linenr_T count) /// Like appended_lines(), but adjust marks first. void appended_lines_mark(linenr_T lnum, int count) { - mark_adjust(lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0L, kExtmarkUndo); + mark_adjust(lnum + 1, (linenr_T)MAXLNUM, (linenr_T)count, 0, kExtmarkUndo); changed_lines(curbuf, lnum + 1, 0, lnum + 1, (linenr_T)count, true); } @@ -552,7 +552,7 @@ void changed_lines(buf_T *buf, linenr_T lnum, colnr_T col, linenr_T lnume, linen wlnum = diff_lnum_win(lnum, wp); if (wlnum > 0) { buf_redraw_changed_lines_later(wp->w_buffer, wlnum, - lnume - lnum + wlnum, 0L); + lnume - lnum + wlnum, 0); } } } @@ -823,7 +823,7 @@ int del_char(bool fixpos) if (*get_cursor_pos_ptr() == NUL) { return FAIL; } - return del_chars(1L, fixpos); + return del_chars(1, fixpos); } /// Like del_bytes(), but delete characters instead of bytes. @@ -1731,7 +1731,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) } // Postpone calling changed_lines(), because it would mess up folding // with markers. - mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L, kExtmarkNOOP); + mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1, 0, kExtmarkNOOP); did_append = true; } else { // In MODE_VREPLACE state we are starting to replace the next line. @@ -1822,14 +1822,14 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) saved_line = NULL; if (did_append) { changed_lines(curbuf, curwin->w_cursor.lnum, curwin->w_cursor.col, - curwin->w_cursor.lnum + 1, 1L, true); + curwin->w_cursor.lnum + 1, 1, true); did_append = false; // Move marks after the line break to the new line. if (flags & OPENLINE_MARKFIX) { mark_col_adjust(curwin->w_cursor.lnum, curwin->w_cursor.col + less_cols_off, - 1L, -less_cols, 0); + 1, -less_cols, 0); } // Always move extmarks - Here we move only the line where the // cursor is, the previous mark_adjust takes care of the lines after @@ -1847,7 +1847,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) curwin->w_cursor.lnum = old_cursor.lnum + 1; } if (did_append) { - changed_lines(curbuf, curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L, true); + changed_lines(curbuf, curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1, true); // bail out and just get the final length of the line we just manipulated bcount_t extra = (bcount_t)strlen(ml_get(curwin->w_cursor.lnum)); extmark_splice(curbuf, (int)curwin->w_cursor.lnum - 1, 0, diff --git a/src/nvim/charset.c b/src/nvim/charset.c index c2722af971..eb858b8d5e 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1167,14 +1167,14 @@ long getdigits_long(char **pp, bool strict, long def) /// Gets a int32_t number from a string. /// /// @see getdigits -int32_t getdigits_int32(char **pp, bool strict, long def) +int32_t getdigits_int32(char **pp, bool strict, int32_t def) { intmax_t number = getdigits(pp, strict, def); #if SIZEOF_INTMAX_T > 4 if (strict) { assert(number >= INT32_MIN && number <= INT32_MAX); } else if (!(number >= INT32_MIN && number <= INT32_MAX)) { - return (int32_t)def; + return def; } #endif return (int32_t)number; diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index ba5f30c20f..92b7568593 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -32,23 +32,23 @@ static const char e_digit_expected[] = N_("E548: Digit expected"); cursorentry_T shape_table[SHAPE_IDX_COUNT] = { // Values are set by 'guicursor' and 'mouseshape'. // Adjust the SHAPE_IDX_ defines when changing this! - { "normal", 0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR + SHAPE_MOUSE }, - { "visual", 0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR + SHAPE_MOUSE }, - { "insert", 0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR + SHAPE_MOUSE }, - { "replace", 0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR + SHAPE_MOUSE }, - { "cmdline_normal", 0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR + SHAPE_MOUSE }, - { "cmdline_insert", 0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR + SHAPE_MOUSE }, - { "cmdline_replace", 0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR + SHAPE_MOUSE }, - { "operator", 0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR + SHAPE_MOUSE }, - { "visual_select", 0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR + SHAPE_MOUSE }, - { "cmdline_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE }, - { "statusline_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE }, - { "statusline_drag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE }, - { "vsep_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE }, - { "vsep_drag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE }, - { "more", 0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE }, - { "more_lastline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE }, - { "showmatch", 0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR }, + { "normal", 0, 0, 0, 700, 400, 250, 0, 0, "n", SHAPE_CURSOR + SHAPE_MOUSE }, + { "visual", 0, 0, 0, 700, 400, 250, 0, 0, "v", SHAPE_CURSOR + SHAPE_MOUSE }, + { "insert", 0, 0, 0, 700, 400, 250, 0, 0, "i", SHAPE_CURSOR + SHAPE_MOUSE }, + { "replace", 0, 0, 0, 700, 400, 250, 0, 0, "r", SHAPE_CURSOR + SHAPE_MOUSE }, + { "cmdline_normal", 0, 0, 0, 700, 400, 250, 0, 0, "c", SHAPE_CURSOR + SHAPE_MOUSE }, + { "cmdline_insert", 0, 0, 0, 700, 400, 250, 0, 0, "ci", SHAPE_CURSOR + SHAPE_MOUSE }, + { "cmdline_replace", 0, 0, 0, 700, 400, 250, 0, 0, "cr", SHAPE_CURSOR + SHAPE_MOUSE }, + { "operator", 0, 0, 0, 700, 400, 250, 0, 0, "o", SHAPE_CURSOR + SHAPE_MOUSE }, + { "visual_select", 0, 0, 0, 700, 400, 250, 0, 0, "ve", SHAPE_CURSOR + SHAPE_MOUSE }, + { "cmdline_hover", 0, 0, 0, 0, 0, 0, 0, 0, "e", SHAPE_MOUSE }, + { "statusline_hover", 0, 0, 0, 0, 0, 0, 0, 0, "s", SHAPE_MOUSE }, + { "statusline_drag", 0, 0, 0, 0, 0, 0, 0, 0, "sd", SHAPE_MOUSE }, + { "vsep_hover", 0, 0, 0, 0, 0, 0, 0, 0, "vs", SHAPE_MOUSE }, + { "vsep_drag", 0, 0, 0, 0, 0, 0, 0, 0, "vd", SHAPE_MOUSE }, + { "more", 0, 0, 0, 0, 0, 0, 0, 0, "m", SHAPE_MOUSE }, + { "more_lastline", 0, 0, 0, 0, 0, 0, 0, 0, "ml", SHAPE_MOUSE }, + { "showmatch", 0, 0, 0, 100, 100, 100, 0, 0, "sm", SHAPE_CURSOR }, }; /// Converts cursor_shapes into an Array of Dictionaries diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 8516e33638..920a535ddf 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -106,9 +106,9 @@ typedef struct { // used for recording hunks from xdiff typedef struct { linenr_T lnum_orig; - long count_orig; + int count_orig; linenr_T lnum_new; - long count_new; + int count_new; } diffhunk_T; // two diff inputs and one result @@ -771,7 +771,7 @@ static int diff_write_buffer(buf_T *buf, mmfile_t *m, linenr_T start, linenr_T e return FAIL; } m->ptr = ptr; - m->size = (long)len; + m->size = (int)len; len = 0; for (linenr_T lnum = start; lnum <= end; lnum++) { @@ -2571,7 +2571,7 @@ int diffopt_changed(void) // recompute the scroll binding with the new option value, may // remove or add filler lines - check_scrollbind((linenr_T)0, 0L); + check_scrollbind(0, 0); return OK; } @@ -3217,7 +3217,7 @@ bool diff_mode_buf(buf_T *buf) /// @param count /// /// @return FAIL if there isn't such a diff block. -int diff_move_to(int dir, long count) +int diff_move_to(int dir, int count) { linenr_T lnum = curwin->w_cursor.lnum; int idx = diff_buf_idx(curbuf); diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 3d63d2c24c..a28b6a8aa1 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2832,12 +2832,11 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl } if (((wp->w_p_cuc - && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off - && (int)wp->w_virtcol < - (long)grid->cols * (wlv.row - startrow + 1) + v + && wp->w_virtcol >= VCOL_HLC - eol_hl_off + && wp->w_virtcol < grid->cols * (ptrdiff_t)(wlv.row - startrow + 1) + v && lnum != wp->w_cursor.lnum) || draw_color_col || wlv.line_attr_lowprio || wlv.line_attr - || wlv.diff_hlf != (hlf_T)0 || has_virttext)) { + || wlv.diff_hlf != 0 || has_virttext)) { int rightmost_vcol = 0; if (wp->w_p_cuc) { @@ -2881,7 +2880,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl int col_attr = base_attr; - if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol) { + if (wp->w_p_cuc && VCOL_HLC == wp->w_virtcol) { col_attr = cuc_attr; } else if (draw_color_col && VCOL_HLC == *color_cols) { col_attr = hl_combine_attr(wlv.line_attr_lowprio, mc_attr); @@ -2978,7 +2977,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl && search_attr == 0 && area_attr == 0 && wlv.filler_todo <= 0) { - if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol + if (wp->w_p_cuc && VCOL_HLC == wp->w_virtcol && lnum != wp->w_cursor.lnum) { vcol_save_attr = wlv.char_attr; wlv.char_attr = hl_combine_attr(win_hl_attr(wp, HLF_CUC), wlv.char_attr); diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1e1b67483c..2b332ea414 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -760,7 +760,7 @@ static int insert_handle_key(InsertState *s) case Ctrl_A: // For ^@ the trailing ESC will end the insert, unless there is an // error. - if (stuff_inserted(NUL, 1L, (s->c == Ctrl_A)) == FAIL + if (stuff_inserted(NUL, 1, (s->c == Ctrl_A)) == FAIL && s->c != Ctrl_A) { return 0; // exit insert mode } @@ -2066,7 +2066,7 @@ void insertchar(int c, int flags, int second_indent) if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0 && (force_format || virtcol > (colnr_T)textwidth)) { - do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0); + do_internal = (fex_format(curwin->w_cursor.lnum, 1, c) != 0); // It may be required to save for undo again, e.g. when setline() // was called. ins_need_undo = true; @@ -2634,7 +2634,7 @@ int cursor_up(linenr_T n, int upd_topline) /// Move the cursor down "n" lines in window "wp". /// Takes care of closed folds. -void cursor_down_inner(win_T *wp, long n) +void cursor_down_inner(win_T *wp, int n) { linenr_T lnum = wp->w_cursor.lnum; linenr_T line_count = wp->w_buffer->b_ml.ml_line_count; @@ -2667,7 +2667,7 @@ void cursor_down_inner(win_T *wp, long n) } /// @param upd_topline When true: update topline -int cursor_down(long n, int upd_topline) +int cursor_down(int n, int upd_topline) { // This fails if the cursor is already in the last line. if (n > 0 && curwin->w_cursor.lnum >= curwin->w_buffer->b_ml.ml_line_count) { @@ -2692,7 +2692,7 @@ int cursor_down(long n, int upd_topline) /// @param c Command character to be inserted /// @param count Repeat this many times /// @param no_esc Don't add an ESC at the end -int stuff_inserted(int c, long count, int no_esc) +int stuff_inserted(int c, int count, int no_esc) { char *esc_ptr; char *ptr; @@ -4099,7 +4099,7 @@ static void ins_s_left(void) if (!end_change) { AppendCharToRedobuff(K_S_LEFT); } - (void)bck_word(1L, false, false); + (void)bck_word(1, false, false); curwin->w_set_curswant = true; } else { vim_beep(BO_CRSR); @@ -4158,7 +4158,7 @@ static void ins_s_right(void) if (!end_change) { AppendCharToRedobuff(K_S_RIGHT); } - (void)fwd_word(1L, false, 0); + (void)fwd_word(1, false, 0); curwin->w_set_curswant = true; } else { vim_beep(BO_CRSR); @@ -4175,7 +4175,7 @@ static void ins_up(bool startcol) undisplay_dollar(); tpos = curwin->w_cursor; - if (cursor_up(1L, true) == OK) { + if (cursor_up(1, true) == OK) { if (startcol) { coladvance(getvcol_nolist(&Insstart)); } @@ -4223,7 +4223,7 @@ static void ins_down(bool startcol) undisplay_dollar(); tpos = curwin->w_cursor; - if (cursor_down(1L, true) == OK) { + if (cursor_down(1, true) == OK) { if (startcol) { coladvance(getvcol_nolist(&Insstart)); } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8ffc6fd179..a3ea5169fd 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -454,8 +454,8 @@ void eval_init(void) set_vim_var_dict(VV_EVENT, tv_dict_alloc_lock(VAR_FIXED)); set_vim_var_list(VV_ERRORS, tv_list_alloc(kListLenUnknown)); set_vim_var_nr(VV_STDERR, CHAN_STDERR); - set_vim_var_nr(VV_SEARCHFORWARD, 1L); - set_vim_var_nr(VV_HLSEARCH, 1L); + set_vim_var_nr(VV_SEARCHFORWARD, 1); + set_vim_var_nr(VV_HLSEARCH, 1); set_vim_var_nr(VV_COUNT1, 1); set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER); set_vim_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING); @@ -6629,14 +6629,14 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret } // Get the line number. - pos.lnum = (linenr_T)tv_list_find_nr(l, 0L, &error); + pos.lnum = (linenr_T)tv_list_find_nr(l, 0, &error); if (error || pos.lnum <= 0 || pos.lnum > curbuf->b_ml.ml_line_count) { // Invalid line number. return NULL; } // Get the column number. - pos.col = (colnr_T)tv_list_find_nr(l, 1L, &error); + pos.col = (colnr_T)tv_list_find_nr(l, 1, &error); if (error) { return NULL; } @@ -6648,7 +6648,7 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret } // We accept "$" for the column number: last column. - listitem_T *li = tv_list_find(l, 1L); + listitem_T *li = tv_list_find(l, 1); if (li != NULL && TV_LIST_ITEM_TV(li)->v_type == VAR_STRING && TV_LIST_ITEM_TV(li)->vval.v_string != NULL && strcmp(TV_LIST_ITEM_TV(li)->vval.v_string, "$") == 0) { @@ -6663,7 +6663,7 @@ pos_T *var2fpos(const typval_T *const tv, const bool dollar_lnum, int *const ret pos.col--; // Get the virtual offset. Defaults to zero. - pos.coladd = (colnr_T)tv_list_find_nr(l, 2L, &error); + pos.coladd = (colnr_T)tv_list_find_nr(l, 2, &error); if (error) { pos.coladd = 0; } diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index c12fd9fd31..505a91813a 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -983,7 +983,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) int64_t idx = 0; if (argvars[2].v_type != VAR_UNKNOWN && argvars[3].v_type != VAR_UNKNOWN) { - idx = (long)tv_get_number_chk(&argvars[3], &error); + idx = (int64_t)tv_get_number_chk(&argvars[3], &error); } if (!error) { n = count_list(argvars[0].vval.v_list, &argvars[1], idx, ic); @@ -1860,11 +1860,11 @@ static void flatten_common(typval_T *argvars, typval_T *rettv, bool make_copy) return; } - long maxdepth; + int maxdepth; if (argvars[1].v_type == VAR_UNKNOWN) { maxdepth = 999999; } else { - maxdepth = (long)tv_get_number_chk(&argvars[1], &error); + maxdepth = (int)tv_get_number_chk(&argvars[1], &error); if (error) { return; } @@ -1929,7 +1929,7 @@ static void extend_list(typval_T *argvars, const char *arg_errmsg, bool is_new, listitem_T *item; if (argvars[2].v_type != VAR_UNKNOWN) { - long before = (long)tv_get_number_chk(&argvars[2], &error); + int before = (int)tv_get_number_chk(&argvars[2], &error); if (error) { return; // Type error; errmsg already given. } @@ -1937,7 +1937,7 @@ static void extend_list(typval_T *argvars, const char *arg_errmsg, bool is_new, if (before == tv_list_len(l1)) { item = NULL; } else { - item = tv_list_find(l1, (int)before); + item = tv_list_find(l1, before); if (item == NULL) { semsg(_(e_list_index_out_of_range_nr), (int64_t)before); return; @@ -3394,7 +3394,7 @@ static void f_indent(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) /// "index()" function static void f_index(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { - long idx = 0; + int idx = 0; bool ic = false; rettv->vval.v_number = -1; @@ -3421,7 +3421,7 @@ static void f_index(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) for (idx = start; idx < tv_blob_len(b); idx++) { typval_T tv; tv.v_type = VAR_NUMBER; - tv.vval.v_number = tv_blob_get(b, (int)idx); + tv.vval.v_number = tv_blob_get(b, idx); if (tv_equal(&tv, &argvars[1], ic, false)) { rettv->vval.v_number = idx; return; @@ -3447,7 +3447,7 @@ static void f_index(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) if (error || idx == -1) { item = NULL; } else { - item = tv_list_find(l, (int)idx); + item = tv_list_find(l, idx); assert(item != NULL); } if (argvars[3].v_type != VAR_UNKNOWN) { @@ -3690,11 +3690,11 @@ static void f_insert(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) return; } - long before = 0; + int before = 0; const int len = tv_blob_len(b); if (argvars[2].v_type != VAR_UNKNOWN) { - before = (long)tv_get_number_chk(&argvars[2], &error); + before = (int)tv_get_number_chk(&argvars[2], &error); if (error) { return; // type error; errmsg already given } @@ -4511,7 +4511,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv, colnr_T startcol = 0; bool match = false; list_T *l = NULL; - long idx = 0; + int idx = 0; char *tofree = NULL; // Make 'cpoptions' empty, the 'l' flag should not be used here. @@ -4550,7 +4550,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv, li = tv_list_first(l); } else { expr = str = (char *)tv_get_string(&argvars[0]); - len = (long)strlen(str); + len = (int64_t)strlen(str); } char patbuf[NUMBUFLEN]; @@ -4571,7 +4571,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv, if (idx == -1) { goto theend; } - li = tv_list_find(l, (int)idx); + li = tv_list_find(l, idx); } else { if (start < 0) { |