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.
This commit is contained in:
dundargoc 2023-09-29 14:58:48 +02:00 committed by dundargoc
parent c513cbf361
commit acc646ad8f
57 changed files with 362 additions and 367 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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));
}

View File

@ -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;
}

View File

@ -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) {
start = 0;
@ -5414,10 +5414,10 @@ static void f_rand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
goto theend;
}
typval_T *const tvx = TV_LIST_ITEM_TV(tv_list_find(l, 0L));
typval_T *const tvy = TV_LIST_ITEM_TV(tv_list_find(l, 1L));
typval_T *const tvz = TV_LIST_ITEM_TV(tv_list_find(l, 2L));
typval_T *const tvw = TV_LIST_ITEM_TV(tv_list_find(l, 3L));
typval_T *const tvx = TV_LIST_ITEM_TV(tv_list_find(l, 0));
typval_T *const tvy = TV_LIST_ITEM_TV(tv_list_find(l, 1));
typval_T *const tvz = TV_LIST_ITEM_TV(tv_list_find(l, 2));
typval_T *const tvw = TV_LIST_ITEM_TV(tv_list_find(l, 3));
if (tvx->v_type != VAR_NUMBER) {
goto theend;
}
@ -5861,8 +5861,8 @@ static int list2proftime(typval_T *arg, proftime_T *tm) FUNC_ATTR_NONNULL_ALL
}
bool error = false;
varnumber_T n1 = tv_list_find_nr(arg->vval.v_list, 0L, &error);
varnumber_T n2 = tv_list_find_nr(arg->vval.v_list, 1L, &error);
varnumber_T n1 = tv_list_find_nr(arg->vval.v_list, 0, &error);
varnumber_T n2 = tv_list_find_nr(arg->vval.v_list, 1, &error);
if (error) {
return FAIL;
}
@ -7050,8 +7050,8 @@ static int searchpair_cmn(typval_T *argvars, pos_T *match_pos)
}
}
retval = (int)do_searchpair(spat, mpat, epat, dir, skip,
flags, match_pos, lnum_stop, time_limit);
retval = do_searchpair(spat, mpat, epat, dir, skip,
flags, match_pos, lnum_stop, time_limit);
theend:
p_ws = save_p_ws;
@ -7096,12 +7096,12 @@ static void f_searchpairpos(typval_T *argvars, typval_T *rettv, EvalFuncData fpt
/// @param time_limit stop after this many msec
///
/// @returns 0 or -1 for no match,
long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir,
const typval_T *skip, int flags, pos_T *match_pos, linenr_T lnum_stop,
int64_t time_limit)
int do_searchpair(const char *spat, const char *mpat, const char *epat, int dir,
const typval_T *skip, int flags, pos_T *match_pos, linenr_T lnum_stop,
int64_t time_limit)
FUNC_ATTR_NONNULL_ARG(1, 2, 3)
{
long retval = 0;
int retval = 0;
int nest = 1;
bool use_skip = false;
int options = SEARCH_KEEP;
@ -7147,7 +7147,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir
.sa_tm = &tm,
};
int n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
int n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1,
options, RE_SEARCH, &sia);
if (n == FAIL || (firstpos.lnum != 0 && equalpos(pos, firstpos))) {
// didn't find it or found the first match again: FAIL
@ -7489,7 +7489,7 @@ static void f_setpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
/// Translate a register type string to the yank type and block length
static int get_yank_type(char **const pp, MotionType *const yank_type, long *const block_len)
static int get_yank_type(char **const pp, MotionType *const yank_type, int *const block_len)
FUNC_ATTR_NONNULL_ALL
{
char *stropt = *pp;
@ -7507,7 +7507,7 @@ static int get_yank_type(char **const pp, MotionType *const yank_type, long *con
*yank_type = kMTBlockWise;
if (ascii_isdigit(stropt[1])) {
stropt++;
*block_len = getdigits_long(&stropt, false, 0) - 1;
*block_len = getdigits_int(&stropt, false, 0) - 1;
stropt--;
}
break;
@ -7523,7 +7523,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
bool append = false;
long block_len = -1;
int block_len = -1;
MotionType yank_type = kMTUnknown;
rettv->vval.v_number = 1; // FAIL is default.
@ -7735,11 +7735,11 @@ static void f_shiftwidth(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_UNKNOWN) {
long col = (long)tv_get_number_chk(argvars, NULL);
colnr_T col = (colnr_T)tv_get_number_chk(argvars, NULL);
if (col < 0) {
return; // type error; errmsg already given
}
rettv->vval.v_number = get_sw_value_col(curbuf, (colnr_T)col);
rettv->vval.v_number = get_sw_value_col(curbuf, col);
return;
}
rettv->vval.v_number = get_sw_value(curbuf);

View File

@ -678,7 +678,7 @@ int tv_list_assign_range(list_T *const dest, list_T *const src, const int idx1_a
listitem_T *src_li;
// Check whether any of the list items is locked before making any changes.
long idx = idx1;
int idx = idx1;
listitem_T *dest_li = first_li;
for (src_li = tv_list_first(src); src_li != NULL && dest_li != NULL;) {
if (value_check_lock(TV_LIST_ITEM_TV(dest_li)->v_lock, varname, TV_CSTRING)) {
@ -738,7 +738,7 @@ int tv_list_assign_range(list_T *const dest, list_T *const src, const int idx1_a
/// @param[in] maxdepth Maximum depth that will be flattened
///
/// @return OK or FAIL
void tv_list_flatten(list_T *list, listitem_T *first, long maxitems, long maxdepth)
void tv_list_flatten(list_T *list, listitem_T *first, int64_t maxitems, int64_t maxdepth)
FUNC_ATTR_NONNULL_ARG(1)
{
listitem_T *item;

View File

@ -235,7 +235,7 @@ static inline long tv_dict_len(const dict_T *d)
static inline long tv_dict_len(const dict_T *const d)
{
if (d == NULL) {
return 0L;
return 0;
}
return (long)d->dv_hashtab.ht_used;
}

View File

@ -2422,7 +2422,7 @@ void ex_function(exarg_T *eap)
} else {
xfree(line_to_free);
if (eap->getline == NULL) {
theline = getcmdline(':', 0L, indent, do_concat);
theline = getcmdline(':', 0, indent, do_concat);
} else {
theline = eap->getline(':', eap->cookie, indent, do_concat);
}

View File

@ -1088,13 +1088,13 @@ static int do_unlet_var(lval_T *lp, char *name_end, exarg_T *eap, int deep FUNC_
/// Unlet one item or a range of items from a list.
/// Return OK or FAIL.
static void tv_list_unlet_range(list_T *const l, listitem_T *const li_first, const long n1_arg,
const bool has_n2, const long n2)
static void tv_list_unlet_range(list_T *const l, listitem_T *const li_first, const int n1_arg,
const bool has_n2, const int n2)
{
assert(l != NULL);
// Delete a range of List items.
listitem_T *li_last = li_first;
long n1 = n1_arg;
int n1 = n1_arg;
while (true) {
listitem_T *const li = TV_LIST_ITEM_NEXT(l, li_last);
n1++;

View File

@ -323,7 +323,7 @@ void ex_align(exarg_T *eap)
}
(void)set_indent(new_indent, 0); // set indent
}
changed_lines(curbuf, eap->line1, 0, eap->line2 + 1, 0L, true);
changed_lines(curbuf, eap->line1, 0, eap->line2 + 1, 0, true);
curwin->w_cursor = save_curpos;
beginline(BL_WHITE | BL_FIX);
}
@ -696,7 +696,7 @@ void ex_sort(exarg_T *eap)
mark_adjust(eap->line2 - deleted, eap->line2, MAXLNUM, -deleted, kExtmarkNOOP);
msgmore(-deleted);
} else if (deleted < 0) {
mark_adjust(eap->line2, MAXLNUM, -deleted, 0L, kExtmarkNOOP);
mark_adjust(eap->line2, MAXLNUM, -deleted, 0, kExtmarkNOOP);
}
if (change_occurred || deleted != 0) {
@ -783,7 +783,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
// And Finally we adjust the marks we put at the end of the file back to
// their final destination at the new text position -- webb
last_line = curbuf->b_ml.ml_line_count;
mark_adjust_nofold(line1, line2, last_line - line2, 0L, kExtmarkNOOP);
mark_adjust_nofold(line1, line2, last_line - line2, 0, kExtmarkNOOP);
disable_fold_update++;
changed_lines(curbuf, last_line - num_lines + 1, 0, last_line + 1, num_lines, false);
@ -792,7 +792,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
int line_off = 0;
bcount_t byte_off = 0;
if (dest >= line2) {
mark_adjust_nofold(line2 + 1, dest, -num_lines, 0L, kExtmarkNOOP);
mark_adjust_nofold(line2 + 1, dest, -num_lines, 0, kExtmarkNOOP);
FOR_ALL_TAB_WINDOWS(tab, win) {
if (win->w_buffer == curbuf) {
foldMoveRange(win, &win->w_folds, line1, line2, dest);
@ -805,7 +805,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
line_off = -num_lines;
byte_off = -extent_byte;
} else {
mark_adjust_nofold(dest + 1, line1 - 1, num_lines, 0L, kExtmarkNOOP);
mark_adjust_nofold(dest + 1, line1 - 1, num_lines, 0, kExtmarkNOOP);
FOR_ALL_TAB_WINDOWS(tab, win) {
if (win->w_buffer == curbuf) {
foldMoveRange(win, &win->w_folds, dest + 1, line1 - 1, line2);
@ -820,7 +820,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
}
mark_adjust_nofold(last_line - num_lines + 1, last_line,
-(last_line - dest - extra), 0L, kExtmarkNOOP);
-(last_line - dest - extra), 0, kExtmarkNOOP);
disable_fold_update++;
changed_lines(curbuf, last_line - num_lines + 1, 0, last_line + 1, -extra, false);
@ -861,9 +861,9 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
if (dest > last_line + 1) {
dest = last_line + 1;
}
changed_lines(curbuf, line1, 0, dest, 0L, false);
changed_lines(curbuf, line1, 0, dest, 0, false);
} else {
changed_lines(curbuf, dest + 1, 0, line1 + num_lines, 0L, false);
changed_lines(curbuf, dest + 1, 0, line1 + num_lines, 0, false);
}
// send nvim_buf_lines_event regarding lines that were deleted
@ -1243,13 +1243,13 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b
// end of each line?
if (read_linecount >= linecount) {
// move all marks from old lines to new lines
mark_adjust(line1, line2, linecount, 0L, kExtmarkNOOP);
mark_adjust(line1, line2, linecount, 0, kExtmarkNOOP);
} else {
// move marks from old lines to new lines, delete marks
// that are in deleted lines
mark_adjust(line1, line1 + read_linecount - 1, linecount, 0L,
mark_adjust(line1, line1 + read_linecount - 1, linecount, 0,
kExtmarkNOOP);
mark_adjust(line1 + read_linecount, line2, MAXLNUM, 0L,
mark_adjust(line1 + read_linecount, line2, MAXLNUM, 0,
kExtmarkNOOP);
}
}
@ -2283,7 +2283,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
if (command != NULL) {
tlnum = (linenr_T)atol(command);
if (tlnum <= 0) {
tlnum = 1L;
tlnum = 1;
}
}
// Add BLN_NOCURWIN to avoid a new wininfo items are associated
@ -2295,7 +2295,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
}
goto theend;
}
buf = buflist_new(ffname, sfname, 0L,
buf = buflist_new(ffname, sfname, 0,
BLN_CURBUF | (flags & ECMD_SET_HELP ? 0 : BLN_LISTED));
// Autocmds may change curwin and curbuf.
if (oldwin != NULL) {
@ -2861,16 +2861,16 @@ void ex_append(exarg_T *eap)
ml_append(lnum, theline, (colnr_T)0, false);
if (empty) {
// there are no marks below the inserted lines
appended_lines(lnum, 1L);
appended_lines(lnum, 1);
} else {
appended_lines_mark(lnum, 1L);
appended_lines_mark(lnum, 1);
}
xfree(theline);
lnum++;
if (empty) {
ml_delete(2L, false);
ml_delete(2, false);
empty = 0;
}
}
@ -4020,10 +4020,10 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_n
*p1 = NUL; // truncate up to the CR
ml_append(lnum - 1, new_start,
(colnr_T)(p1 - new_start + 1), false);
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, 1L, 0L, kExtmarkNOOP);
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, 1, 0, kExtmarkNOOP);
if (subflags.do_ask) {
appended_lines(lnum - 1, 1L);
appended_lines(lnum - 1, 1);
} else {
if (first_line == 0) {
first_line = lnum;

View File

@ -939,7 +939,7 @@ static char *get_loop_line(int c, void *cookie, int indent, bool do_concat)
char *line;
// First time inside the ":while"/":for": get line normally.
if (cp->getline == NULL) {
line = getcmdline(c, 0L, indent, do_concat);
line = getcmdline(c, 0, indent, do_concat);
} else {
line = cp->getline(c, cp->cookie, indent, do_concat);
}
@ -3431,7 +3431,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
}
searchcmdlen = 0;
flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG;
if (!do_search(NULL, c, c, cmd, 1L, flags, NULL)) {
if (!do_search(NULL, c, c, cmd, 1, flags, NULL)) {
curwin->w_cursor = pos;
cmd = NULL;
goto error;
@ -3468,7 +3468,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
pos.coladd = 0;
if (searchit(curwin, curbuf, &pos, NULL,
*cmd == '?' ? BACKWARD : FORWARD,
"", 1L, SEARCH_MSG, i, NULL) != FAIL) {
"", 1, SEARCH_MSG, i, NULL) != FAIL) {
lnum = pos.lnum;
} else {
cmd = NULL;
@ -5576,13 +5576,13 @@ static void ex_read(exarg_T *eap)
} else {
lnum = 1;
}
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK) {
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1) == OK) {
ml_delete(lnum, false);
if (curwin->w_cursor.lnum > 1
&& curwin->w_cursor.lnum >= lnum) {
curwin->w_cursor.lnum--;
}
deleted_lines_mark(lnum, 1L);
deleted_lines_mark(lnum, 1);
}
}
redraw_curbuf_later(UPD_VALID);
@ -5812,7 +5812,7 @@ static void ex_sleep(exarg_T *eap)
case 'm':
break;
case NUL:
len *= 1000L; break;
len *= 1000; break;
default:
semsg(_(e_invarg2), eap->arg); return;
}
@ -5877,7 +5877,7 @@ static void ex_wincmd(exarg_T *eap)
// Pass flags on for ":vertical wincmd ]".
postponed_split_flags = cmdmod.cmod_split;
postponed_split_tab = cmdmod.cmod_tab;
do_window(*eap->arg, eap->addr_count > 0 ? eap->line2 : 0L, xchar);
do_window(*eap->arg, eap->addr_count > 0 ? eap->line2 : 0, xchar);
postponed_split_flags = 0;
postponed_split_tab = 0;
}
@ -6630,7 +6630,7 @@ void exec_normal(bool was_typed)
static void ex_checkpath(exarg_T *eap)
{
find_pattern_in_path(NULL, 0, 0, false, false, CHECK_PATH, 1L,
find_pattern_in_path(NULL, 0, 0, false, false, CHECK_PATH, 1,
eap->forceit ? ACTION_SHOW_ALL : ACTION_SHOW,
(linenr_T)1, (linenr_T)MAXLNUM);
}
@ -6986,7 +6986,7 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
break;
case SPEC_CFILE: // file name under cursor
result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL);
result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1, NULL);
if (result == NULL) {
*errormsg = "";
return NULL;

View File

@ -453,7 +453,7 @@ static void may_do_incsearch_highlighting(int firstc, int count, incsearch_state
ui_flush();
emsg_off++; // So it doesn't beep if bad expr
// Set the time limit to half a second.
tm = profile_setlimit(500L);
tm = profile_setlimit(500);
if (!p_hls) {
search_flags += SEARCH_KEEP;
}
@ -2747,7 +2747,7 @@ char *getcmdline_prompt(const int firstc, const char *const prompt, const int at
int msg_silent_saved = msg_silent;
msg_silent = 0;
char *const ret = (char *)command_line_enter(firstc, 1L, 0, false);
char *const ret = (char *)command_line_enter(firstc, 1, 0, false);
if (did_save_ccline) {
restore_cmdline(&save_ccline);
@ -2947,7 +2947,7 @@ char *getexline(int c, void *cookie, int indent, bool do_concat)
(void)vgetc();
}
return getcmdline(c, 1L, indent, do_concat);
return getcmdline(c, 1, indent, do_concat);
}
bool cmdline_overstrike(void)

View File

@ -629,7 +629,7 @@ static int makeopens(FILE *fd, char *dirnow)
&& buf->b_p_bl) {
if (fprintf(fd, "badd +%" PRId64 " ",
buf->b_wininfo == NULL
? (int64_t)1L
? 1
: (int64_t)buf->b_wininfo->wi_mark.mark.lnum) < 0
|| ses_fname(fd, buf, &ssop_flags, true) == FAIL) {
return FAIL;

View File

@ -718,7 +718,7 @@ retry:
if (read_buffer) {
read_buf_lnum = 1;
read_buf_col = 0;
} else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) {
} else if (read_stdin || vim_lseek(fd, 0, SEEK_SET) != 0) {
// Can't rewind the file, give up.
error = true;
goto failed;
@ -880,9 +880,9 @@ retry:
// Use buffer >= 64K. Add linerest to double the size if the
// line gets very long, to avoid a lot of copying. But don't
// read more than 1 Mbyte at a time, so we can be interrupted.
size = 0x10000L + linerest;
if (size > 0x100000L) {
size = 0x100000L;
size = 0x10000 + linerest;
if (size > 0x100000) {
size = 0x100000;
}
}
@ -1531,7 +1531,7 @@ rewind_retry:
if (try_unix
&& !read_stdin
&& (read_buffer
|| vim_lseek(fd, (off_T)0L, SEEK_SET) == 0)) {
|| vim_lseek(fd, 0, SEEK_SET) == 0)) {
fileformat = EOL_UNIX;
if (set_options) {
set_fileformat(EOL_UNIX, OPT_LOCAL);
@ -3054,7 +3054,7 @@ int buf_check_timestamp(buf_T *buf)
if (emsg_silent == 0 && !in_assert_fails) {
ui_flush();
// give the user some time to think about it
os_delay(1004L, true);
os_delay(1004, true);
// don't redraw and erase the message
redraw_cmdline = false;

View File

@ -650,7 +650,7 @@ void foldCreate(win_T *wp, pos_T start, pos_T end)
// We want the new fold to be closed. If it would remain open because
// of using 'foldlevel', need to adjust fd_flags of containing folds.
if (use_level && !closed && level < wp->w_p_fdl) {
closeFold(start, 1L);
closeFold(start, 1);
}
if (!use_level) {
wp->w_fold_manual = true;
@ -748,7 +748,7 @@ void deleteFold(win_T *const wp, const linenr_T start, const linenr_T end, const
}
if (last_lnum > 0) {
changed_lines(wp->w_buffer, first_lnum, (colnr_T)0, last_lnum, 0L, false);
changed_lines(wp->w_buffer, first_lnum, (colnr_T)0, last_lnum, 0, false);
// send one nvim_buf_lines_event at the end
// last_lnum is the line *after* the last line of the outermost fold
@ -1584,7 +1584,7 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end)
// Update both changes here, to avoid all folds after the start are
// changed when the start marker is inserted and the end isn't.
changed_lines(buf, start.lnum, (colnr_T)0, end.lnum, 0L, false);
changed_lines(buf, start.lnum, (colnr_T)0, end.lnum, 0, false);
// Note: foldAddMarker() may not actually change start and/or end if
// u_save() is unable to save the buffer line, but we send the
@ -2295,7 +2295,7 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
// nested folds (with relative line numbers) down.
foldMarkAdjustRecurse(flp->wp, &fp->fd_nested,
(linenr_T)0, (linenr_T)MAXLNUM,
(fp->fd_top - firstlnum), 0L);
(fp->fd_top - firstlnum), 0);
} else {
// Will move fold down, move nested folds relatively up.
foldMarkAdjustRecurse(flp->wp, &fp->fd_nested,
@ -2367,7 +2367,7 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
fp->fd_len = startlnum - fp->fd_top;
foldMarkAdjustRecurse(flp->wp, &fp->fd_nested,
fp->fd_len, (linenr_T)MAXLNUM,
(linenr_T)MAXLNUM, 0L);
(linenr_T)MAXLNUM, 0);
fold_changed = true;
}
} else {
@ -2861,7 +2861,7 @@ static void foldMerge(win_T *const wp, fold_T *fp1, garray_T *gap, fold_T *fp2)
// If the last nested fold in fp1 touches the first nested fold in fp2,
// merge them recursively.
if (foldFind(gap1, fp1->fd_len - 1, &fp3) && foldFind(gap2, 0L, &fp4)) {
if (foldFind(gap1, fp1->fd_len - 1, &fp3) && foldFind(gap2, 0, &fp4)) {
foldMerge(wp, fp3, gap2, fp4);
}

View File

@ -112,7 +112,7 @@ local value_dumpers = {
string=cstr,
boolean=function(v) return v and 'true' or 'false' end,
number=function(v) return ('%iL'):format(v) end,
['nil']=function(_) return '0L' end,
['nil']=function(_) return '0' end,
}
local get_value = function(v)

View File

@ -295,7 +295,7 @@ static void add_num_buff(buffheader_T *buf, int n)
{
char number[32];
snprintf(number, sizeof(number), "%d", n);
add_buff(buf, number, -1L);
add_buff(buf, number, -1);
}
/// Add character 'c' to buffer "buf".
@ -327,7 +327,7 @@ static void add_char_buff(buffheader_T *buf, int c)
temp[0] = (char)c;
temp[1] = NUL;
}
add_buff(buf, temp, -1L);
add_buff(buf, temp, -1);
}
}
@ -419,7 +419,7 @@ void flush_buffers(flush_buffers_T flush_typeahead)
// We have to get all characters, because we may delete the first
// part of an escape sequence. In an xterm we get one char at a
// time and we have to get them all.
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10L) != 0) {}
while (inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 10) != 0) {}
}
typebuf.tb_off = MAXMAPLEN;
typebuf.tb_len = 0;
@ -488,7 +488,7 @@ void saveRedobuff(save_redo_T *save_redo)
return;
}
add_buff(&redobuff, s, -1L);
add_buff(&redobuff, s, -1);
xfree(s);
}
@ -507,7 +507,7 @@ void restoreRedobuff(save_redo_T *save_redo)
void AppendToRedobuff(const char *s)
{
if (!block_redo) {
add_buff(&redobuff, s, -1L);
add_buff(&redobuff, s, -1);
}
}
@ -553,7 +553,7 @@ void AppendToRedobuffLit(const char *str, int len)
// CTRL-V '0' must be inserted as CTRL-V 048.
if (*s == NUL && c == '0') {
add_buff(&redobuff, "048", 3L);
add_buff(&redobuff, "048", 3);
} else {
add_char_buff(&redobuff, c);
}
@ -571,7 +571,7 @@ void AppendToRedobuffSpec(const char *s)
while (*s != NUL) {
if ((uint8_t)(*s) == K_SPECIAL && s[1] != NUL && s[2] != NUL) {
// Insert special key literally.
add_buff(&redobuff, s, 3L);
add_buff(&redobuff, s, 3);
s += 3;
} else {
add_char_buff(&redobuff, mb_cptr2char_adv(&s));
@ -600,14 +600,14 @@ void AppendNumberToRedobuff(int n)
/// K_SPECIAL must already have been escaped.
void stuffReadbuff(const char *s)
{
add_buff(&readbuf1, s, -1L);
add_buff(&readbuf1, s, -1);
}
/// Append string "s" to the redo stuff buffer.
/// @remark K_SPECIAL must already have been escaped.
void stuffRedoReadbuff(const char *s)
{
add_buff(&readbuf2, s, -1L);
add_buff(&readbuf2, s, -1);
}
void stuffReadbuffLen(const char *s, ptrdiff_t len)
@ -764,7 +764,7 @@ int start_redo(int count, bool old_redo)
// copy the buffer name, if present
if (c == '"') {
add_buff(&readbuf2, "\"", 1L);
add_buff(&readbuf2, "\"", 1);
c = read_redo(false, old_redo);
// if a numbered buffer is used, increment the number
@ -822,7 +822,7 @@ int start_redo_ins(void)
while ((c = read_redo(false, false)) != NUL) {
if (vim_strchr("AaIiRrOo", c) != NULL) {
if (c == 'O' || c == 'o') {
add_buff(&readbuf2, NL_STR, -1L);
add_buff(&readbuf2, NL_STR, -1);
}
break;
}
@ -2424,7 +2424,7 @@ static int vgetorpeek(bool advance)
int keylen = 0;
if (got_int) {
// flush all input
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L);
c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0);
// If inchar() returns true (script file was active) or we
// are inside a mapping, get out of Insert mode.
@ -2503,7 +2503,7 @@ static int vgetorpeek(bool advance)
&& typebuf.tb_maplen == 0
&& (State & MODE_INSERT)
&& (p_timeout || (keylen == KEYLEN_PART_KEY && p_ttimeout))
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len, 3, 25L)) == 0) {
&& (c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len, 3, 25)) == 0) {
if (mode_displayed) {
unshowmode(true);
mode_deleted = true;
@ -2688,16 +2688,16 @@ static int vgetorpeek(bool advance)
timedout = false;
}
long wait_time = 0;
int wait_time = 0;
if (advance) {
if (typebuf.tb_len == 0 || !(p_timeout || (p_ttimeout && keylen == KEYLEN_PART_KEY))) {
// blocking wait
wait_time = -1L;
wait_time = -1;
} else if (keylen == KEYLEN_PART_KEY && p_ttm >= 0) {
wait_time = (long)p_ttm;
wait_time = (int)p_ttm;
} else {
wait_time = (long)p_tm;
wait_time = (int)p_tm;
}
}
@ -2802,7 +2802,7 @@ int inchar(uint8_t *buf, int maxlen, long wait_time)
int retesc = false; // Return ESC with gotint.
const int tb_change_cnt = typebuf.tb_change_cnt;
if (wait_time == -1L || wait_time > 100L) {
if (wait_time == -1 || wait_time > 100) {
// flush output before waiting
ui_flush();
}
@ -2852,7 +2852,7 @@ int inchar(uint8_t *buf, int maxlen, long wait_time)
uint8_t dum[DUM_LEN + 1];
while (true) {
len = os_inchar(dum, DUM_LEN, 0L, 0, NULL);
len = os_inchar(dum, DUM_LEN, 0, 0, NULL);
if (len == 0 || (len == 1 && dum[0] == Ctrl_C)) {
break;
}
@ -2862,7 +2862,7 @@ int inchar(uint8_t *buf, int maxlen, long wait_time)
// Always flush the output characters when getting input characters
// from the user and not just peeking.
if (wait_time == -1L || wait_time > 10L) {
if (wait_time == -1 || wait_time > 10) {
ui_flush();
}

View File

@ -838,7 +838,7 @@ void fix_help_buffer(void)
}
linenr_T appended = lnum - lnum_start;
if (appended) {
mark_adjust(lnum_start + 1, (linenr_T)MAXLNUM, appended, 0L, kExtmarkUndo);
mark_adjust(lnum_start + 1, (linenr_T)MAXLNUM, appended, 0, kExtmarkUndo);
buf_redraw_changed_lines_later(curbuf, lnum_start + 1, lnum_start + 1, appended);
}
break;

View File

@ -2288,7 +2288,7 @@ static void highlight_list_two(int cnt, int attr)
msg_puts_attr(&("N \bI \b! \b"[cnt / 11]), attr);
msg_clr_eos();
ui_flush();
os_delay(cnt == 99 ? 40L : (uint64_t)cnt * 50L, false);
os_delay(cnt == 99 ? 40 : (uint64_t)cnt * 50, false);
}
/// Function given to ExpandGeneric() to obtain the list of group names.

View File

@ -800,7 +800,7 @@ int get_breakindent_win(win_T *wp, char *line)
FUNC_ATTR_NONNULL_ALL
{
static int prev_indent = 0; // cached indent value
static OptInt prev_ts = 0L; // cached tabstop value
static OptInt prev_ts = 0; // cached tabstop value
static int prev_fnum = 0; // cached buffer number
static char *prev_line = NULL; // cached copy of "line"
static varnumber_T prev_tick = 0; // changedtick of cached value
@ -1018,7 +1018,7 @@ void ex_retab(exarg_T *eap)
// len is actual number of white characters used
len = num_spaces + num_tabs;
old_len = (int)strlen(ptr);
const long new_len = old_len - col + start_col + len + 1;
const int new_len = old_len - col + start_col + len + 1;
if (new_len <= 0 || new_len >= MAXCOL) {
emsg_text_too_long();
break;
@ -1083,7 +1083,7 @@ void ex_retab(exarg_T *eap)
redraw_curbuf_later(UPD_NOT_VALID);
}
if (first_line != 0) {
changed_lines(curbuf, first_line, 0, last_line + 1, 0L, true);
changed_lines(curbuf, first_line, 0, last_line + 1, 0, true);
}
curwin->w_p_list = save_list; // restore 'list'

View File

@ -112,7 +112,7 @@ int get_keystroke(MultiQueue *events)
// First time: blocking wait. Second time: wait up to 100ms for a
// terminal code to complete.
n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0, events);
n = os_inchar(buf + len, maxlen, len == 0 ? -1 : 100, 0, events);
if (n > 0) {
// Replace zero and K_SPECIAL by a special key code.
n = fix_input_buffer(buf + len, n);

View File

@ -474,7 +474,7 @@ bool check_compl_option(bool dict_opt)
vim_beep(BO_COMPL);
setcursor();
ui_flush();
os_delay(2004L, false);
os_delay(2004, false);
}
return false;
}
@ -2986,7 +2986,7 @@ static void get_next_include_file_completion(int compl_type)
((compl_type == CTRL_X_PATH_DEFINES
&& !(compl_cont_status & CONT_SOL))
? FIND_DEFINE : FIND_ANY),
1L, ACTION_EXPAND, 1, MAXLNUM);
1, ACTION_EXPAND, 1, MAXLNUM);
}
/// Get the next set of words matching "compl_pattern" in dictionary or
@ -3208,7 +3208,7 @@ static int get_next_default_completion(ins_compl_next_state_T *st, pos_T *start_
compl_direction, compl_pattern);
} else {
found_new_match = searchit(NULL, st->ins_buf, st->cur_match_pos,
NULL, compl_direction, compl_pattern, 1L,
NULL, compl_direction, compl_pattern, 1,
SEARCH_KEEP + SEARCH_NFMSG, RE_LAST, NULL);
}
msg_silent--;

View File

@ -619,7 +619,7 @@ static bool nlua_init_packages(lua_State *lstate, bool is_standalone)
lua_getfield(lstate, -1, "preload"); // [package, preload]
for (size_t i = 0; i < ARRAY_SIZE(builtin_modules); i++) {
ModuleDef def = builtin_modules[i];
lua_pushinteger(lstate, (long)i); // [package, preload, i]
lua_pushinteger(lstate, (lua_Integer)i); // [package, preload, i]
lua_pushcclosure(lstate, nlua_module_preloader, 1); // [package, preload, cclosure]
lua_setfield(lstate, -2, def.name); // [package, preload]

View File

@ -80,7 +80,7 @@ int nlua_spell_check(lua_State *lstate)
lua_rawseti(lstate, -2, 2);
// +1 for 1-indexing
lua_pushinteger(lstate, (long)pos + 1);
lua_pushinteger(lstate, (lua_Integer)pos + 1);
lua_rawseti(lstate, -2, 3);
lua_rawseti(lstate, -2, ++no_res);

View File

@ -183,8 +183,8 @@ int nlua_str_utfindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
size_t codepoints = 0, codeunits = 0;
mb_utflen(s1, (size_t)idx, &codepoints, &codeunits);
lua_pushinteger(lstate, (long)codepoints);
lua_pushinteger(lstate, (long)codeunits);
lua_pushinteger(lstate, (lua_Integer)codepoints);
lua_pushinteger(lstate, (lua_Integer)codeunits);
return 2;
}
@ -204,7 +204,7 @@ static int nlua_str_utf_pos(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
size_t clen;
for (size_t i = 0; i < s1_len && s1[i] != NUL; i += clen) {
clen = (size_t)utf_ptr2len_len(s1 + i, (int)(s1_len - i));
lua_pushinteger(lstate, (long)i + 1);
lua_pushinteger(lstate, (lua_Integer)i + 1);
lua_rawseti(lstate, -2, (int)idx);
idx++;
}
@ -276,7 +276,7 @@ int nlua_str_byteindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
return luaL_error(lstate, "index out of range");
}
lua_pushinteger(lstate, (long)byteidx);
lua_pushinteger(lstate, (lua_Integer)byteidx);
return 1;
}

View File

@ -64,12 +64,12 @@ static void lua_pushhunk(lua_State *lstate, long start_a, long count_a, long sta
lua_rawseti(lstate, -2, (signed)lua_objlen(lstate, -2) + 1);
}
static void get_linematch_results(lua_State *lstate, mmfile_t *ma, mmfile_t *mb, long start_a,
long count_a, long start_b, long count_b, bool iwhite)
static void get_linematch_results(lua_State *lstate, mmfile_t *ma, mmfile_t *mb, int start_a,
int count_a, int start_b, int count_b, bool iwhite)
{
// get the pointer to char of the start of the diff to pass it to linematch algorithm
const char *diff_begin[2] = { ma->ptr, mb->ptr };
int diff_length[2] = { (int)count_a, (int)count_b };
int diff_length[2] = { count_a, count_b };
fastforward_buf_to_lnum(&diff_begin[0], (linenr_T)start_a + 1);
fastforward_buf_to_lnum(&diff_begin[1], (linenr_T)start_b + 1);
@ -77,12 +77,12 @@ static void get_linematch_results(lua_State *lstate, mmfile_t *ma, mmfile_t *mb,
int *decisions = NULL;
size_t decisions_length = linematch_nbuffers(diff_begin, diff_length, 2, &decisions, iwhite);
long lnuma = start_a, lnumb = start_b;
int lnuma = start_a, lnumb = start_b;
long hunkstarta = lnuma;
long hunkstartb = lnumb;
long hunkcounta = 0;
long hunkcountb = 0;
int hunkstarta = lnuma;
int hunkstartb = lnumb;
int hunkcounta = 0;
int hunkcountb = 0;
for (size_t i = 0; i < decisions_length; i++) {
if (i && (decisions[i - 1] != decisions[i])) {
lua_pushhunk(lstate, hunkstarta, hunkcounta, hunkstartb, hunkcountb);
@ -110,8 +110,8 @@ static int write_string(void *priv, mmbuffer_t *mb, int nbuf)
{
luaL_Buffer *buf = (luaL_Buffer *)priv;
for (int i = 0; i < nbuf; i++) {
const long size = mb[i].size;
for (long total = 0; total < size; total += LUAL_BUFFERSIZE) {
const int size = mb[i].size;
for (int total = 0; total < size; total += LUAL_BUFFERSIZE) {
const int tocopy = MIN((int)(size - total), LUAL_BUFFERSIZE);
char *p = luaL_prepbuffer(buf);
if (!p) {

View File

@ -585,7 +585,7 @@ int main(int argc, char **argv)
// 'autochdir' has been postponed.
do_autochdir();
set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
set_vim_var_nr(VV_VIM_DID_ENTER, 1);
apply_autocmds(EVENT_VIMENTER, NULL, NULL, false, curbuf);
TIME_MSG("VimEnter autocommands");
if (use_remote_ui) {
@ -610,7 +610,7 @@ int main(int argc, char **argv)
// scrollbind, sync the scrollbind now.
if (curwin->w_p_diff && curwin->w_p_scb) {
update_topline(curwin);
check_scrollbind((linenr_T)0, 0L);
check_scrollbind((linenr_T)0, 0);
TIME_MSG("diff scrollbinding");
}
@ -1027,7 +1027,7 @@ static void command_line_scan(mparm_T *parmp)
int argv_idx; // index in argv[n][]
bool had_minmin = false; // found "--" argument
int want_argument; // option argument with argument
long n;
int n;
argc--;
argv++;

View File

@ -441,11 +441,11 @@ fmark_T *mark_get_motion(buf_T *buf, win_T *win, int name)
listcmd_busy = true; // avoid that '' is changed
if (name == '{' || name == '}') { // to previous/next paragraph
oparg_T oa;
if (findpar(&oa.inclusive, name == '}' ? FORWARD : BACKWARD, 1L, NUL, false)) {
if (findpar(&oa.inclusive, name == '}' ? FORWARD : BACKWARD, 1, NUL, false)) {
mark = pos_to_mark(buf, NULL, win->w_cursor);
}
} else if (name == '(' || name == ')') { // to previous/next sentence
if (findsent(name == ')' ? FORWARD : BACKWARD, 1L)) {
if (findsent(name == ')' ? FORWARD : BACKWARD, 1)) {
mark = pos_to_mark(buf, NULL, win->w_cursor);
}
}
@ -1064,10 +1064,10 @@ void ex_changes(exarg_T *eap)
if (got_int) {
break;
}
snprintf(IObuff, IOSIZE, "%c %3d %5ld %4d ",
snprintf(IObuff, IOSIZE, "%c %3d %5" PRIdLINENR " %4d ",
i == curwin->w_changelistidx ? '>' : ' ',
i > curwin->w_changelistidx ? i - curwin->w_changelistidx : curwin->w_changelistidx - i,
(long)curbuf->b_changelist[i].mark.lnum,
curbuf->b_changelist[i].mark.lnum,
curbuf->b_changelist[i].mark.col);
msg_outtrans(IObuff, 0);
name = mark_line(&curbuf->b_changelist[i].mark, 17);
@ -1143,7 +1143,7 @@ void mark_adjust_buf(buf_T *buf, linenr_T line1, linenr_T line2, linenr_T amount
linenr_T *lp;
static pos_T initpos = { 1, 0, 0 };
if (line2 < line1 && amount_after == 0L) { // nothing to do
if (line2 < line1 && amount_after == 0) { // nothing to do
return;
}
@ -1321,7 +1321,7 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, linenr_T lnum_amount, colnr_
int fnum = curbuf->b_fnum;
pos_T *posp;
if ((col_amount == 0L && lnum_amount == 0L) || (cmdmod.cmod_flags & CMOD_LOCKMARKS)) {
if ((col_amount == 0 && lnum_amount == 0) || (cmdmod.cmod_flags & CMOD_LOCKMARKS)) {
return; // nothing to do
}
// named marks, lower case and upper case

View File

@ -2774,7 +2774,7 @@ void f_setcellwidths(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
const listitem_T *lili = tv_list_first(li_l);
const varnumber_T n1 = TV_LIST_ITEM_TV(lili)->vval.v_number;
if (item > 0 && n1 <= table[item - 1].last) {
semsg(_(e_overlapping_ranges_for_nr), (long)n1);
semsg(_(e_overlapping_ranges_for_nr), (size_t)n1);
xfree((void *)ptrs);
xfree(table);
return;

View File

@ -125,7 +125,7 @@ memfile_T *mf_open(char *fname, int flags)
// must be rounded up.
if (mfp->mf_fd < 0
|| (flags & (O_TRUNC|O_EXCL))
|| (size = vim_lseek(mfp->mf_fd, 0L, SEEK_END)) <= 0) {
|| (size = vim_lseek(mfp->mf_fd, 0, SEEK_END)) <= 0) {
// no file or empty file
mfp->mf_blocknr_max = 0;
} else {

View File

@ -162,9 +162,9 @@ enum {
// This won't detect a 64 bit machine that only swaps a byte in the top 32
// bits, but that is crazy anyway.
enum {
B0_MAGIC_LONG = 0x30313233L,
B0_MAGIC_INT = 0x20212223L,
B0_MAGIC_SHORT = 0x10111213L,
B0_MAGIC_LONG = 0x30313233,
B0_MAGIC_INT = 0x20212223,
B0_MAGIC_SHORT = 0x10111213,
B0_MAGIC_CHAR = 0x55,
};
@ -677,8 +677,8 @@ static void set_b0_fname(ZeroBlock *b0p, buf_T *buf)
buf->b_mtime_read = buf->b_mtime;
buf->b_mtime_read_ns = buf->b_mtime_ns;
} else {
long_to_char(0L, b0p->b0_mtime);
long_to_char(0L, b0p->b0_ino);
long_to_char(0, b0p->b0_mtime);
long_to_char(0, b0p->b0_ino);
buf->b_mtime = 0;
buf->b_mtime_ns = 0;
buf->b_mtime_read = 0;
@ -895,7 +895,7 @@ void ml_recover(bool checkext)
goto theend;
}
off_T size;
if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) {
if ((size = vim_lseek(mfp->mf_fd, 0, SEEK_END)) <= 0) {
mfp->mf_blocknr_max = 0; // no file or empty file
} else {
mfp->mf_blocknr_max = size / mfp->mf_page_size;
@ -932,7 +932,7 @@ void ml_recover(bool checkext)
// check date of swapfile and original file
FileInfo org_file_info;
FileInfo swp_file_info;
long mtime = char_to_long(b0p->b0_mtime);
int mtime = (int)char_to_long(b0p->b0_mtime);
if (curbuf->b_ffname != NULL
&& os_fileinfo(curbuf->b_ffname, &org_file_info)
&& ((os_fileinfo(mfp->mf_fname, &swp_file_info)
@ -983,7 +983,7 @@ void ml_recover(bool checkext)
linenr_T lnum = 0; // append after line 0 in curbuf
linenr_T line_count = 0;
int idx = 0; // start with first index in block 1
long error = 0;
int error = 0;
buf->b_ml.ml_stack_top = 0; // -V1048
buf->b_ml.ml_stack = NULL;
buf->b_ml.ml_stack_size = 0; // -V1048
@ -1565,7 +1565,7 @@ static time_t swapfile_info(char *fname)
msg_outtrans(b0.b0_hname, 0);
}
if (char_to_long(b0.b0_pid) != 0L) {
if (char_to_long(b0.b0_pid) != 0) {
msg_puts(_("\n process ID: "));
msg_outnum((int)char_to_long(b0.b0_pid));
if ((process_running = swapfile_process_running(&b0, fname))) {
@ -1636,7 +1636,7 @@ static bool swapfile_unchanged(char *fname)
}
// process must be known and not running.
if (char_to_long(b0.b0_pid) == 0L || swapfile_process_running(&b0, fname)) {
if (char_to_long(b0.b0_pid) == 0 || swapfile_process_running(&b0, fname)) {
ret = false;
}

View File

@ -3719,7 +3719,7 @@ void msg_check_for_delay(bool check_msg_scroll)
&& emsg_silent == 0
&& !in_assert_fails) {
ui_flush();
os_delay(1006L, true);
os_delay(1006, true);
emsg_on_display = false;
if (check_msg_scroll) {
msg_scroll = false;

View File

@ -452,7 +452,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, int count, bool fixindent)
if ((State & REPLACE_FLAG) && !yank_register_mline(regname)) {
insert_reg(regname, true);
} else {
do_put(regname, NULL, BACKWARD, 1L,
do_put(regname, NULL, BACKWARD, 1,
(fixindent ? PUT_FIXINDENT : 0) | PUT_CURSEND);
// Repeat it with CTRL-R CTRL-O r or CTRL-R CTRL-P r
@ -710,9 +710,9 @@ popupexit:
&& which_button == MOUSE_LEFT) {
// open or close a fold at this line
if (jump_flags & MOUSE_FOLD_OPEN) {
openFold(curwin->w_cursor, 1L);
openFold(curwin->w_cursor, 1);
} else {
closeFold(curwin->w_cursor, 1L);
closeFold(curwin->w_cursor, 1);
}
// don't move the cursor if still in the same window
if (curwin == old_curwin) {
@ -733,7 +733,7 @@ popupexit:
// When dragging the mouse above the window, scroll down.
if (is_drag && mouse_row < 0 && !in_status_line) {
scroll_redraw(false, 1L);
scroll_redraw(false, 1);
mouse_row = 0;
}

View File

@ -695,9 +695,9 @@ static void normal_redraw_mode_message(NormalState *s)
ui_cursor_shape(); // show different cursor shape
ui_flush();
if (msg_scroll || emsg_on_display) {
os_delay(1003L, true); // wait at least one second
os_delay(1003, true); // wait at least one second
}
os_delay(3003L, false); // wait up to three seconds
os_delay(3003, false); // wait up to three seconds
State = save_State;
msg_scroll = false;
@ -896,8 +896,8 @@ static bool normal_get_command_count(NormalState *s)
if (s->c == K_DEL || s->c == K_KDEL) {
s->ca.count0 /= 10;
del_from_showcmd(4); // delete the digit and ~@%
} else if (s->ca.count0 > 99999999L) {
s->ca.count0 = 999999999L;
} else if (s->ca.count0 > 99999999) {
s->ca.count0 = 999999999;
} else {
s->ca.count0 = s->ca.count0 * 10 + (s->c - '0');
}
@ -1035,7 +1035,7 @@ normal_end:
restart_VIsual_select = 0;
}
if (restart_edit != 0 && !VIsual_active && s->old_mapped_len == 0) {
(void)edit(restart_edit, false, 1L);
(void)edit(restart_edit, false, 1);
}
}
@ -1113,8 +1113,8 @@ static int normal_execute(VimState *state, int key)
// If you give a count before AND after the operator, they are
// multiplied.
if (s->ca.count0) {
if (s->ca.opcount >= 999999999L / s->ca.count0) {
s->ca.count0 = 999999999L;
if (s->ca.opcount >= 999999999 / s->ca.count0) {
s->ca.count0 = 999999999;
} else {
s->ca.count0 *= s->ca.opcount;
}
@ -1443,7 +1443,7 @@ static int normal_check(VimState *state)
// Scroll-binding for diff mode may have been postponed until
// here. Avoids doing it for every change.
if (diff_need_scrollbind) {
check_scrollbind(0, 0L);
check_scrollbind(0, 0);
diff_need_scrollbind = false;
}
@ -1737,7 +1737,7 @@ static void prep_redo_cmd(cmdarg_T *cap)
/// Note that only the last argument can be a multi-byte char.
void prep_redo(int regname, int num, int cmd1, int cmd2, int cmd3, int cmd4, int cmd5)
{
prep_redo_num2(regname, num, cmd1, cmd2, 0L, cmd3, cmd4, cmd5);
prep_redo_num2(regname, num, cmd1, cmd2, 0, cmd3, cmd4, cmd5);
}
/// Prepare for redo of any command with extra count after "cmd2".
@ -2126,7 +2126,7 @@ void do_check_scrollbind(bool check)
// resync is performed, some of the other 'scrollbind' windows may
// need to jump so that the current window's relative position is
// visible on-screen.
check_scrollbind(curwin->w_topline - (linenr_T)curwin->w_scbind_pos, 0L);
check_scrollbind(curwin->w_topline - (linenr_T)curwin->w_scbind_pos, 0);
}
curwin->w_scbind_pos = curwin->w_topline;
}
@ -2364,7 +2364,7 @@ bool find_decl(char *ptr, size_t len, bool locally, bool thisblock, int flags_ar
// With "gD" go to line 1.
// With "gd" Search back for the start of the current function, then go
// back until a blank line. If this fails go to line 1.
if (!locally || !findpar(&incll, BACKWARD, 1L, '{', false)) {
if (!locally || !findpar(&incll, BACKWARD, 1, '{', false)) {
setpcmark(); // Set in findpar() otherwise
curwin->w_cursor.lnum = 1;
par_pos = curwin->w_cursor;
@ -2381,7 +2381,7 @@ bool find_decl(char *ptr, size_t len, bool locally, bool thisblock, int flags_ar
clearpos(&found_pos);
while (true) {
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
pat, 1L, searchflags, RE_LAST, NULL);
pat, 1, searchflags, RE_LAST, NULL);
if (curwin->w_cursor.lnum >= old_pos.lnum) {
t = false; // match after start is failure too
}
@ -2648,13 +2648,13 @@ void scroll_redraw(int up, linenr_T count)
&& curwin->w_topfill == prev_topfill) {
if (up) {
if (curwin->w_cursor.lnum > prev_lnum
|| cursor_down(1L, false) == false) {
|| cursor_down(1, false) == false) {
break;
}
} else {
if (curwin->w_cursor.lnum < prev_lnum
|| prev_topline == 1L
|| cursor_up(1L, false) == false) {
|| prev_topline == 1
|| cursor_up(1, false) == false) {
break;
}
}
@ -3211,7 +3211,7 @@ static void nv_colon(cmdarg_T *cap)
stuffcharReadbuff('.');
if (cap->count0 > 1) {
stuffReadbuff(",.+");
stuffnumReadbuff(cap->count0 - 1L);
stuffnumReadbuff(cap->count0 - 1);
}
}
@ -4781,7 +4781,7 @@ static void n_swapchar(cmdarg_T *cap)
curwin->w_set_curswant = true;
if (did_change) {
changed_lines(curbuf, startpos.lnum, startpos.col, curwin->w_cursor.lnum + 1,
0L, true);
0, true);
curbuf->b_op_start = startpos;
curbuf->b_op_end = curwin->w_cursor;
if (curbuf->b_op_end.col > 0) {
@ -5568,7 +5568,7 @@ static void nv_g_cmd(cmdarg_T *cap)
// "gs": Goto sleep.
case 's':
do_sleep(cap->count1 * 1000L);
do_sleep(cap->count1 * 1000);
break;
// "ga": Display the ascii value of the character under the
@ -5870,7 +5870,7 @@ static void set_op_var(int optype)
static void nv_lineop(cmdarg_T *cap)
{
cap->oap->motion_type = kMTLineWise;
if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == false) {
if (cursor_down(cap->count1 - 1, cap->oap->op_type == OP_NOP) == false) {
clearopbeep(cap->oap);
} else if ((cap->oap->op_type == OP_DELETE
// only with linewise motions
@ -6083,7 +6083,7 @@ static void nv_goto(cmdarg_T *cap)
if (cap->arg) {
lnum = curbuf->b_ml.ml_line_count;
} else {
lnum = 1L;
lnum = 1;
}
cap->oap->motion_type = kMTLineWise;
setpcmark();
@ -6092,8 +6092,8 @@ static void nv_goto(cmdarg_T *cap)
if (cap->count0 != 0) {
lnum = cap->count0;
}
if (lnum < 1L) {
lnum = 1L;
if (lnum < 1) {
lnum = 1;
} else if (lnum > curbuf->b_ml.ml_line_count) {
lnum = curbuf->b_ml.ml_line_count;
}

View File

@ -283,7 +283,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
}
}
changed_lines(curbuf, oap->start.lnum, 0, oap->end.lnum + 1, 0L, true);
changed_lines(curbuf, oap->start.lnum, 0, oap->end.lnum + 1, 0, true);
}
/// Shift the current line one shiftwidth left (if left != 0) or right
@ -628,7 +628,7 @@ static void block_insert(oparg_T *oap, char *s, int b_insert, struct block_def *
State = oldstate;
changed_lines(curbuf, oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L, true);
changed_lines(curbuf, oap->start.lnum + 1, 0, oap->end.lnum + 1, 0, true);
}
/// Handle reindenting a block of lines.
@ -694,7 +694,7 @@ void op_reindent(oparg_T *oap, Indenter how)
if (last_changed != 0) {
changed_lines(curbuf, first_changed, 0,
oap->is_VIsual ? start_lnum + oap->line_count :
last_changed + 1, 0L, true);
last_changed + 1, 0, true);
} else if (oap->is_VIsual) {
redraw_curbuf_later(UPD_INVERTED);
}
@ -720,7 +720,7 @@ int get_expr_register(void)
{
char *new_line;
new_line = getcmdline('=', 0L, 0, true);
new_line = getcmdline('=', 0, 0, true);
if (new_line == NULL) {
return NUL;
}
@ -1262,7 +1262,7 @@ int insert_reg(int regname, bool literally_arg)
char *arg;
if (regname == '.') { // Insert last inserted text.
retval = stuff_inserted(NUL, 1L, true);
retval = stuff_inserted(NUL, 1, true);
} else if (get_spec_reg(regname, &arg, &allocated, true)) {
if (arg == NULL) {
return FAIL;
@ -1280,7 +1280,7 @@ int insert_reg(int regname, bool literally_arg)
if (regname == '-') {
AppendCharToRedobuff(Ctrl_R);
AppendCharToRedobuff(regname);
do_put(regname, NULL, BACKWARD, 1L, PUT_CURSEND);
do_put(regname, NULL, BACKWARD, 1, PUT_CURSEND);
} else {
stuffescaped(reg->y_array[i], literally);
}
@ -1354,7 +1354,7 @@ bool get_spec_reg(int regname, char **argp, bool *allocated, bool errmsg)
return false;
}
*argp = file_name_at_cursor(FNAME_MESS | FNAME_HYP | (regname == Ctrl_P ? FNAME_EXP : 0),
1L, NULL);
1, NULL);
*allocated = true;
return true;
@ -1596,7 +1596,7 @@ int op_delete(oparg_T *oap)
check_cursor_col();
changed_lines(curbuf, curwin->w_cursor.lnum, curwin->w_cursor.col,
oap->end.lnum + 1, 0L, true);
oap->end.lnum + 1, 0, true);
oap->line_count = 0; // no lines deleted
} else if (oap->motion_type == kMTLineWise) {
if (oap->op_type == OP_CHANGE) {
@ -1936,7 +1936,7 @@ static int op_replace(oparg_T *oap, int c)
linenr_T baselnum = curwin->w_cursor.lnum;
if (after_p != NULL) {
ml_append(curwin->w_cursor.lnum++, after_p, (int)after_p_len, false);
appended_lines_mark(curwin->w_cursor.lnum, 1L);
appended_lines_mark(curwin->w_cursor.lnum, 1);
oap->end.lnum++;
xfree(after_p);
}
@ -2032,7 +2032,7 @@ static int op_replace(oparg_T *oap, int c)
curwin->w_cursor = oap->start;
check_cursor();
changed_lines(curbuf, oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L, true);
changed_lines(curbuf, oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0, true);
if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0) {
// Set "'[" and "']" marks.
@ -2066,7 +2066,7 @@ void op_tilde(oparg_T *oap)
did_change |= one_change;
}
if (did_change) {
changed_lines(curbuf, oap->start.lnum, 0, oap->end.lnum + 1, 0L, true);
changed_lines(curbuf, oap->start.lnum, 0, oap->end.lnum + 1, 0, true);
}
} else { // not block mode
if (oap->motion_type == kMTLineWise) {
@ -2095,7 +2095,7 @@ void op_tilde(oparg_T *oap)
}
if (did_change) {
changed_lines(curbuf, oap->start.lnum, oap->start.col, oap->end.lnum + 1,
0L, true);
0, true);
}
}
@ -2532,7 +2532,7 @@ int op_change(oparg_T *oap)
}
}
check_cursor();
changed_lines(curbuf, oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L, true);
changed_lines(curbuf, oap->start.lnum + 1, 0, oap->end.lnum + 1, 0, true);
xfree(ins_text);
}
}
@ -3618,7 +3618,7 @@ error:
ExtmarkOp kind = (y_type == kMTLineWise && !(flags & PUT_LINE_SPLIT))
? kExtmarkUndo : kExtmarkNOOP;
mark_adjust(curbuf->b_op_start.lnum + (y_type == kMTCharWise),
(linenr_T)MAXLNUM, nr_lines, 0L, kind);
(linenr_T)MAXLNUM, nr_lines, 0, kind);
// note changed text for displaying and folding
if (y_type == kMTCharWise) {
@ -4162,7 +4162,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
// Only report the change in the first line here, del_lines() will report
// the deleted line.
changed_lines(curbuf, curwin->w_cursor.lnum, currsize,
curwin->w_cursor.lnum + 1, 0L, true);
curwin->w_cursor.lnum + 1, 0, true);
// Delete following lines. To do this we move the cursor there
// briefly, and then move it back. After del_lines() the cursor may
@ -4381,7 +4381,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
change_cnt = do_addsub(oap->op_type, &pos, 0, amount);
disable_fold_update--;
if (change_cnt) {
changed_lines(curbuf, pos.lnum, 0, pos.lnum + 1, 0L, true);
changed_lines(curbuf, pos.lnum, 0, pos.lnum + 1, 0, true);
}
} else {
int length;
@ -4439,7 +4439,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
disable_fold_update--;
if (change_cnt) {
changed_lines(curbuf, oap->start.lnum, 0, oap->end.lnum + 1, 0L, true);
changed_lines(curbuf, oap->start.lnum, 0, oap->end.lnum + 1, 0, true);
}
if (!change_cnt && oap->is_VIsual) {
@ -5026,7 +5026,7 @@ static void finish_write_reg(int name, yankreg_T *reg, yankreg_T *old_y_previous
/// @see write_reg_contents_ex
void write_reg_contents(int name, const char *str, ssize_t len, int must_append)
{
write_reg_contents_ex(name, str, len, must_append, kMTUnknown, 0L);
write_reg_contents_ex(name, str, len, must_append, kMTUnknown, 0);
}
void write_reg_contents_lst(int name, char **strings, bool must_append, MotionType yank_type,
@ -5340,7 +5340,7 @@ void cursor_pos_info(dict_T *dict)
} else {
linenr_T lnum;
int eol_size;
varnumber_T last_check = 100000L;
varnumber_T last_check = 100000;
int line_count_selected = 0;
if (get_fileformat(curbuf) == EOL_DOS) {
eol_size = 2;
@ -5393,14 +5393,14 @@ void cursor_pos_info(dict_T *dict)
if (got_int) {
return;
}
last_check = byte_count + 100000L;
last_check = byte_count + 100000;
}
// Do extra processing for VIsual mode.
if (l_VIsual_active
&& lnum >= min_pos.lnum && lnum <= max_pos.lnum) {
char *s = NULL;
int len = 0L;
int len = 0;
switch (l_VIsual_mode) {
case Ctrl_V:
@ -6034,9 +6034,9 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (opchar == 'g' && extra_opchar == '@') {
// also repeat the count for 'operatorfunc'
prep_redo_num2(oap->regname, 0L, NUL, 'v', cap->count0, opchar, extra_opchar, nchar);
prep_redo_num2(oap->regname, 0, NUL, 'v', cap->count0, opchar, extra_opchar, nchar);
} else {
prep_redo(oap->regname, 0L, NUL, 'v', opchar, extra_opchar, nchar);
prep_redo(oap->regname, 0, NUL, 'v', opchar, extra_opchar, nchar);
}
}
if (!redo_VIsual_busy) {

View File

@ -366,7 +366,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
// When running in the background, give it some time to create the temp
// file, but don't wait for it to finish.
if (ampersand) {
os_delay(10L, true);
os_delay(10, true);
}
xfree(command);
@ -401,7 +401,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
xfree(tempname);
goto notfound;
}
int fseek_res = fseek(fd, 0L, SEEK_END);
int fseek_res = fseek(fd, 0, SEEK_END);
if (fseek_res < 0) {
xfree(tempname);
fclose(fd);
@ -417,7 +417,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
assert(templen <= SIZE_MAX); // NOLINT(runtime/int)
#endif
len = (size_t)templen;
fseek(fd, 0L, SEEK_SET);
fseek(fd, 0, SEEK_SET);
buffer = xmalloc(len + 1);
// fread() doesn't terminate buffer with NUL;
// appropriate termination (not always NUL) is done below.
@ -802,9 +802,9 @@ char *get_cmd_output(char *cmd, char *infile, ShellOpts flags, size_t *ret_len)
goto done;
}
fseek(fd, 0L, SEEK_END);
fseek(fd, 0, SEEK_END);
size_t len = (size_t)ftell(fd); // get size of temp file
fseek(fd, 0L, SEEK_SET);
fseek(fd, 0, SEEK_SET);
buffer = xmalloc(len + 1);
size_t i = fread(buffer, 1, len, fd);

View File

@ -301,13 +301,13 @@ void ex_profile(exarg_T *eap)
profile_fname = expand_env_save_opt(e, true);
do_profiling = PROF_YES;
profile_set_wait(profile_zero());
set_vim_var_nr(VV_PROFILING, 1L);
set_vim_var_nr(VV_PROFILING, 1);
} else if (do_profiling == PROF_NONE) {
emsg(_("E750: First use \":profile start {fname}\""));
} else if (strcmp(eap->arg, "stop") == 0) {
profile_dump();
do_profiling = PROF_NONE;
set_vim_var_nr(VV_PROFILING, 0L);
set_vim_var_nr(VV_PROFILING, 0);
profile_reset();
} else if (strcmp(eap->arg, "pause") == 0) {
if (do_profiling == PROF_YES) {

View File

@ -2084,7 +2084,7 @@ static int copy_loclist(qf_list_T *from_qfl, qf_list_T *to_qfl)
// Assign a new ID for the location list
to_qfl->qf_id = ++last_qf_id;
to_qfl->qf_changedtick = 0L;
to_qfl->qf_changedtick = 0;
// When no valid entries are present in the list, qf_ptr points to
// the first item in the list
@ -3450,7 +3450,7 @@ static void qf_free(qf_list_T *qfl)
qfl->qf_ctx = NULL;
callback_free(&qfl->qf_qftf_cb);
qfl->qf_id = 0;
qfl->qf_changedtick = 0L;
qfl->qf_changedtick = 0;
}
/// Adjust error list entries for changed line numbers

View File

@ -227,7 +227,7 @@ static int toggle_Magic(int x)
return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_(e_invalid_item_in_str_brackets), reg_magic == MAGIC_ALL)
#define MAX_LIMIT (32767L << 16L)
#define MAX_LIMIT (32767 << 16)
static const char e_invalid_character_after_str_at[]
= N_("E59: Invalid character after %s@");
@ -2628,11 +2628,11 @@ static void init_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_
static int prevchr_len; ///< byte length of previous char
static int num_complex_braces; ///< Complex \{...} count
static uint8_t *regcode; ///< Code-emit pointer, or JUST_CALC_SIZE
static long regsize; ///< Code size.
static int64_t regsize; ///< Code size.
static int reg_toolong; ///< true when offset out of range
static uint8_t had_endbrace[NSUBEXP]; ///< flags, true if end of () found
static long brace_min[10]; ///< Minimums for complex brace repeats
static long brace_max[10]; ///< Maximums for complex brace repeats
static int64_t brace_min[10]; ///< Minimums for complex brace repeats
static int64_t brace_max[10]; ///< Maximums for complex brace repeats
static int brace_count[10]; ///< Current counts for complex brace repeats
static int one_exactly = false; ///< only do one char for EXACTLY
@ -2656,9 +2656,9 @@ static int classcodes[] = {
typedef struct regstar_S {
int nextb; // next byte
int nextb_ic; // next byte reverse case
long count;
long minval;
long maxval;
int64_t count;
int64_t minval;
int64_t maxval;
} regstar_T;
// used to store input position when a BACK was encountered, so that we now if
@ -2729,8 +2729,8 @@ static regsave_T behind_pos;
#define NEXT(p) (((*((p) + 1) & 0377) << 8) + (*((p) + 2) & 0377))
#define OPERAND(p) ((p) + 3)
// Obtain an operand that was stored as four bytes, MSB first.
#define OPERAND_MIN(p) (((long)(p)[3] << 24) + ((long)(p)[4] << 16) \
+ ((long)(p)[5] << 8) + (long)(p)[6])
#define OPERAND_MIN(p) (((int64_t)(p)[3] << 24) + ((int64_t)(p)[4] << 16) \
+ ((int64_t)(p)[5] << 8) + (int64_t)(p)[6])
// Obtain a second operand stored as four bytes.
#define OPERAND_MAX(p) OPERAND_MIN((p) + 4)
// Obtain a second single-byte operand stored after a four bytes operand.
@ -3898,7 +3898,7 @@ static void reginsert(int op, uint8_t *opnd)
// Insert an operator in front of already-emitted operand.
// Add a number to the operator.
static void reginsert_nr(int op, long val, uint8_t *opnd)
static void reginsert_nr(int op, int64_t val, uint8_t *opnd)
{
uint8_t *src;
uint8_t *dst;
@ -3927,7 +3927,7 @@ static void reginsert_nr(int op, long val, uint8_t *opnd)
// The operator has the given limit values as operands. Also set next pointer.
//
// Means relocating the operand.
static void reginsert_limits(int op, long minval, long maxval, uint8_t *opnd)
static void reginsert_limits(int op, int64_t minval, int64_t maxval, uint8_t *opnd)
{
uint8_t *src;
uint8_t *dst;
@ -5310,8 +5310,8 @@ static void bt_regfree(regprog_T *prog)
// The arguments from BRACE_LIMITS are stored here. They are actually local
// to regmatch(), but they are here to reduce the amount of stack space used
// (it can be called recursively many times).
static long bl_minval;
static long bl_maxval;
static int64_t bl_minval;
static int64_t bl_maxval;
// Save the input line and position in a regsave_T.
static void reg_save(regsave_T *save, garray_T *gap)
@ -5388,9 +5388,9 @@ static void save_se_one(save_se_T *savep, uint8_t **pp)
/// Advances rex.input (and rex.lnum) to just after the matched chars.
///
/// @param maxcount maximum number of matches allowed
static int regrepeat(uint8_t *p, long maxcount)
static int regrepeat(uint8_t *p, int64_t maxcount)
{
long count = 0;
int64_t count = 0;
uint8_t *opnd;
int mask;
int testval = 0;
@ -5756,7 +5756,7 @@ static regitem_T *regstack_push(regstate_T state, uint8_t *scan)
{
regitem_T *rp;
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
if ((int64_t)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
return NULL;
}
@ -6722,7 +6722,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
// It could match. Prepare for trying to match what
// follows. The code is below. Parameters are stored in
// a regstar_T on the regstack.
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
if ((int64_t)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
status = RA_FAIL;
} else {
@ -6759,7 +6759,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
case BEHIND:
case NOBEHIND:
// Need a bit of room to store extra positions.
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
if ((int64_t)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
status = RA_FAIL;
} else {
@ -6998,7 +6998,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
regstack_pop(&scan);
regstack.ga_len -= (int)sizeof(regbehind_T);
} else {
long limit;
int64_t limit;
// No match or a match that doesn't end where we want it: Go
// back one character. May go to previous line once.
@ -7479,7 +7479,7 @@ static int bt_regexec_nl(regmatch_T *rmp, uint8_t *line, colnr_T col, bool line_
rex.reg_nobreak = rmp->regprog->re_flags & RE_NOBREAK;
rex.reg_maxcol = 0;
long r = bt_regexec_both(line, col, NULL, NULL);
int64_t r = bt_regexec_both(line, col, NULL, NULL);
assert(r <= INT_MAX);
return (int)r;
}
@ -12826,7 +12826,7 @@ skip_add:
const int newlen = l->len * 3 / 2 + 50;
const size_t newsize = (size_t)newlen * sizeof(nfa_thread_T);
if ((long)(newsize >> 10) >= p_mmp) {
if ((int64_t)(newsize >> 10) >= p_mmp) {
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
depth--;
return NULL;
@ -13117,7 +13117,7 @@ static regsubs_T *addstate_here(nfa_list_T *l, nfa_state_T *state, regsubs_T *su
const int newlen = l->len * 3 / 2 + 50;
const size_t newsize = (size_t)newlen * sizeof(nfa_thread_T);
if ((long)(newsize >> 10) >= p_mmp) {
if ((int64_t)(newsize >> 10) >= p_mmp) {
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
return NULL;
}
@ -14740,7 +14740,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
result = false;
win_T *wp = rex.reg_win == NULL ? curwin : rex.reg_win;
if (op == 1 && col - 1 > t->state->val && col > 100) {
long ts = (long)wp->w_buffer->b_p_ts;
int64_t ts = (int64_t)wp->w_buffer->b_p_ts;
// Guess that a character won't use more columns than 'tabstop',
// with a minimum of 4.

View File

@ -94,9 +94,9 @@ static const char e_search_hit_bottom_without_match_for_str[]
static struct spat spats[2] = {
// Last used search pattern
[0] = { NULL, true, false, 0, { '/', false, false, 0L }, NULL },
[0] = { NULL, true, false, 0, { '/', false, false, 0 }, NULL },
// Last used substitute pattern
[1] = { NULL, true, false, 0, { '/', false, false, 0L }, NULL }
[1] = { NULL, true, false, 0, { '/', false, false, 0 }, NULL }
};
static int last_idx = 0; // index in spats[] for RE_LAST
@ -564,7 +564,7 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
int extra_col;
int start_char_len;
bool match_ok;
long nmatched;
int nmatched;
int submatch = 0;
bool first_match = true;
const int called_emsg_before = called_emsg;
@ -980,7 +980,7 @@ void set_search_direction(int cdir)
static void set_vv_searchforward(void)
{
set_vim_var_nr(VV_SEARCHFORWARD, (long)(spats[0].off.dir == '/'));
set_vim_var_nr(VV_SEARCHFORWARD, spats[0].off.dir == '/');
}
// Return the number of the first subpat that matched.
@ -2367,9 +2367,9 @@ void showmatch(int c)
// brief pause, unless 'm' is present in 'cpo' and a character is
// available.
if (vim_strchr(p_cpo, CPO_SHOWMATCH) != NULL) {
os_delay((uint64_t)p_mat * 100L + 8, true);
os_delay((uint64_t)p_mat * 100 + 8, true);
} else if (!char_avail()) {
os_delay((uint64_t)p_mat * 100L + 9, false);
os_delay((uint64_t)p_mat * 100 + 9, false);
}
curwin->w_cursor = save_cursor; // restore cursor position
*so = save_so;
@ -2586,7 +2586,7 @@ int linewhite(linenr_T lnum)
/// Add the search count "[3/19]" to "msgbuf".
/// See update_search_stat() for other arguments.
static void cmdline_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, bool show_top_bot_msg,
char *msgbuf, bool recompute, int maxcount, long timeout)
char *msgbuf, bool recompute, int maxcount, int timeout)
{
searchstat_T stat;
@ -2658,7 +2658,7 @@ static void cmdline_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, bool sh
// dirc == '/': find the next match
// dirc == '?': find the previous match
static void update_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, searchstat_T *stat,
bool recompute, int maxcount, long timeout)
bool recompute, int maxcount, int timeout)
{
int save_ws = p_ws;
bool wraparound = false;
@ -2767,7 +2767,7 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
pos_T pos = curwin->w_cursor;
char *pattern = NULL;
int maxcount = SEARCH_STAT_DEF_MAX_COUNT;
long timeout = SEARCH_STAT_DEF_TIMEOUT;
int timeout = SEARCH_STAT_DEF_TIMEOUT;
bool recompute = true;
searchstat_T stat;
@ -2788,7 +2788,7 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
dict = argvars[0].vval.v_dict;
di = tv_dict_find(dict, "timeout", -1);
if (di != NULL) {
timeout = (long)tv_get_number_chk(&di->di_tv, &error);
timeout = (int)tv_get_number_chk(&di->di_tv, &error);
if (error) {
return;
}
@ -2824,21 +2824,21 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
semsg(_(e_invarg2), "List format should be [lnum, col, off]");
return;
}
listitem_T *li = tv_list_find(di->di_tv.vval.v_list, 0L);
listitem_T *li = tv_list_find(di->di_tv.vval.v_list, 0);
if (li != NULL) {
pos.lnum = (linenr_T)tv_get_number_chk(TV_LIST_ITEM_TV(li), &error);
if (error) {
return;
}
}
li = tv_list_find(di->di_tv.vval.v_list, 1L);
li = tv_list_find(di->di_tv.vval.v_list, 1);
if (li != NULL) {
pos.col = (colnr_T)tv_get_number_chk(TV_LIST_ITEM_TV(li), &error) - 1;
if (error) {
return;
}
}
li = tv_list_find(di->di_tv.vval.v_list, 2L);
li = tv_list_find(di->di_tv.vval.v_list, 2);
if (li != NULL) {
pos.coladd = (colnr_T)tv_get_number_chk(TV_LIST_ITEM_TV(li), &error);
if (error) {
@ -3207,10 +3207,10 @@ static int fuzzy_match_item_compare(const void *const s1, const void *const s2)
static void fuzzy_match_in_list(list_T *const l, char *const str, const bool matchseq,
const char *const key, Callback *const item_cb,
const bool retmatchpos, list_T *const fmatchlist,
const long max_matches)
const int max_matches)
FUNC_ATTR_NONNULL_ARG(2, 5, 7)
{
long len = tv_list_len(l);
int len = tv_list_len(l);
if (len == 0) {
return;
}
@ -3219,7 +3219,7 @@ static void fuzzy_match_in_list(list_T *const l, char *const str, const bool mat
}
fuzzyItem_T *const items = xcalloc((size_t)len, sizeof(fuzzyItem_T));
long match_count = 0;
int match_count = 0;
uint32_t matches[MAX_FUZZY_MATCHES];
// For all the string items in items, get the fuzzy matching score
@ -3303,7 +3303,7 @@ static void fuzzy_match_in_list(list_T *const l, char *const str, const bool mat
}
// Copy the matching strings with a valid score to the return list
for (long i = 0; i < match_count; i++) {
for (int i = 0; i < match_count; i++) {
if (items[i].score == SCORE_NONE) {
break;
}
@ -3316,7 +3316,7 @@ static void fuzzy_match_in_list(list_T *const l, char *const str, const bool mat
assert(li != NULL && TV_LIST_ITEM_TV(li)->vval.v_list != NULL);
retlist = TV_LIST_ITEM_TV(li)->vval.v_list;
for (long i = 0; i < match_count; i++) {
for (int i = 0; i < match_count; i++) {
if (items[i].score == SCORE_NONE) {
break;
}
@ -3327,7 +3327,7 @@ static void fuzzy_match_in_list(list_T *const l, char *const str, const bool mat
li = tv_list_find(fmatchlist, -1);
assert(li != NULL && TV_LIST_ITEM_TV(li)->vval.v_list != NULL);
retlist = TV_LIST_ITEM_TV(li)->vval.v_list;
for (long i = 0; i < match_count; i++) {
for (int i = 0; i < match_count; i++) {
if (items[i].score == SCORE_NONE) {
break;
}
@ -3357,7 +3357,7 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv,
Callback cb = CALLBACK_NONE;
const char *key = NULL;
bool matchseq = false;
long max_matches = 0;
int max_matches = 0;
if (argvars[2].v_type != VAR_UNKNOWN) {
if (tv_check_for_nonnull_dict_arg(argvars, 2) == FAIL) {
return;
@ -3384,7 +3384,7 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv,
semsg(_(e_invarg2), tv_get_string(&di->di_tv));
return;
}
max_matches = (long)tv_get_number_chk(&di->di_tv, NULL);
max_matches = (int)tv_get_number_chk(&di->di_tv, NULL);
}
if (tv_dict_find(d, "matchseq", -1) != NULL) {
@ -3645,11 +3645,11 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool
(size_t)(incl_regmatch.endp[0]
- incl_regmatch.startp[0]),
FNAME_EXP|FNAME_INCL|FNAME_REL,
1L, p_fname);
1, p_fname);
} else {
// Use text after match with 'include'.
new_fname = file_name_in_line(incl_regmatch.endp[0], 0,
FNAME_EXP|FNAME_INCL|FNAME_REL, 1L, p_fname,
FNAME_EXP|FNAME_INCL|FNAME_REL, 1, p_fname,
NULL);
}
already_searched = false;
@ -3995,7 +3995,7 @@ search_line:
} else if (action == ACTION_SHOW) {
show_pat_in_path(line, type, did_show, action,
(depth == -1) ? NULL : files[depth].fp,
(depth == -1) ? &lnum : &files[depth].lnum, 1L);
(depth == -1) ? &lnum : &files[depth].lnum, 1);
did_show = true;
} else {
// ":psearch" uses the preview window

View File

@ -52,7 +52,7 @@
#define RE_LAST 2 // use last used pattern if "pat" is NULL
// Values for searchcount()
#define SEARCH_STAT_DEF_TIMEOUT 40L
#define SEARCH_STAT_DEF_TIMEOUT 40
#define SEARCH_STAT_DEF_MAX_COUNT 99
#define SEARCH_STAT_BUF_LEN 12

View File

@ -2503,9 +2503,9 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, ShaDaReadDef
// Initialize history merger
for (HistoryType i = 0; i < HIST_COUNT; i++) {
long num_saved = get_shada_parameter(hist_type2char(i));
int num_saved = get_shada_parameter(hist_type2char(i));
if (num_saved == -1) {
num_saved = (long)p_hi;
num_saved = (int)p_hi;
}
if (num_saved > 0) {
dump_history = true;
@ -3338,7 +3338,6 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
#define ID(s) s
#define BINDUP(b) xmemdupz((b).ptr, (b).size)
#define TOINT(s) ((int)(s))
#define TOLONG(s) ((long)(s))
#define TOCHAR(s) ((char)(s))
#define TOU8(s) ((uint8_t)(s))
#define TOSIZE(s) ((size_t)(s))
@ -3964,7 +3963,6 @@ shada_read_next_item_error:
#undef BINDUP
#undef TOCHAR
#undef TOINT
#undef TOLONG
#undef TYPED_KEY
#undef INT_KEY
#undef INTEGER_KEY

View File

@ -1,9 +1,7 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
//
// sign.c: functions for managing with signs
//
#include <inttypes.h>
#include <stdbool.h>
@ -732,8 +730,8 @@ static void sign_list_placed(buf_T *rbuf, char *sign_group)
group[0] = '\0';
}
vim_snprintf(lbuf, MSG_BUF_LEN,
_(" line=%ld id=%d%s name=%s priority=%d"),
(long)sign->se_lnum, sign->se_id, group,
_(" line=%" PRIdLINENR " id=%d%s name=%s priority=%d"),
sign->se_lnum, sign->se_id, group,
sign_typenr2name(sign->se_typenr), sign->se_priority);
msg_puts(lbuf);
msg_putchar('\n');
@ -1622,7 +1620,7 @@ static void sign_get_placed_in_buf(buf_T *buf, linenr_T lnum, int sign_id, const
d = tv_dict_alloc();
tv_list_append_dict(retlist, d);
tv_dict_add_nr(d, S_LEN("bufnr"), (long)buf->b_fnum);
tv_dict_add_nr(d, S_LEN("bufnr"), buf->b_fnum);
l = tv_list_alloc(kListLenMayKnow);
tv_dict_add_list(d, S_LEN("signs"), l);

View File

@ -2683,7 +2683,7 @@ void ex_spellrepall(exarg_T *eap)
sub_nlines = 0;
curwin->w_cursor.lnum = 0;
while (!got_int) {
if (do_search(NULL, '/', '/', frompat, 1L, SEARCH_KEEP, NULL) == 0
if (do_search(NULL, '/', '/', frompat, 1, SEARCH_KEEP, NULL) == 0
|| u_save_cursor() == FAIL) {
break;
}

View File

@ -234,7 +234,7 @@ enum {
PFD_NOTSPECIAL = 0xfd, // highest value that's not special
};
static long spell_suggest_timeout = 5000;
static int spell_suggest_timeout = 5000;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "spellsuggest.c.generated.h"
@ -806,7 +806,7 @@ static void spell_find_suggest(char *badptr, int badlen, suginfo_T *su, int maxc
spell_suggest_file(su, buf + 5);
} else if (strncmp(buf, "timeout:", 8) == 0) {
// Limit the time searching for suggestions.
spell_suggest_timeout = atol(buf + 8);
spell_suggest_timeout = atoi(buf + 8);
} else if (!did_intern) {
// Use internal method once.
spell_suggest_intern(su, interactive);

View File

@ -558,7 +558,7 @@ void win_redr_ruler(win_T *wp)
// To avoid portability problems we use strlen() here.
vim_snprintf(buffer, RULER_BUF_LEN, "%" PRId64 ",",
(wp->w_buffer->b_ml.ml_flags &
ML_EMPTY) ? (int64_t)0L : (int64_t)wp->w_cursor.lnum);
ML_EMPTY) ? 0 : (int64_t)wp->w_cursor.lnum);
size_t len = strlen(buffer);
col_print(buffer + len, RULER_BUF_LEN - len,
empty_line ? 0 : (int)wp->w_cursor.col + 1,
@ -1514,7 +1514,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
num = (int)get_vim_var_nr(VV_LNUM);
}
} else {
num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? 0L : wp->w_cursor.lnum;
num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? 0 : wp->w_cursor.lnum;
}
break;
@ -1594,8 +1594,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
int l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL,
false);
num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0 ?
0L : l + 1 + ((State & MODE_INSERT) == 0 && empty_line ?
0 : (int)wp->w_cursor.col);
0 : l + 1 + ((State & MODE_INSERT) == 0 && empty_line ?
0 : (int)wp->w_cursor.col);
break;
}
case STL_BYTEVAL_X:

View File

@ -122,7 +122,7 @@ typedef struct state_item {
int si_end_idx; // group ID for end pattern or zero
int si_ends; // if match ends before si_m_endpos
int si_attr; // attributes in this state
long si_flags; // HL_HAS_EOL flag in this state, and
int si_flags; // HL_HAS_EOL flag in this state, and
// HL_SKIP* for si_next_list
int si_seqnr; // sequence number
int si_cchar; // substitution character for conceal
@ -265,7 +265,7 @@ static lpos_T next_match_m_endpos; // position for end of next match
static lpos_T next_match_h_startpos; // pos. for highl. start of next match
static lpos_T next_match_h_endpos; // pos. for highl. end of next match
static int next_match_idx; // index of matched item
static long next_match_flags; // flags for next match
static int next_match_flags; // flags for next match
static lpos_T next_match_eos_pos; // end of start pattn (start region)
static lpos_T next_match_eoe_pos; // pos. for end of end pattern
static int next_match_end_idx; // ID of group for end pattn or zero
@ -1209,7 +1209,7 @@ static synstate_T *store_current_state(void)
}
for (i = 0; i < sp->sst_stacksize; i++) {
bp[i].bs_idx = CUR_STATE(i).si_idx;
bp[i].bs_flags = (int)CUR_STATE(i).si_flags;
bp[i].bs_flags = CUR_STATE(i).si_flags;
bp[i].bs_seqnr = CUR_STATE(i).si_seqnr;
bp[i].bs_cchar = CUR_STATE(i).si_cchar;
bp[i].bs_extmatch = ref_extmatch(CUR_STATE(i).si_extmatch);
@ -1511,7 +1511,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
stateitem_T *cur_si, *sip = NULL;
int startcol;
int endcol;
long flags;
int flags;
int cchar;
int16_t *next_list;
bool found_match; // found usable match
@ -1884,7 +1884,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
current_attr = sip->si_attr;
current_id = sip->si_id;
current_trans_id = sip->si_trans_id;
current_flags = (int)sip->si_flags;
current_flags = sip->si_flags;
current_seqnr = sip->si_seqnr;
current_sub_char = sip->si_cchar;
break;
@ -2114,7 +2114,7 @@ static void check_state_ends(void)
// handle next_list, unless at end of line and no "skipnl" or
// "skipempty"
current_next_list = cur_si->si_next_list;
current_next_flags = (int)cur_si->si_flags;
current_next_flags = cur_si->si_flags;
if (!(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))
&& syn_getcurline()[current_col] == NUL) {
current_next_list = NULL;
@ -2362,8 +2362,8 @@ static void pop_current_state(void)
/// @param end_endpos return: end of end pattern match
/// @param end_idx return: group ID for end pat. match, or 0
/// @param start_ext submatches from the start pattern
static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_endpos,
long *flagsp, lpos_T *end_endpos, int *end_idx, reg_extmatch_T *start_ext)
static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_endpos, int *flagsp,
lpos_T *end_endpos, int *end_idx, reg_extmatch_T *start_ext)
{
colnr_T matchcol;
synpat_T *spp, *spp_skip;
@ -2700,7 +2700,7 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
}
rmp->rmm_maxcol = (colnr_T)syn_buf->b_p_smc;
long r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, syn_tm, &timed_out);
int r = vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, syn_tm, &timed_out);
if (l_syn_time_on) {
pt = profile_end(pt);
@ -2737,7 +2737,7 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
/// @param cur_si item at the top of the stack
/// @param ccharp conceal substitution char
static int check_keyword_id(char *const line, const int startcol, int *const endcolp,
long *const flagsp, int16_t **const next_listp,
int *const flagsp, int16_t **const next_listp,
stateitem_T *const cur_si, int *const ccharp)
{
// Find first character after the keyword. First character was already

View File

@ -743,7 +743,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
}
if (ic && !msg_scrolled && msg_silent == 0) {
ui_flush();
os_delay(1007L, true);
os_delay(1007, true);
}
}
@ -3014,7 +3014,7 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, int keep_help)
msg(_("E435: Couldn't find tag, just guessing!"), 0);
if (!msg_scrolled && msg_silent == 0) {
ui_flush();
os_delay(1010L, true);
os_delay(1010, true);
}
}
retval = OK;

View File

@ -571,7 +571,7 @@ static void find_first_blank(pos_T *posp)
static void findsent_forward(int count, bool at_start_sent)
{
while (count--) {
findsent(FORWARD, 1L);
findsent(FORWARD, 1);
if (at_start_sent) {
find_first_blank(&curwin->w_cursor);
}
@ -612,7 +612,7 @@ int current_word(oparg_T *oap, int count, bool include, bool bigword)
// (" word"), or start is not on white space, and white space should
// not be included ("word"), find end of word.
if ((cls() == 0) == include) {
if (end_word(1L, bigword, true, true) == FAIL) {
if (end_word(1, bigword, true, true) == FAIL) {
return FAIL;
}
} else {
@ -621,7 +621,7 @@ int current_word(oparg_T *oap, int count, bool include, bool bigword)
// space should not be included (" "), find start of word.
// If we end up in the first column of the next line (single char
// word) back up to end of the line.
fwd_word(1L, bigword, true);
fwd_word(1, bigword, true);
if (curwin->w_cursor.col == 0) {
decl(&curwin->w_cursor);
} else {
@ -653,11 +653,11 @@ int current_word(oparg_T *oap, int count, bool include, bool bigword)
return FAIL;
}
if (include != (cls() != 0)) {
if (bck_word(1L, bigword, true) == FAIL) {
if (bck_word(1, bigword, true) == FAIL) {
return FAIL;
}
} else {
if (bckend_word(1L, bigword, true) == FAIL) {
if (bckend_word(1, bigword, true) == FAIL) {
return FAIL;
}
(void)incl(&curwin->w_cursor);
@ -668,7 +668,7 @@ int current_word(oparg_T *oap, int count, bool include, bool bigword)
return FAIL;
}
if (include != (cls() == 0)) {
if (fwd_word(1L, bigword, true) == FAIL && count > 1) {
if (fwd_word(1, bigword, true) == FAIL && count > 1) {
return FAIL;
}
// If end is just past a new-line, we don't want to include
@ -678,7 +678,7 @@ int current_word(oparg_T *oap, int count, bool include, bool bigword)
inclusive = false;
}
} else {
if (end_word(1L, bigword, true, true) == FAIL) {
if (end_word(1, bigword, true, true) == FAIL) {
return FAIL;
}
}
@ -737,7 +737,7 @@ int current_sent(oparg_T *oap, int count, bool include)
start_pos = curwin->w_cursor;
pos = start_pos;
findsent(FORWARD, 1L); // Find start of next sentence.
findsent(FORWARD, 1); // Find start of next sentence.
// When the Visual area is bigger than one character: Extend it.
if (VIsual_active && !equalpos(start_pos, VIsual)) {
@ -759,12 +759,12 @@ extend:
incl(&pos);
}
if (!at_start_sent) {
findsent(BACKWARD, 1L);
findsent(BACKWARD, 1);
if (equalpos(curwin->w_cursor, start_pos)) {
at_start_sent = true; // exactly at start of sentence
} else {
// inside a sentence, go to its end (start of next)
findsent(FORWARD, 1L);
findsent(FORWARD, 1);
}
}
if (include) { // "as" gets twice as much as "is"
@ -776,7 +776,7 @@ extend:
}
c = gchar_cursor();
if (!at_start_sent || (!include && !ascii_iswhite(c))) {
findsent(BACKWARD, 1L);
findsent(BACKWARD, 1);
}
at_start_sent = !at_start_sent;
}
@ -799,7 +799,7 @@ extend:
incl(&pos);
}
if (at_start_sent) { // in the sentence
findsent(BACKWARD, 1L);
findsent(BACKWARD, 1);
} else { // in/before white before a sentence
curwin->w_cursor = start_pos;
}
@ -826,7 +826,7 @@ extend:
find_first_blank(&start_pos); // go back to first blank
} else {
start_blank = false;
findsent(BACKWARD, 1L);
findsent(BACKWARD, 1);
start_pos = curwin->w_cursor;
}
if (include) {
@ -1146,7 +1146,7 @@ again:
if (do_searchpair("<[^ \t>/!]\\+\\%(\\_s\\_[^>]\\{-}[^/]>\\|$\\|\\_s\\=>\\)",
"",
"</[^>]*>", BACKWARD, NULL, 0,
NULL, (linenr_T)0, 0L) <= 0) {
NULL, (linenr_T)0, 0) <= 0) {
curwin->w_cursor = old_pos;
goto theend;
}
@ -1172,7 +1172,7 @@ again:
"<%.*s\\>\\%%(\\_s\\_[^>]\\{-}\\_[^/]>\\|\\_s\\?>\\)\\c", len, p);
snprintf(epat, epat_len, "</%.*s>\\c", len, p);
const int r = (int)do_searchpair(spat, "", epat, FORWARD, NULL, 0, NULL, (linenr_T)0, 0L);
const int r = do_searchpair(spat, "", epat, FORWARD, NULL, 0, NULL, (linenr_T)0, 0);
xfree(spat);
xfree(epat);

View File

@ -2009,7 +2009,7 @@ void undo_time(int step, bool sec, bool file, bool absolute)
}
}
}
long closest_start = closest;
int closest_start = closest;
int closest_seq = curbuf->b_u_seq_cur;
int mark;
int nomark = 0; // shut up compiler
@ -2611,7 +2611,7 @@ static void u_undo_end(bool did_undo, bool absolute, bool quiet)
u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount,
_(msgstr),
did_undo ? _("before") : _("after"),
uhp == NULL ? (int64_t)0L : (int64_t)uhp->uh_seq,
uhp == NULL ? 0 : (int64_t)uhp->uh_seq,
msgbuf);
}
@ -2622,7 +2622,7 @@ void undo_fmt_time(char *buf, size_t buflen, time_t tt)
struct tm curtime;
os_localtime_r(&tt, &curtime);
size_t n;
if (time(NULL) - tt < (60L * 60L * 12L)) {
if (time(NULL) - tt < (60 * 60 * 12)) {
// within 12 hours
n = strftime(buf, buflen, "%H:%M:%S", &curtime);
} else {

View File

@ -4079,7 +4079,7 @@ static int win_alloc_firstwin(win_T *oldwin)
if (oldwin == NULL) {
// Very first window, need to create an empty buffer for it and
// initialize from scratch.
curbuf = buflist_new(NULL, NULL, 1L, BLN_LISTED);
curbuf = buflist_new(NULL, NULL, 1, BLN_LISTED);
if (curbuf == NULL) {
return FAIL;
}
@ -6458,7 +6458,7 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
redraw_all_later(UPD_NOT_VALID);
}
#define FRACTION_MULT 16384L
#define FRACTION_MULT 16384
// Set wp->w_fraction for the current w_wrow and w_height.
// Has no effect when the window is less than two lines.
@ -6468,7 +6468,7 @@ void set_fraction(win_T *wp)
// When cursor is in the first line the percentage is computed as if
// it's halfway that line. Thus with two lines it is 25%, with three
// lines 17%, etc. Similarly for the last line: 75%, 83%, etc.
wp->w_fraction = (int)(wp->w_wrow * FRACTION_MULT + FRACTION_MULT / 2) / wp->w_height_inner;
wp->w_fraction = (wp->w_wrow * FRACTION_MULT + FRACTION_MULT / 2) / wp->w_height_inner;
}
}
@ -6619,7 +6619,7 @@ void scroll_to_fraction(win_T *wp, int prev_height)
if (lnum < 1) { // can happen when starting up
lnum = 1;
}
wp->w_wrow = (int)(wp->w_fraction * height - 1L) / FRACTION_MULT;
wp->w_wrow = (wp->w_fraction * height - 1) / FRACTION_MULT;
int line_size = plines_win_col(wp, lnum, wp->w_cursor.col) - 1;
int sline = wp->w_wrow - line_size;

4
src/xdiff/xdiff.h vendored
View File

@ -69,12 +69,12 @@ extern "C" {
typedef struct s_mmfile {
char *ptr;
long size;
int size;
} mmfile_t;
typedef struct s_mmbuffer {
char *ptr;
long size;
int size;
} mmbuffer_t;
typedef struct s_xpparam {