mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
70ec8d60e0
commit
e72b546354
@ -3480,8 +3480,8 @@ void get_rel_pos(win_T *wp, char *buf, int buflen)
|
||||
return;
|
||||
}
|
||||
|
||||
long above; // number of lines above window
|
||||
long below; // number of lines below window
|
||||
linenr_T above; // number of lines above window
|
||||
linenr_T below; // number of lines below window
|
||||
|
||||
above = wp->w_topline - 1;
|
||||
above += win_get_fill(wp, wp->w_topline) - wp->w_topfill;
|
||||
@ -3580,7 +3580,7 @@ void ex_buffer_all(exarg_T *eap)
|
||||
bool p_ea_save;
|
||||
int open_wins = 0;
|
||||
int r;
|
||||
long count; // Maximum number of windows to open.
|
||||
linenr_T count; // Maximum number of windows to open.
|
||||
int all; // When true also load inactive buffers.
|
||||
int had_tab = cmdmod.cmod_tab;
|
||||
tabpage_T *tpnext;
|
||||
|
@ -488,13 +488,13 @@ struct file_buffer {
|
||||
u_header_T *b_u_newhead; // pointer to newest header; may not be valid
|
||||
// if b_u_curhead is not NULL
|
||||
u_header_T *b_u_curhead; // pointer to current header
|
||||
int b_u_numhead; // current number of headers
|
||||
bool b_u_synced; // entry lists are synced
|
||||
long b_u_seq_last; // last used undo sequence number
|
||||
long b_u_save_nr_last; // counter for last file write
|
||||
long b_u_seq_cur; // uh_seq of header below which we are now
|
||||
time_t b_u_time_cur; // uh_time of header below which we are now
|
||||
long b_u_save_nr_cur; // file write nr after which we are now
|
||||
int b_u_numhead; // current number of headers
|
||||
bool b_u_synced; // entry lists are synced
|
||||
int b_u_seq_last; // last used undo sequence number
|
||||
int b_u_save_nr_last; // counter for last file write
|
||||
int b_u_seq_cur; // uh_seq of header below which we are now
|
||||
time_t b_u_time_cur; // uh_time of header below which we are now
|
||||
int b_u_save_nr_cur; // file write nr after which we are now
|
||||
|
||||
// variables for "U" command in undo.c
|
||||
char *b_u_line_ptr; // saved line for "U" command
|
||||
|
@ -1368,7 +1368,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
|
||||
}
|
||||
|
||||
int no_eol = false; // no end-of-line written
|
||||
long nchars;
|
||||
int nchars;
|
||||
linenr_T lnum;
|
||||
int fileformat;
|
||||
int checking_conversion;
|
||||
@ -1789,7 +1789,7 @@ restore_backup:
|
||||
if (msg_add_fileformat(fileformat)) {
|
||||
insert_space = true;
|
||||
}
|
||||
msg_add_lines(insert_space, (long)lnum, nchars); // add line/char count
|
||||
msg_add_lines(insert_space, lnum, nchars); // add line/char count
|
||||
if (!shortmess(SHM_WRITE)) {
|
||||
if (append) {
|
||||
xstrlcat(IObuff, shortmess(SHM_WRI) ? _(" [a]") : _(" appended"), IOSIZE);
|
||||
|
@ -1941,7 +1941,7 @@ void truncate_line(int fixpos)
|
||||
|
||||
/// Delete "nlines" lines at the cursor.
|
||||
/// Saves the lines for undo first if "undo" is true.
|
||||
void del_lines(long nlines, bool undo)
|
||||
void del_lines(linenr_T nlines, bool undo)
|
||||
{
|
||||
int n;
|
||||
linenr_T first = curwin->w_cursor.lnum;
|
||||
|
@ -364,9 +364,9 @@ static void clear_shape_table(void)
|
||||
{
|
||||
for (int idx = 0; idx < SHAPE_IDX_COUNT; idx++) {
|
||||
shape_table[idx].shape = SHAPE_BLOCK;
|
||||
shape_table[idx].blinkwait = 0L;
|
||||
shape_table[idx].blinkon = 0L;
|
||||
shape_table[idx].blinkoff = 0L;
|
||||
shape_table[idx].blinkwait = 0;
|
||||
shape_table[idx].blinkon = 0;
|
||||
shape_table[idx].blinkoff = 0;
|
||||
shape_table[idx].id = 0;
|
||||
shape_table[idx].id_lm = 0;
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ typedef struct cursor_entry {
|
||||
CursorShape shape; ///< cursor shape: one of the SHAPE_ defines
|
||||
int mshape; ///< mouse shape: one of the MSHAPE defines
|
||||
int percentage; ///< percentage of cell for bar
|
||||
long blinkwait; ///< blinking, wait time before blinking starts
|
||||
long blinkon; ///< blinking, on time
|
||||
long blinkoff; ///< blinking, off time
|
||||
int blinkwait; ///< blinking, wait time before blinking starts
|
||||
int blinkon; ///< blinking, on time
|
||||
int blinkoff; ///< blinking, off time
|
||||
int id; ///< highlight group ID
|
||||
int id_lm; ///< highlight group ID for :lmap mode
|
||||
char *name; ///< mode short name
|
||||
|
@ -3135,7 +3135,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr
|
||||
|
||||
if (added != 0) {
|
||||
// Adjust marks. This will change the following entries!
|
||||
mark_adjust(lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkNOOP);
|
||||
mark_adjust(lnum, lnum + count - 1, MAXLNUM, added, kExtmarkNOOP);
|
||||
if (curwin->w_cursor.lnum >= lnum) {
|
||||
// Adjust the cursor position if it's in/after the changed
|
||||
// lines.
|
||||
@ -3146,7 +3146,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr
|
||||
}
|
||||
}
|
||||
}
|
||||
extmark_adjust(curbuf, lnum, lnum + count - 1, (long)MAXLNUM, added, kExtmarkUndo);
|
||||
extmark_adjust(curbuf, lnum, lnum + count - 1, MAXLNUM, added, kExtmarkUndo);
|
||||
changed_lines(curbuf, lnum, 0, lnum + count, added, true);
|
||||
|
||||
if (did_free) {
|
||||
|
@ -73,7 +73,7 @@ typedef struct insert_state {
|
||||
int cmdchar;
|
||||
int cmdchar_todo; // cmdchar to handle once in init_prompt
|
||||
int startln;
|
||||
long count;
|
||||
int count;
|
||||
int c;
|
||||
int lastc;
|
||||
int i;
|
||||
@ -1230,7 +1230,7 @@ static void insert_do_cindent(InsertState *s)
|
||||
/// @param count repeat count for the command
|
||||
///
|
||||
/// @return true if a CTRL-O command caused the return (insert mode pending).
|
||||
bool edit(int cmdchar, bool startln, long count)
|
||||
bool edit(int cmdchar, bool startln, int count)
|
||||
{
|
||||
if (curbuf->terminal) {
|
||||
if (ex_normal_busy) {
|
||||
@ -3394,7 +3394,7 @@ static void ins_ctrl_hat(void)
|
||||
/// @param nomove when true, don't move the cursor
|
||||
///
|
||||
/// @return true when leaving insert mode, false when repeating the insert.
|
||||
static bool ins_esc(long *count, int cmdchar, bool nomove)
|
||||
static bool ins_esc(int *count, int cmdchar, bool nomove)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
static bool disabled_redraw = false;
|
||||
|
@ -8290,7 +8290,7 @@ void option_last_set_msg(LastSet last_set)
|
||||
msg_puts(p);
|
||||
if (last_set.script_ctx.sc_lnum > 0) {
|
||||
msg_puts(_(line_msg));
|
||||
msg_outnum((long)last_set.script_ctx.sc_lnum);
|
||||
msg_outnum(last_set.script_ctx.sc_lnum);
|
||||
}
|
||||
if (should_free) {
|
||||
xfree(p);
|
||||
|
@ -1126,7 +1126,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
msg_puts(", ");
|
||||
}
|
||||
if (argvars[i].v_type == VAR_NUMBER) {
|
||||
msg_outnum((long)argvars[i].vval.v_number);
|
||||
msg_outnum((int)argvars[i].vval.v_number);
|
||||
} else {
|
||||
// Do not want errors such as E724 here.
|
||||
emsg_off++;
|
||||
@ -2263,7 +2263,7 @@ void ex_function(exarg_T *eap)
|
||||
}
|
||||
msg_putchar('\n');
|
||||
if (!eap->forceit) {
|
||||
msg_outnum((long)j + 1);
|
||||
msg_outnum(j + 1);
|
||||
if (j < 9) {
|
||||
msg_putchar(' ');
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ void ex_sort(exarg_T *eap)
|
||||
regmatch_T regmatch;
|
||||
int len;
|
||||
linenr_T lnum;
|
||||
long maxlen = 0;
|
||||
int maxlen = 0;
|
||||
size_t count = (size_t)(eap->line2 - eap->line1) + 1;
|
||||
size_t i;
|
||||
char *p;
|
||||
@ -693,7 +693,7 @@ void ex_sort(exarg_T *eap)
|
||||
// Adjust marks for deleted (or added) lines and prepare for displaying.
|
||||
deleted = (linenr_T)count - (lnum - eap->line2);
|
||||
if (deleted > 0) {
|
||||
mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted, kExtmarkNOOP);
|
||||
mark_adjust(eap->line2 - deleted, eap->line2, MAXLNUM, -deleted, kExtmarkNOOP);
|
||||
msgmore(-deleted);
|
||||
} else if (deleted < 0) {
|
||||
mark_adjust(eap->line2, MAXLNUM, -deleted, 0L, kExtmarkNOOP);
|
||||
@ -922,7 +922,7 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
|
||||
check_pos(curbuf, &VIsual);
|
||||
}
|
||||
|
||||
msgmore((long)count);
|
||||
msgmore(count);
|
||||
}
|
||||
|
||||
static char *prevcmd = NULL; // the previous command
|
||||
@ -1281,7 +1281,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b
|
||||
set_keep_msg(msg_buf, 0);
|
||||
}
|
||||
} else {
|
||||
msgmore((long)linecount);
|
||||
msgmore(linecount);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -3291,7 +3291,7 @@ static int check_regexp_delim(int c)
|
||||
/// @param cmdpreview_ns The namespace to show 'inccommand' preview highlights.
|
||||
/// If <= 0, preview shouldn't be shown.
|
||||
/// @return 0, 1 or 2. See show_cmdpreview() for more information on what the return value means.
|
||||
static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_ns,
|
||||
static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_ns,
|
||||
const handle_T cmdpreview_bufnr)
|
||||
{
|
||||
#define ADJUST_SUB_FIRSTLNUM() \
|
||||
@ -3318,7 +3318,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
long i = 0;
|
||||
int i = 0;
|
||||
regmmatch_T regmatch;
|
||||
static subflags_T subflags = {
|
||||
.do_all = false,
|
||||
@ -3346,7 +3346,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
|
||||
PreviewLines preview_lines = { KV_INITIAL_VALUE, 0 };
|
||||
static int pre_hl_id = 0;
|
||||
pos_T old_cursor = curwin->w_cursor;
|
||||
long start_nsubs;
|
||||
int start_nsubs;
|
||||
|
||||
bool did_save = false;
|
||||
|
||||
@ -3442,7 +3442,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
|
||||
// check for a trailing count
|
||||
cmd = skipwhite(cmd);
|
||||
if (ascii_isdigit(*cmd)) {
|
||||
i = getdigits_long(&cmd, true, 0);
|
||||
i = getdigits_int(&cmd, true, 0);
|
||||
if (i <= 0 && !eap->skip && subflags.do_error) {
|
||||
emsg(_(e_zerocount));
|
||||
return 0;
|
||||
@ -3521,8 +3521,8 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
|
||||
&& (cmdpreview_ns <= 0 || preview_lines.lines_needed <= (linenr_T)p_cwh
|
||||
|| lnum <= curwin->w_botline);
|
||||
lnum++) {
|
||||
long nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum,
|
||||
(colnr_T)0, NULL, NULL);
|
||||
int nmatch = (int)vim_regexec_multi(®match, curwin, curbuf, lnum,
|
||||
(colnr_T)0, NULL, NULL);
|
||||
if (nmatch) {
|
||||
colnr_T copycol;
|
||||
colnr_T matchcol;
|
||||
@ -3532,7 +3532,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
|
||||
char *p1;
|
||||
bool did_sub = false;
|
||||
int lastone;
|
||||
long nmatch_tl = 0; // nr of lines matched below lnum
|
||||
linenr_T nmatch_tl = 0; // nr of lines matched below lnum
|
||||
int do_again; // do it again after joining lines
|
||||
bool skip_match = false;
|
||||
linenr_T sub_firstlnum; // nr of first sub line
|
||||
@ -3805,7 +3805,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const long cmdpreview_
|
||||
// Same highlight as wait_return().
|
||||
smsg(HL_ATTR(HLF_R), _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
|
||||
msg_no_more = false;
|
||||
msg_scroll = (int)i;
|
||||
msg_scroll = i;
|
||||
if (!ui_has(kUIMessages)) {
|
||||
ui_cursor_goto(msg_row, msg_col);
|
||||
}
|
||||
@ -4087,9 +4087,9 @@ skip:
|
||||
// need to replace the line first (using \zs after \n).
|
||||
if (lastone
|
||||
|| nmatch_tl > 0
|
||||
|| (nmatch = vim_regexec_multi(®match, curwin,
|
||||
curbuf, sub_firstlnum,
|
||||
matchcol, NULL, NULL)) == 0
|
||||
|| (nmatch = (int)vim_regexec_multi(®match, curwin,
|
||||
curbuf, sub_firstlnum,
|
||||
matchcol, NULL, NULL)) == 0
|
||||
|| regmatch.startpos[0].lnum > 0) {
|
||||
if (new_start != NULL) {
|
||||
// Copy the rest of the line, that didn't match.
|
||||
@ -4119,13 +4119,12 @@ skip:
|
||||
for (i = 0; i < nmatch_tl; i++) {
|
||||
ml_delete(lnum, false);
|
||||
}
|
||||
mark_adjust(lnum, lnum + (linenr_T)nmatch_tl - 1,
|
||||
(long)MAXLNUM, (linenr_T)(-nmatch_tl), kExtmarkNOOP);
|
||||
mark_adjust(lnum, lnum + nmatch_tl - 1, MAXLNUM, -nmatch_tl, kExtmarkNOOP);
|
||||
if (subflags.do_ask) {
|
||||
deleted_lines(lnum, (linenr_T)nmatch_tl);
|
||||
deleted_lines(lnum, nmatch_tl);
|
||||
}
|
||||
lnum--;
|
||||
line2 -= (linenr_T)nmatch_tl; // nr of lines decreases
|
||||
line2 -= nmatch_tl; // nr of lines decreases
|
||||
nmatch_tl = 0;
|
||||
}
|
||||
|
||||
@ -4150,8 +4149,8 @@ skip:
|
||||
copycol = 0;
|
||||
}
|
||||
if (nmatch == -1 && !lastone) {
|
||||
nmatch = vim_regexec_multi(®match, curwin, curbuf,
|
||||
sub_firstlnum, matchcol, NULL, NULL);
|
||||
nmatch = (int)vim_regexec_multi(®match, curwin, curbuf,
|
||||
sub_firstlnum, matchcol, NULL, NULL);
|
||||
}
|
||||
|
||||
// 5. break if there isn't another match in this line
|
||||
@ -4582,7 +4581,7 @@ bool prepare_tagpreview(bool undo_sync)
|
||||
///
|
||||
/// @return 1 if preview window isn't needed, 2 if preview window is needed.
|
||||
static int show_sub(exarg_T *eap, pos_T old_cusr, PreviewLines *preview_lines, int hl_id,
|
||||
long cmdpreview_ns, handle_T cmdpreview_bufnr)
|
||||
int cmdpreview_ns, handle_T cmdpreview_bufnr)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
char *save_shm_p = xstrdup(p_shm);
|
||||
@ -4684,9 +4683,9 @@ static int show_sub(exarg_T *eap, pos_T old_cusr, PreviewLines *preview_lines, i
|
||||
}
|
||||
linenr_origbuf = match.end.lnum;
|
||||
|
||||
bufhl_add_hl_pos_offset(cmdpreview_buf, (int)cmdpreview_ns, hl_id, p_start, p_end, col_width);
|
||||
bufhl_add_hl_pos_offset(cmdpreview_buf, cmdpreview_ns, hl_id, p_start, p_end, col_width);
|
||||
}
|
||||
bufhl_add_hl_pos_offset(orig_buf, (int)cmdpreview_ns, hl_id, match.start, match.end, 0);
|
||||
bufhl_add_hl_pos_offset(orig_buf, cmdpreview_ns, hl_id, match.start, match.end, 0);
|
||||
}
|
||||
|
||||
xfree(str);
|
||||
@ -4704,7 +4703,7 @@ void ex_substitute(exarg_T *eap)
|
||||
}
|
||||
|
||||
/// :substitute command preview callback.
|
||||
int ex_substitute_preview(exarg_T *eap, long cmdpreview_ns, handle_T cmdpreview_bufnr)
|
||||
int ex_substitute_preview(exarg_T *eap, int cmdpreview_ns, handle_T cmdpreview_bufnr)
|
||||
{
|
||||
// Only preview once the pattern delimiter has been typed
|
||||
if (*eap->arg && !ASCII_ISALNUM(*eap->arg)) {
|
||||
@ -4773,7 +4772,7 @@ char *skip_vimgrep_pat(char *p, char **s, int *flags)
|
||||
void ex_oldfiles(exarg_T *eap)
|
||||
{
|
||||
list_T *l = get_vim_var_list(VV_OLDFILES);
|
||||
long nr = 0;
|
||||
int nr = 0;
|
||||
|
||||
if (l == NULL) {
|
||||
msg(_("No old files"), 0);
|
||||
@ -4807,7 +4806,7 @@ void ex_oldfiles(exarg_T *eap)
|
||||
nr = prompt_for_number(false);
|
||||
msg_starthere();
|
||||
if (nr > 0 && nr <= tv_list_len(l)) {
|
||||
const char *const p = tv_list_find_str(l, (int)nr - 1);
|
||||
const char *const p = tv_list_find_str(l, nr - 1);
|
||||
if (p == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ typedef struct exarg exarg_T;
|
||||
#define BAD_DROP (-2) // erase it
|
||||
|
||||
typedef void (*ex_func_T)(exarg_T *eap);
|
||||
typedef int (*ex_preview_func_T)(exarg_T *eap, long cmdpreview_ns, handle_T cmdpreview_bufnr);
|
||||
typedef int (*ex_preview_func_T)(exarg_T *eap, int cmdpreview_ns, handle_T cmdpreview_bufnr);
|
||||
|
||||
// NOTE: These possible could be removed and changed so that
|
||||
// Callback could take a "command" style string, and simply
|
||||
|
@ -1630,7 +1630,7 @@ static int execute_cmd0(int *retv, exarg_T *eap, const char **errormsg, bool pre
|
||||
// Call the function to execute the builtin command or the preview callback.
|
||||
eap->errmsg = NULL;
|
||||
if (preview) {
|
||||
*retv = (cmdnames[eap->cmdidx].cmd_preview_func)(eap, cmdpreview_get_ns(),
|
||||
*retv = (cmdnames[eap->cmdidx].cmd_preview_func)(eap, (int)cmdpreview_get_ns(),
|
||||
cmdpreview_get_bufnr());
|
||||
} else {
|
||||
(cmdnames[eap->cmdidx].cmd_func)(eap);
|
||||
@ -5911,7 +5911,7 @@ static void ex_submagic(exarg_T *eap)
|
||||
}
|
||||
|
||||
/// ":smagic" and ":snomagic" preview callback.
|
||||
static int ex_submagic_preview(exarg_T *eap, long cmdpreview_ns, handle_T cmdpreview_bufnr)
|
||||
static int ex_submagic_preview(exarg_T *eap, int cmdpreview_ns, handle_T cmdpreview_bufnr)
|
||||
{
|
||||
const optmagic_T saved = magic_overruled;
|
||||
|
||||
@ -6044,7 +6044,7 @@ static void ex_redo(exarg_T *eap)
|
||||
/// ":earlier" and ":later".
|
||||
static void ex_later(exarg_T *eap)
|
||||
{
|
||||
long count = 0;
|
||||
int count = 0;
|
||||
bool sec = false;
|
||||
bool file = false;
|
||||
char *p = eap->arg;
|
||||
@ -6052,7 +6052,7 @@ static void ex_later(exarg_T *eap)
|
||||
if (*p == NUL) {
|
||||
count = 1;
|
||||
} else if (isdigit((uint8_t)(*p))) {
|
||||
count = getdigits_long(&p, false, 0);
|
||||
count = getdigits_int(&p, false, 0);
|
||||
switch (*p) {
|
||||
case 's':
|
||||
p++; sec = true; break;
|
||||
|
@ -142,11 +142,11 @@ typedef struct cmdpreview_undo_info {
|
||||
u_header_T *save_b_u_curhead;
|
||||
int save_b_u_numhead;
|
||||
bool save_b_u_synced;
|
||||
long save_b_u_seq_last;
|
||||
long save_b_u_save_nr_last;
|
||||
long save_b_u_seq_cur;
|
||||
int save_b_u_seq_last;
|
||||
int save_b_u_save_nr_last;
|
||||
int save_b_u_seq_cur;
|
||||
time_t save_b_u_time_cur;
|
||||
long save_b_u_save_nr_cur;
|
||||
int save_b_u_save_nr_cur;
|
||||
char *save_b_u_line_ptr;
|
||||
linenr_T save_b_u_line_lnum;
|
||||
colnr_T save_b_u_line_colnr;
|
||||
@ -207,7 +207,7 @@ static int cedit_key = -1; ///< key value of 'cedit' option
|
||||
#endif
|
||||
|
||||
static handle_T cmdpreview_bufnr = 0;
|
||||
static long cmdpreview_ns = 0;
|
||||
static int cmdpreview_ns = 0;
|
||||
|
||||
static void save_viewstate(win_T *wp, viewstate_T *vs)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
|
@ -1753,7 +1753,7 @@ failed:
|
||||
c = true;
|
||||
}
|
||||
|
||||
msg_add_lines(c, (long)linecnt, filesize);
|
||||
msg_add_lines(c, linecnt, filesize);
|
||||
|
||||
XFREE_CLEAR(keep_msg);
|
||||
p = NULL;
|
||||
@ -2156,7 +2156,7 @@ bool msg_add_fileformat(int eol_type)
|
||||
}
|
||||
|
||||
/// Append line and character count to IObuff.
|
||||
void msg_add_lines(int insert_space, long lnum, off_T nchars)
|
||||
void msg_add_lines(int insert_space, linenr_T lnum, off_T nchars)
|
||||
{
|
||||
char *p = IObuff + strlen(IObuff);
|
||||
|
||||
@ -2700,7 +2700,7 @@ int vim_rename(const char *from, const char *to)
|
||||
}
|
||||
|
||||
// Rename() failed, try copying the file.
|
||||
long perm = os_getperm(from);
|
||||
int perm = os_getperm(from);
|
||||
// For systems that support ACL: get the ACL from the original file.
|
||||
vim_acl_T acl = os_get_acl(from);
|
||||
int fd_in = os_open(from, O_RDONLY, 0);
|
||||
@ -2710,7 +2710,7 @@ int vim_rename(const char *from, const char *to)
|
||||
}
|
||||
|
||||
// Create the new file with same permissions as the original.
|
||||
int fd_out = os_open(to, O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, (int)perm);
|
||||
int fd_out = os_open(to, O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, perm);
|
||||
if (fd_out < 0) {
|
||||
close(fd_in);
|
||||
os_free_acl(acl);
|
||||
@ -2905,7 +2905,7 @@ int buf_check_timestamp(buf_T *buf)
|
||||
&& (!(file_info_ok = os_fileinfo(buf->b_ffname, &file_info))
|
||||
|| time_differs(&file_info, buf->b_mtime, buf->b_mtime_ns)
|
||||
|| (int)file_info.stat.st_mode != buf->b_orig_mode)) {
|
||||
const long prev_b_mtime = buf->b_mtime;
|
||||
const int prev_b_mtime = (int)buf->b_mtime;
|
||||
|
||||
retval = 1;
|
||||
|
||||
|
@ -102,7 +102,7 @@ for _, cmd in ipairs(defs) do
|
||||
end
|
||||
local preview_func
|
||||
if cmd.preview_func then
|
||||
preview_func = string.format("(ex_preview_func_T)&%s", cmd.preview_func)
|
||||
preview_func = string.format("&%s", cmd.preview_func)
|
||||
else
|
||||
preview_func = "NULL"
|
||||
end
|
||||
|
@ -291,10 +291,10 @@ static void delete_buff_tail(buffheader_T *buf, int slen)
|
||||
}
|
||||
|
||||
/// Add number "n" to buffer "buf".
|
||||
static void add_num_buff(buffheader_T *buf, long n)
|
||||
static void add_num_buff(buffheader_T *buf, int n)
|
||||
{
|
||||
char number[32];
|
||||
snprintf(number, sizeof(number), "%ld", n);
|
||||
snprintf(number, sizeof(number), "%d", n);
|
||||
add_buff(buf, number, -1L);
|
||||
}
|
||||
|
||||
@ -589,7 +589,7 @@ void AppendCharToRedobuff(int c)
|
||||
}
|
||||
|
||||
// Append a number to the redo buffer.
|
||||
void AppendNumberToRedobuff(long n)
|
||||
void AppendNumberToRedobuff(int n)
|
||||
{
|
||||
if (!block_redo) {
|
||||
add_num_buff(&redobuff, n);
|
||||
@ -643,7 +643,7 @@ void stuffcharReadbuff(int c)
|
||||
}
|
||||
|
||||
// Append a number to the stuff buffer.
|
||||
void stuffnumReadbuff(long n)
|
||||
void stuffnumReadbuff(int n)
|
||||
{
|
||||
add_num_buff(&readbuf1, n);
|
||||
}
|
||||
@ -753,7 +753,7 @@ static void copy_redo(bool old_redo)
|
||||
/// CTRL-O <.> in insert mode
|
||||
///
|
||||
/// @return FAIL for failure, OK otherwise
|
||||
int start_redo(long count, bool old_redo)
|
||||
int start_redo(int count, bool old_redo)
|
||||
{
|
||||
// init the pointers; return if nothing to redo
|
||||
if (read_redo(true, old_redo) == FAIL) {
|
||||
|
@ -832,7 +832,7 @@ EXTERN char no_lines_msg[] INIT(= N_("--No lines in buffer--"));
|
||||
// When ":global" is used to number of substitutions and changed lines is
|
||||
// accumulated until it's finished.
|
||||
// Also used for ":spellrepall".
|
||||
EXTERN long sub_nsubs; // total number of substitutions
|
||||
EXTERN int sub_nsubs; // total number of substitutions
|
||||
EXTERN linenr_T sub_nlines; // total number of lines changed
|
||||
|
||||
// table to store parsed 'wildmode'
|
||||
|
@ -55,7 +55,7 @@
|
||||
/// @return false for an error.
|
||||
bool tabstop_set(char *var, colnr_T **array)
|
||||
{
|
||||
long valcount = 1;
|
||||
int valcount = 1;
|
||||
int t;
|
||||
char *cp;
|
||||
|
||||
@ -89,7 +89,7 @@ bool tabstop_set(char *var, colnr_T **array)
|
||||
return false;
|
||||
}
|
||||
|
||||
*array = (colnr_T *)xmalloc((unsigned)(valcount + 1) * sizeof(long));
|
||||
*array = (colnr_T *)xmalloc((unsigned)(valcount + 1) * sizeof(int));
|
||||
(*array)[0] = (colnr_T)valcount;
|
||||
|
||||
t = 1;
|
||||
@ -122,13 +122,13 @@ int tabstop_padding(colnr_T col, OptInt ts_arg, const colnr_T *vts)
|
||||
OptInt ts = ts_arg == 0 ? 8 : ts_arg;
|
||||
colnr_T tabcol = 0;
|
||||
int t;
|
||||
long padding = 0;
|
||||
int padding = 0;
|
||||
|
||||
if (vts == NULL || vts[0] == 0) {
|
||||
return (int)(ts - (col % ts));
|
||||
}
|
||||
|
||||
const long tabcount = vts[0];
|
||||
const int tabcount = vts[0];
|
||||
|
||||
for (t = 1; t <= tabcount; t++) {
|
||||
tabcol += vts[t];
|
||||
@ -141,7 +141,7 @@ int tabstop_padding(colnr_T col, OptInt ts_arg, const colnr_T *vts)
|
||||
padding = vts[tabcount] - ((col - tabcol) % vts[tabcount]);
|
||||
}
|
||||
|
||||
return (int)padding;
|
||||
return padding;
|
||||
}
|
||||
|
||||
/// Find the size of the tab that covers a particular column.
|
||||
@ -149,13 +149,13 @@ int tabstop_at(colnr_T col, OptInt ts, const colnr_T *vts)
|
||||
{
|
||||
colnr_T tabcol = 0;
|
||||
int t;
|
||||
long tab_size = 0;
|
||||
int tab_size = 0;
|
||||
|
||||
if (vts == NULL || vts[0] == 0) {
|
||||
return (int)ts;
|
||||
}
|
||||
|
||||
const long tabcount = vts[0];
|
||||
const int tabcount = vts[0];
|
||||
for (t = 1; t <= tabcount; t++) {
|
||||
tabcol += vts[t];
|
||||
if (tabcol > col) {
|
||||
@ -167,20 +167,20 @@ int tabstop_at(colnr_T col, OptInt ts, const colnr_T *vts)
|
||||
tab_size = vts[tabcount];
|
||||
}
|
||||
|
||||
return (int)tab_size;
|
||||
return tab_size;
|
||||
}
|
||||
|
||||
/// Find the column on which a tab starts.
|
||||
colnr_T tabstop_start(colnr_T col, long ts, colnr_T *vts)
|
||||
colnr_T tabstop_start(colnr_T col, int ts, colnr_T *vts)
|
||||
{
|
||||
colnr_T tabcol = 0;
|
||||
int t;
|
||||
|
||||
if (vts == NULL || vts[0] == 0) {
|
||||
return (int)((col / ts) * ts);
|
||||
return ((col / ts) * ts);
|
||||
}
|
||||
|
||||
const long tabcount = vts[0];
|
||||
const int tabcount = vts[0];
|
||||
for (t = 1; t <= tabcount; t++) {
|
||||
tabcol += vts[t];
|
||||
if (tabcol > col) {
|
||||
@ -194,26 +194,26 @@ colnr_T tabstop_start(colnr_T col, long ts, colnr_T *vts)
|
||||
|
||||
/// Find the number of tabs and spaces necessary to get from one column
|
||||
/// to another.
|
||||
void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const colnr_T *vts, int *ntabs,
|
||||
void tabstop_fromto(colnr_T start_col, colnr_T end_col, int ts_arg, const colnr_T *vts, int *ntabs,
|
||||
int *nspcs)
|
||||
{
|
||||
int spaces = end_col - start_col;
|
||||
colnr_T tabcol = 0;
|
||||
long padding = 0;
|
||||
int padding = 0;
|
||||
int t;
|
||||
long ts = ts_arg == 0 ? (long)curbuf->b_p_ts : ts_arg;
|
||||
int ts = ts_arg == 0 ? (int)curbuf->b_p_ts : ts_arg;
|
||||
assert(ts != 0); // suppress clang "Division by zero"
|
||||
|
||||
if (vts == NULL || vts[0] == 0) {
|
||||
int tabs = 0;
|
||||
|
||||
const int initspc = (int)(ts - (start_col % ts));
|
||||
const int initspc = (ts - (start_col % ts));
|
||||
if (spaces >= initspc) {
|
||||
spaces -= initspc;
|
||||
tabs++;
|
||||
}
|
||||
tabs += (int)(spaces / ts);
|
||||
spaces -= (int)((spaces / ts) * ts);
|
||||
tabs += (spaces / ts);
|
||||
spaces -= ((spaces / ts) * ts);
|
||||
|
||||
*ntabs = tabs;
|
||||
*nspcs = spaces;
|
||||
@ -221,7 +221,7 @@ void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const colnr
|
||||
}
|
||||
|
||||
// Find the padding needed to reach the next tabstop.
|
||||
const long tabcount = vts[0];
|
||||
const int tabcount = vts[0];
|
||||
for (t = 1; t <= tabcount; t++) {
|
||||
tabcol += vts[t];
|
||||
if (tabcol > start_col) {
|
||||
@ -241,7 +241,7 @@ void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const colnr
|
||||
}
|
||||
|
||||
*ntabs = 1;
|
||||
spaces -= (int)padding;
|
||||
spaces -= padding;
|
||||
|
||||
// At least one tab has been used. See if any more will fit.
|
||||
while (spaces != 0 && ++t <= tabcount) {
|
||||
@ -251,7 +251,7 @@ void tabstop_fromto(colnr_T start_col, colnr_T end_col, long ts_arg, const colnr
|
||||
return;
|
||||
}
|
||||
*ntabs += 1;
|
||||
spaces -= (int)padding;
|
||||
spaces -= padding;
|
||||
}
|
||||
|
||||
*ntabs += spaces / (int)vts[tabcount];
|
||||
@ -283,21 +283,21 @@ bool tabstop_eq(const colnr_T *ts1, const colnr_T *ts2)
|
||||
}
|
||||
|
||||
/// Copy a tabstop array, allocating space for the new array.
|
||||
int *tabstop_copy(const long *oldts)
|
||||
int *tabstop_copy(const int *oldts)
|
||||
{
|
||||
long *newts;
|
||||
int *newts;
|
||||
int t;
|
||||
|
||||
if (oldts == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
newts = xmalloc((unsigned)(oldts[0] + 1) * sizeof(long));
|
||||
newts = xmalloc((unsigned)(oldts[0] + 1) * sizeof(int));
|
||||
for (t = 0; t <= oldts[0]; t++) {
|
||||
newts[t] = oldts[t];
|
||||
}
|
||||
|
||||
return (int *)newts;
|
||||
return newts;
|
||||
}
|
||||
|
||||
/// Return a count of the number of tabstops.
|
||||
@ -316,25 +316,23 @@ int tabstop_first(colnr_T *ts)
|
||||
/// 'tabstop' value when 'shiftwidth' is zero.
|
||||
int get_sw_value(buf_T *buf)
|
||||
{
|
||||
long result = get_sw_value_col(buf, 0);
|
||||
assert(result >= 0 && result <= INT_MAX);
|
||||
return (int)result;
|
||||
int result = get_sw_value_col(buf, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Idem, using "pos".
|
||||
long get_sw_value_pos(buf_T *buf, pos_T *pos)
|
||||
int get_sw_value_pos(buf_T *buf, pos_T *pos)
|
||||
{
|
||||
pos_T save_cursor = curwin->w_cursor;
|
||||
long sw_value;
|
||||
|
||||
curwin->w_cursor = *pos;
|
||||
sw_value = get_sw_value_col(buf, get_nolist_virtcol());
|
||||
int sw_value = get_sw_value_col(buf, get_nolist_virtcol());
|
||||
curwin->w_cursor = save_cursor;
|
||||
return sw_value;
|
||||
}
|
||||
|
||||
/// Idem, using the first non-black in the current line.
|
||||
long get_sw_value_indent(buf_T *buf)
|
||||
int get_sw_value_indent(buf_T *buf)
|
||||
{
|
||||
pos_T pos = curwin->w_cursor;
|
||||
|
||||
@ -343,9 +341,9 @@ long get_sw_value_indent(buf_T *buf)
|
||||
}
|
||||
|
||||
/// Idem, using virtual column "col".
|
||||
long get_sw_value_col(buf_T *buf, colnr_T col)
|
||||
int get_sw_value_col(buf_T *buf, colnr_T col)
|
||||
{
|
||||
return buf->b_p_sw ? (long)buf->b_p_sw
|
||||
return buf->b_p_sw ? (int)buf->b_p_sw
|
||||
: tabstop_at(col, buf->b_p_ts, buf->b_p_vts_array);
|
||||
}
|
||||
|
||||
@ -940,12 +938,12 @@ void ex_retab(exarg_T *eap)
|
||||
{
|
||||
linenr_T lnum;
|
||||
bool got_tab = false;
|
||||
long num_spaces = 0;
|
||||
long num_tabs;
|
||||
long len;
|
||||
long start_col = 0; // For start of white-space string
|
||||
long start_vcol = 0; // For start of white-space string
|
||||
long old_len;
|
||||
int num_spaces = 0;
|
||||
int num_tabs;
|
||||
int len;
|
||||
int start_col = 0; // For start of white-space string
|
||||
int64_t start_vcol = 0; // For start of white-space string
|
||||
int old_len;
|
||||
char *new_line = (char *)1; // init to non-NULL
|
||||
colnr_T *new_vts_array = NULL;
|
||||
char *new_ts_str; // string value of tab argument
|
||||
@ -976,8 +974,8 @@ void ex_retab(exarg_T *eap)
|
||||
}
|
||||
for (lnum = eap->line1; !got_int && lnum <= eap->line2; lnum++) {
|
||||
char *ptr = ml_get(lnum);
|
||||
long col = 0;
|
||||
long vcol = 0;
|
||||
int col = 0;
|
||||
int64_t vcol = 0;
|
||||
bool did_undo = false; // called u_save for current line
|
||||
while (true) {
|
||||
if (ascii_iswhite(ptr[col])) {
|
||||
@ -996,13 +994,13 @@ void ex_retab(exarg_T *eap)
|
||||
// Retabulate this string of white-space
|
||||
|
||||
// len is virtual length of white string
|
||||
len = num_spaces = vcol - start_vcol;
|
||||
len = num_spaces = (int)(vcol - start_vcol);
|
||||
num_tabs = 0;
|
||||
if (!curbuf->b_p_et) {
|
||||
int t, s;
|
||||
|
||||
tabstop_fromto((colnr_T)start_vcol, (colnr_T)vcol,
|
||||
(long)curbuf->b_p_ts, new_vts_array, &t, &s);
|
||||
(int)curbuf->b_p_ts, new_vts_array, &t, &s);
|
||||
num_tabs = t;
|
||||
num_spaces = s;
|
||||
}
|
||||
@ -1019,7 +1017,7 @@ void ex_retab(exarg_T *eap)
|
||||
|
||||
// len is actual number of white characters used
|
||||
len = num_spaces + num_tabs;
|
||||
old_len = (long)strlen(ptr);
|
||||
old_len = (int)strlen(ptr);
|
||||
const long new_len = old_len - col + start_col + len + 1;
|
||||
if (new_len <= 0 || new_len >= MAXCOL) {
|
||||
emsg_text_too_long();
|
||||
@ -1031,7 +1029,7 @@ void ex_retab(exarg_T *eap)
|
||||
memmove(new_line, ptr, (size_t)start_col);
|
||||
}
|
||||
memmove(new_line + start_col + len,
|
||||
ptr + col, (size_t)(old_len - col + 1));
|
||||
ptr + col, (size_t)old_len - (size_t)col + 1);
|
||||
ptr = new_line + start_col;
|
||||
for (col = 0; col < len; col++) {
|
||||
ptr[col] = (col < num_tabs) ? '\t' : ' ';
|
||||
|
@ -78,8 +78,8 @@ typedef struct {
|
||||
} convertStruct;
|
||||
|
||||
struct interval {
|
||||
long first;
|
||||
long last;
|
||||
int first;
|
||||
int last;
|
||||
};
|
||||
|
||||
// uncrustify:off
|
||||
|
@ -1215,7 +1215,7 @@ void ml_recover(bool checkext)
|
||||
// Warn there could be an active Vim on the same file, the user may
|
||||
// want to kill it.
|
||||
msg_puts(_("\nNote: process STILL RUNNING: "));
|
||||
msg_outnum(char_to_long(b0p->b0_pid));
|
||||
msg_outnum((int)char_to_long(b0p->b0_pid));
|
||||
}
|
||||
msg_puts("\n\n");
|
||||
cmdline_row = msg_row;
|
||||
@ -1403,7 +1403,7 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
|
||||
if (num_files) {
|
||||
for (int i = 0; i < num_files; i++) {
|
||||
// print the swap file name
|
||||
msg_outnum((long)++file_count);
|
||||
msg_outnum(++file_count);
|
||||
msg_puts(". ");
|
||||
msg_puts(path_tail(files[i]));
|
||||
msg_putchar('\n');
|
||||
@ -1566,7 +1566,7 @@ static time_t swapfile_info(char *fname)
|
||||
|
||||
if (char_to_long(b0.b0_pid) != 0L) {
|
||||
msg_puts(_("\n process ID: "));
|
||||
msg_outnum(char_to_long(b0.b0_pid));
|
||||
msg_outnum((int)char_to_long(b0.b0_pid));
|
||||
if (swapfile_process_running(&b0, fname)) {
|
||||
msg_puts(_(" (STILL RUNNING)"));
|
||||
process_still_running = true;
|
||||
|
@ -366,7 +366,7 @@ static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const
|
||||
menu->en_name = NULL;
|
||||
menu->en_dname = NULL;
|
||||
}
|
||||
menu->priority = pri_tab[pri_idx];
|
||||
menu->priority = (int)pri_tab[pri_idx];
|
||||
menu->parent = parent;
|
||||
|
||||
// Add after menu that has lower priority.
|
||||
@ -659,7 +659,7 @@ static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes)
|
||||
|
||||
dict_T *dict = tv_dict_alloc();
|
||||
tv_dict_add_str(dict, S_LEN("name"), menu->dname);
|
||||
tv_dict_add_nr(dict, S_LEN("priority"), (int)menu->priority);
|
||||
tv_dict_add_nr(dict, S_LEN("priority"), menu->priority);
|
||||
tv_dict_add_nr(dict, S_LEN("hidden"), menu_is_hidden(menu->dname));
|
||||
|
||||
if (menu->mnemonic) {
|
||||
@ -1847,7 +1847,7 @@ static void menuitem_getinfo(const char *menu_name, const vimmenu_T *menu, int m
|
||||
if (menu->actext != NULL) {
|
||||
tv_dict_add_str(dict, S_LEN("accel"), menu->actext);
|
||||
}
|
||||
tv_dict_add_nr(dict, S_LEN("priority"), (int)menu->priority);
|
||||
tv_dict_add_nr(dict, S_LEN("priority"), menu->priority);
|
||||
tv_dict_add_str(dict, S_LEN("modes"), get_menu_mode_str(menu->modes));
|
||||
|
||||
char buf[NUMBUFLEN];
|
||||
|
@ -52,7 +52,7 @@ struct VimMenu {
|
||||
char *en_dname; ///< NULL when "dname" untranslated
|
||||
int mnemonic; ///< mnemonic key (after '&')
|
||||
char *actext; ///< accelerator text (after TAB)
|
||||
long priority; ///< Menu order priority
|
||||
int priority; ///< Menu order priority
|
||||
char *strings[MENU_MODES]; ///< Mapped string for each mode
|
||||
int noremap[MENU_MODES]; ///< A \ref REMAP_VALUES flag for each mode
|
||||
bool silent[MENU_MODES]; ///< A silent flag for each mode
|
||||
|
@ -1346,7 +1346,7 @@ bool messaging(void)
|
||||
return !(p_lz && char_avail() && !KeyTyped) && (p_ch > 0 || ui_has(kUIMessages));
|
||||
}
|
||||
|
||||
void msgmore(long n)
|
||||
void msgmore(int n)
|
||||
{
|
||||
long pn;
|
||||
|
||||
@ -1480,11 +1480,11 @@ void msg_putchar_attr(int c, int attr)
|
||||
msg_puts_attr(buf, attr);
|
||||
}
|
||||
|
||||
void msg_outnum(long n)
|
||||
void msg_outnum(int n)
|
||||
{
|
||||
char buf[20];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%ld", n);
|
||||
snprintf(buf, sizeof(buf), "%d", n);
|
||||
msg_puts(buf);
|
||||
}
|
||||
|
||||
|
@ -1735,13 +1735,13 @@ static void prep_redo_cmd(cmdarg_T *cap)
|
||||
|
||||
/// Prepare for redo of any command.
|
||||
/// Note that only the last argument can be a multi-byte char.
|
||||
void prep_redo(int regname, long num, int cmd1, int cmd2, int cmd3, int cmd4, int cmd5)
|
||||
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);
|
||||
}
|
||||
|
||||
/// Prepare for redo of any command with extra count after "cmd2".
|
||||
void prep_redo_num2(int regname, long num1, int cmd1, int cmd2, long num2, int cmd3, int cmd4,
|
||||
void prep_redo_num2(int regname, int num1, int cmd1, int cmd2, int num2, int cmd3, int cmd4,
|
||||
int cmd5)
|
||||
{
|
||||
ResetRedobuff();
|
||||
|
@ -39,7 +39,7 @@ typedef struct oparg_S {
|
||||
pos_T end; // end of the operator
|
||||
pos_T cursor_start; // cursor position before motion for "gw"
|
||||
|
||||
long line_count; // number of lines from op_start to op_end
|
||||
linenr_T line_count; // number of lines from op_start to op_end
|
||||
// (inclusive)
|
||||
bool empty; // op_start and op_end the same (only used by
|
||||
// op_change())
|
||||
|
@ -217,7 +217,7 @@ int get_extra_op_char(int optype)
|
||||
/// handle a shift operation
|
||||
void op_shift(oparg_T *oap, int curs_top, int amount)
|
||||
{
|
||||
long i;
|
||||
int i;
|
||||
int block_col = 0;
|
||||
|
||||
if (u_save((linenr_T)(oap->start.lnum - 1),
|
||||
@ -292,7 +292,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
|
||||
/// @param call_changed_bytes call changed_bytes()
|
||||
void shift_line(int left, int round, int amount, int call_changed_bytes)
|
||||
{
|
||||
const int sw_val = (int)get_sw_value_indent(curbuf);
|
||||
const int sw_val = get_sw_value_indent(curbuf);
|
||||
|
||||
int count = get_indent(); // get current indent
|
||||
|
||||
@ -338,7 +338,7 @@ static void shift_block(oparg_T *oap, int amount)
|
||||
const int oldstate = State;
|
||||
char *newp;
|
||||
const int oldcol = curwin->w_cursor.col;
|
||||
const int sw_val = (int)get_sw_value_indent(curbuf);
|
||||
const int sw_val = get_sw_value_indent(curbuf);
|
||||
const int ts_val = (int)curbuf->b_p_ts;
|
||||
struct block_def bd;
|
||||
int incr;
|
||||
@ -634,7 +634,7 @@ static void block_insert(oparg_T *oap, char *s, int b_insert, struct block_def *
|
||||
/// Handle reindenting a block of lines.
|
||||
void op_reindent(oparg_T *oap, Indenter how)
|
||||
{
|
||||
long i = 0;
|
||||
int i = 0;
|
||||
linenr_T first_changed = 0;
|
||||
linenr_T last_changed = 0;
|
||||
linenr_T start_lnum = curwin->w_cursor.lnum;
|
||||
@ -647,8 +647,8 @@ void op_reindent(oparg_T *oap, Indenter how)
|
||||
|
||||
// Save for undo. Do this once for all lines, much faster than doing this
|
||||
// for each line separately, especially when undoing.
|
||||
if (u_savecommon(curbuf, start_lnum - 1, start_lnum + (linenr_T)oap->line_count,
|
||||
start_lnum + (linenr_T)oap->line_count, false) == OK) {
|
||||
if (u_savecommon(curbuf, start_lnum - 1, start_lnum + oap->line_count,
|
||||
start_lnum + oap->line_count, false) == OK) {
|
||||
char *l;
|
||||
int amount;
|
||||
for (i = oap->line_count - 1; i >= 0 && !got_int; i--) {
|
||||
@ -693,7 +693,7 @@ void op_reindent(oparg_T *oap, Indenter how)
|
||||
// there is no change still need to remove the Visual highlighting.
|
||||
if (last_changed != 0) {
|
||||
changed_lines(curbuf, first_changed, 0,
|
||||
oap->is_VIsual ? start_lnum + (linenr_T)oap->line_count :
|
||||
oap->is_VIsual ? start_lnum + oap->line_count :
|
||||
last_changed + 1, 0L, true);
|
||||
} else if (oap->is_VIsual) {
|
||||
redraw_curbuf_later(UPD_INVERTED);
|
||||
@ -1717,8 +1717,8 @@ int op_delete(oparg_T *oap)
|
||||
pos_T curpos;
|
||||
|
||||
// save deleted and changed lines for undo
|
||||
if (u_save((linenr_T)(curwin->w_cursor.lnum - 1),
|
||||
(linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL) {
|
||||
if (u_save(curwin->w_cursor.lnum - 1,
|
||||
curwin->w_cursor.lnum + oap->line_count) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -2204,7 +2204,7 @@ bool swapchar(int op_type, pos_T *pos)
|
||||
/// Insert and append operators for Visual mode.
|
||||
void op_insert(oparg_T *oap, long count1)
|
||||
{
|
||||
long pre_textlen = 0;
|
||||
int pre_textlen = 0;
|
||||
char *firstline;
|
||||
colnr_T ind_pre_col = 0;
|
||||
int ind_pre_vcol = 0;
|
||||
@ -2251,7 +2251,7 @@ void op_insert(oparg_T *oap, long count1)
|
||||
if (oap->op_type == OP_APPEND) {
|
||||
firstline += bd.textlen;
|
||||
}
|
||||
pre_textlen = (long)strlen(firstline);
|
||||
pre_textlen = (int)strlen(firstline);
|
||||
}
|
||||
|
||||
if (oap->op_type == OP_APPEND) {
|
||||
@ -2400,7 +2400,7 @@ void op_insert(oparg_T *oap, long count1)
|
||||
} else {
|
||||
firstline += add;
|
||||
}
|
||||
long ins_len = (long)strlen(firstline) - pre_textlen - offset;
|
||||
int ins_len = (int)strlen(firstline) - pre_textlen - offset;
|
||||
if (pre_textlen >= 0 && ins_len > 0) {
|
||||
char *ins_text = xstrnsave(firstline, (size_t)ins_len);
|
||||
// block handled here
|
||||
@ -2421,8 +2421,8 @@ void op_insert(oparg_T *oap, long count1)
|
||||
int op_change(oparg_T *oap)
|
||||
{
|
||||
int retval;
|
||||
long pre_textlen = 0;
|
||||
long pre_indent = 0;
|
||||
int pre_textlen = 0;
|
||||
int pre_indent = 0;
|
||||
char *firstline;
|
||||
struct block_def bd;
|
||||
|
||||
@ -2456,8 +2456,8 @@ int op_change(oparg_T *oap)
|
||||
coladvance_force(getviscol());
|
||||
}
|
||||
firstline = ml_get(oap->start.lnum);
|
||||
pre_textlen = (long)strlen(firstline);
|
||||
pre_indent = (long)getwhitecols(firstline);
|
||||
pre_textlen = (int)strlen(firstline);
|
||||
pre_indent = (int)getwhitecols(firstline);
|
||||
bd.textcol = curwin->w_cursor.col;
|
||||
}
|
||||
|
||||
@ -2478,25 +2478,25 @@ int op_change(oparg_T *oap)
|
||||
// Don't repeat the insert when Insert mode ended with CTRL-C.
|
||||
if (oap->motion_type == kMTBlockWise
|
||||
&& oap->start.lnum != oap->end.lnum && !got_int) {
|
||||
long ins_len;
|
||||
int ins_len;
|
||||
// Auto-indenting may have changed the indent. If the cursor was past
|
||||
// the indent, exclude that indent change from the inserted text.
|
||||
firstline = ml_get(oap->start.lnum);
|
||||
if (bd.textcol > (colnr_T)pre_indent) {
|
||||
long new_indent = (long)getwhitecols(firstline);
|
||||
int new_indent = (int)getwhitecols(firstline);
|
||||
|
||||
pre_textlen += new_indent - pre_indent;
|
||||
bd.textcol += (colnr_T)(new_indent - pre_indent);
|
||||
}
|
||||
|
||||
ins_len = (long)strlen(firstline) - pre_textlen;
|
||||
ins_len = (int)strlen(firstline) - pre_textlen;
|
||||
if (ins_len > 0) {
|
||||
long offset;
|
||||
char *newp;
|
||||
char *oldp;
|
||||
// Subsequent calls to ml_get() flush the firstline data - take a
|
||||
// copy of the inserted text.
|
||||
char *ins_text = xmalloc((size_t)(ins_len + 1));
|
||||
char *ins_text = xmalloc((size_t)ins_len + 1);
|
||||
xstrlcpy(ins_text, firstline + bd.textcol, (size_t)ins_len + 1);
|
||||
for (linenr_T linenr = oap->start.lnum + 1; linenr <= oap->end.lnum;
|
||||
linenr++) {
|
||||
@ -2526,7 +2526,7 @@ int op_change(oparg_T *oap)
|
||||
STRMOVE(newp + offset, oldp);
|
||||
ml_replace(linenr, newp, false);
|
||||
extmark_splice_cols(curbuf, (int)linenr - 1, bd.textcol,
|
||||
0, vpos.coladd + (int)ins_len, kExtmarkUndo);
|
||||
0, vpos.coladd + ins_len, kExtmarkUndo);
|
||||
}
|
||||
}
|
||||
check_cursor();
|
||||
@ -2903,7 +2903,7 @@ static void do_autocmd_textyankpost(oparg_T *oap, yankreg_T *reg)
|
||||
/// PUT_LINE force linewise put (":put")
|
||||
/// PUT_BLOCK_INNER in block mode, do not add trailing spaces
|
||||
/// @param dir BACKWARD for 'P', FORWARD for 'p'
|
||||
void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
||||
void do_put(int regname, yankreg_T *reg, int dir, int count, int flags)
|
||||
{
|
||||
char *ptr;
|
||||
char *newp;
|
||||
@ -3320,7 +3320,8 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
||||
break;
|
||||
}
|
||||
|
||||
totlen = (size_t)(count * (yanklen + spaces) + bd.startspaces + bd.endspaces);
|
||||
totlen = (size_t)count * (size_t)(yanklen + spaces) + (size_t)bd.startspaces +
|
||||
(size_t)bd.endspaces;
|
||||
newp = xmalloc(totlen + oldlen + 1);
|
||||
|
||||
// copy part up to cursor to new line
|
||||
@ -3446,7 +3447,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
||||
// multiplication overflow
|
||||
emsg(_(e_resulting_text_too_long));
|
||||
} else {
|
||||
totlen = (size_t)(count * yanklen);
|
||||
totlen = (size_t)count * (size_t)yanklen;
|
||||
do {
|
||||
oldp = ml_get(lnum);
|
||||
oldlen = strlen(oldp);
|
||||
@ -4166,7 +4167,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
|
||||
// have moved up (last line deleted), so the current lnum is kept in t.
|
||||
t = curwin->w_cursor.lnum;
|
||||
curwin->w_cursor.lnum++;
|
||||
del_lines((long)count - 1, false);
|
||||
del_lines((int)count - 1, false);
|
||||
curwin->w_cursor.lnum = t;
|
||||
curbuf_splice_pending--;
|
||||
curbuf->deleted_bytes2 = 0;
|
||||
@ -5569,7 +5570,7 @@ static void op_colon(oparg_T *oap)
|
||||
if (oap->start.lnum == curwin->w_cursor.lnum) {
|
||||
stuffcharReadbuff('.');
|
||||
} else {
|
||||
stuffnumReadbuff((long)oap->start.lnum);
|
||||
stuffnumReadbuff(oap->start.lnum);
|
||||
}
|
||||
|
||||
// When using !! on a closed fold the range ".!" works best to operate
|
||||
@ -5590,7 +5591,7 @@ static void op_colon(oparg_T *oap)
|
||||
stuffReadbuff(".+");
|
||||
stuffnumReadbuff(oap->line_count - 1);
|
||||
} else {
|
||||
stuffnumReadbuff((long)oap->end.lnum);
|
||||
stuffnumReadbuff(oap->end.lnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5996,7 +5997,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
resel_VIsual_vcol = oap->end_vcol;
|
||||
}
|
||||
}
|
||||
resel_VIsual_line_count = (linenr_T)oap->line_count;
|
||||
resel_VIsual_line_count = oap->line_count;
|
||||
}
|
||||
|
||||
// can't redo yank (unless 'y' is in 'cpoptions') and ":"
|
||||
|
@ -558,7 +558,7 @@ static char *find_dup_item(char *origval, const char *newval, uint32_t flags)
|
||||
|
||||
/// Set the Vi-default value of a number option.
|
||||
/// Used for 'lines' and 'columns'.
|
||||
void set_number_default(char *name, long val)
|
||||
void set_number_default(char *name, OptInt val)
|
||||
{
|
||||
int opt_idx = findoption(name);
|
||||
if (opt_idx >= 0) {
|
||||
@ -800,7 +800,7 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co
|
||||
// other error
|
||||
arg++;
|
||||
if (nextchar == '&') {
|
||||
value = (long)(intptr_t)options[opt_idx].def_val;
|
||||
value = (varnumber_T)options[opt_idx].def_val;
|
||||
} else if (nextchar == '<') {
|
||||
if ((OptInt *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL) {
|
||||
// for 'undolevels' NO_LOCAL_UNDOLEVEL means using the global value
|
||||
@ -846,7 +846,7 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co
|
||||
if (op == OP_REMOVING) {
|
||||
value = *(OptInt *)varp - value;
|
||||
}
|
||||
*errmsg = set_num_option(opt_idx, (void *)varp, (long)value,
|
||||
*errmsg = set_num_option(opt_idx, (void *)varp, value,
|
||||
errbuf, errbuflen, opt_flags);
|
||||
}
|
||||
|
||||
@ -1979,8 +1979,8 @@ void set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx)
|
||||
}
|
||||
|
||||
/// Apply the OptionSet autocommand.
|
||||
static void apply_optionset_autocmd(int opt_idx, long opt_flags, OptInt oldval, OptInt oldval_g,
|
||||
long newval, const char *errmsg)
|
||||
static void apply_optionset_autocmd(int opt_idx, int opt_flags, OptInt oldval, OptInt oldval_g,
|
||||
OptInt newval, const char *errmsg)
|
||||
{
|
||||
// Don't do this while starting up, failure or recursively.
|
||||
if (starting || errmsg != NULL || *get_vim_var_str(VV_OPTION_TYPE) != NUL) {
|
||||
@ -1991,7 +1991,7 @@ static void apply_optionset_autocmd(int opt_idx, long opt_flags, OptInt oldval,
|
||||
|
||||
vim_snprintf(buf_old, sizeof(buf_old), "%" PRId64, oldval);
|
||||
vim_snprintf(buf_old_global, sizeof(buf_old_global), "%" PRId64, oldval_g);
|
||||
vim_snprintf(buf_new, sizeof(buf_new), "%ld", newval);
|
||||
vim_snprintf(buf_new, sizeof(buf_new), "%" PRId64, newval);
|
||||
vim_snprintf(buf_type, sizeof(buf_type), "%s",
|
||||
(opt_flags & OPT_LOCAL) ? "local" : "global");
|
||||
set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
|
||||
@ -2902,9 +2902,9 @@ static const char *set_bool_option(const int opt_idx, char *const varp, const in
|
||||
options[opt_idx].flags |= P_WAS_SET;
|
||||
|
||||
apply_optionset_autocmd(opt_idx, opt_flags,
|
||||
(long)(old_value ? true : false),
|
||||
(long)(old_global_value ? true : false),
|
||||
(long)(value ? true : false), NULL);
|
||||
(old_value ? true : false),
|
||||
(old_global_value ? true : false),
|
||||
(value ? true : false), NULL);
|
||||
|
||||
if (options[opt_idx].flags & P_UI_OPTION) {
|
||||
ui_call_option_set(cstr_as_string(options[opt_idx].fullname),
|
||||
@ -2924,8 +2924,8 @@ static const char *set_bool_option(const int opt_idx, char *const varp, const in
|
||||
}
|
||||
|
||||
/// Check the bounds of numeric options.
|
||||
static const char *check_num_option_bounds(OptInt *pp, OptInt old_value, long old_Rows,
|
||||
char *errbuf, size_t errbuflen, const char *errmsg)
|
||||
static const char *check_num_option_bounds(OptInt *pp, OptInt old_value, int old_Rows, char *errbuf,
|
||||
size_t errbuflen, const char *errmsg)
|
||||
{
|
||||
// Check the (new) bounds for Rows and Columns here.
|
||||
if (p_lines < min_rows() && full_screen) {
|
||||
@ -3000,9 +3000,9 @@ static const char *check_num_option_bounds(OptInt *pp, OptInt old_value, long ol
|
||||
}
|
||||
|
||||
/// Options that need some validation.
|
||||
static const char *validate_num_option(const OptInt *pp, long *valuep)
|
||||
static const char *validate_num_option(const OptInt *pp, OptInt *valuep)
|
||||
{
|
||||
long value = *valuep;
|
||||
OptInt value = *valuep;
|
||||
|
||||
// Many number options assume their value is in the signed int range.
|
||||
if (value < INT_MIN || value > INT_MAX) {
|
||||
@ -3160,12 +3160,12 @@ static const char *validate_num_option(const OptInt *pp, long *valuep)
|
||||
/// @param[in] opt_flags OPT_LOCAL, OPT_GLOBAL or OPT_MODELINE.
|
||||
///
|
||||
/// @return NULL on success, error message on error.
|
||||
static const char *set_num_option(int opt_idx, void *varp, long value, char *errbuf,
|
||||
static const char *set_num_option(int opt_idx, void *varp, OptInt value, char *errbuf,
|
||||
size_t errbuflen, int opt_flags)
|
||||
{
|
||||
OptInt old_value = *(OptInt *)varp;
|
||||
OptInt old_global_value = 0; // only used when setting a local and global option
|
||||
long old_Rows = Rows; // remember old Rows
|
||||
int old_Rows = Rows; // remember old Rows
|
||||
OptInt *pp = (OptInt *)varp;
|
||||
|
||||
// Disallow changing some options from secure mode.
|
||||
@ -3187,7 +3187,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
|
||||
return errmsg;
|
||||
}
|
||||
|
||||
*pp = (OptInt)value;
|
||||
*pp = value;
|
||||
// Remember where the option was set.
|
||||
set_option_sctx_idx(opt_idx, opt_flags, current_sctx);
|
||||
|
||||
@ -3198,7 +3198,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
|
||||
.os_varp = varp,
|
||||
.os_flags = opt_flags,
|
||||
.os_oldval.number = old_value,
|
||||
.os_newval.number = (OptInt)value,
|
||||
.os_newval.number = value,
|
||||
.os_errbuf = NULL,
|
||||
.os_errbuflen = 0,
|
||||
.os_buf = curbuf,
|
||||
@ -3218,7 +3218,7 @@ static const char *set_num_option(int opt_idx, void *varp, long value, char *err
|
||||
options[opt_idx].flags |= P_WAS_SET;
|
||||
|
||||
apply_optionset_autocmd(opt_idx, opt_flags, old_value, old_global_value,
|
||||
value, errmsg);
|
||||
(int)value, errmsg);
|
||||
|
||||
if (errmsg == NULL && options[opt_idx].flags & P_UI_OPTION) {
|
||||
ui_call_option_set(cstr_as_string(options[opt_idx].fullname),
|
||||
@ -3789,7 +3789,7 @@ static const char *set_option(int opt_idx, void *varp, OptVal *v, int opt_flags,
|
||||
if (v->type == kOptValTypeBoolean) {
|
||||
errmsg = set_bool_option(opt_idx, varp, (int)v->data.boolean, opt_flags);
|
||||
} else if (v->type == kOptValTypeNumber) {
|
||||
errmsg = set_num_option(opt_idx, varp, (long)v->data.number, errbuf, errbuflen, opt_flags);
|
||||
errmsg = set_num_option(opt_idx, varp, v->data.number, errbuf, errbuflen, opt_flags);
|
||||
} else if (v->type == kOptValTypeString) {
|
||||
errmsg = set_string_option(opt_idx, varp, v->data.string.data, opt_flags, &value_checked,
|
||||
errbuf, errbuflen);
|
||||
|
@ -452,24 +452,24 @@ struct wordnode_S {
|
||||
// Info used while reading the spell files.
|
||||
typedef struct spellinfo_S {
|
||||
wordnode_T *si_foldroot; // tree with case-folded words
|
||||
long si_foldwcount; // nr of words in si_foldroot
|
||||
int si_foldwcount; // nr of words in si_foldroot
|
||||
|
||||
wordnode_T *si_keeproot; // tree with keep-case words
|
||||
long si_keepwcount; // nr of words in si_keeproot
|
||||
int si_keepwcount; // nr of words in si_keeproot
|
||||
|
||||
wordnode_T *si_prefroot; // tree with postponed prefixes
|
||||
|
||||
long si_sugtree; // creating the soundfolding trie
|
||||
int si_sugtree; // creating the soundfolding trie
|
||||
|
||||
sblock_T *si_blocks; // memory blocks used
|
||||
long si_blocks_cnt; // memory blocks allocated
|
||||
int si_blocks_cnt; // memory blocks allocated
|
||||
int si_did_emsg; // true when ran out of memory
|
||||
|
||||
long si_compress_cnt; // words to add before lowering
|
||||
// compression limit
|
||||
int si_compress_cnt; // words to add before lowering
|
||||
// compression limit
|
||||
wordnode_T *si_first_free; // List of nodes that have been freed during
|
||||
// compression, linked by "wn_child" field.
|
||||
long si_free_count; // number of nodes in si_first_free
|
||||
int si_free_count; // number of nodes in si_first_free
|
||||
#ifdef SPELL_PRINTTREE
|
||||
int si_wordnode_nr; // sequence nr for nodes
|
||||
#endif
|
||||
@ -1874,24 +1874,24 @@ static void spell_reload_one(char *fname, bool added_word)
|
||||
|
||||
// Tunable parameters for when the tree is compressed. Filled from the
|
||||
// 'mkspellmem' option.
|
||||
static long compress_start = 30000; // memory / SBLOCKSIZE
|
||||
static long compress_inc = 100; // memory / SBLOCKSIZE
|
||||
static long compress_added = 500000; // word count
|
||||
static int compress_start = 30000; // memory / SBLOCKSIZE
|
||||
static int compress_inc = 100; // memory / SBLOCKSIZE
|
||||
static int compress_added = 500000; // word count
|
||||
|
||||
// Check the 'mkspellmem' option. Return FAIL if it's wrong.
|
||||
// Sets "sps_flags".
|
||||
int spell_check_msm(void)
|
||||
{
|
||||
char *p = p_msm;
|
||||
long start = 0;
|
||||
long incr = 0;
|
||||
long added = 0;
|
||||
int start = 0;
|
||||
int incr = 0;
|
||||
int added = 0;
|
||||
|
||||
if (!ascii_isdigit(*p)) {
|
||||
return FAIL;
|
||||
}
|
||||
// block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)
|
||||
start = (getdigits_long(&p, true, 0) * 10) / (SBLOCKSIZE / 102);
|
||||
start = (getdigits_int(&p, true, 0) * 10) / (SBLOCKSIZE / 102);
|
||||
if (*p != ',') {
|
||||
return FAIL;
|
||||
}
|
||||
@ -1899,7 +1899,7 @@ int spell_check_msm(void)
|
||||
if (!ascii_isdigit(*p)) {
|
||||
return FAIL;
|
||||
}
|
||||
incr = (getdigits_long(&p, true, 0) * 102) / (SBLOCKSIZE / 10);
|
||||
incr = (getdigits_int(&p, true, 0) * 102) / (SBLOCKSIZE / 10);
|
||||
if (*p != ',') {
|
||||
return FAIL;
|
||||
}
|
||||
@ -1907,7 +1907,7 @@ int spell_check_msm(void)
|
||||
if (!ascii_isdigit(*p)) {
|
||||
return FAIL;
|
||||
}
|
||||
added = getdigits_long(&p, true, 0) * 1024;
|
||||
added = getdigits_int(&p, true, 0) * 1024;
|
||||
if (*p != NUL) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -3177,7 +3177,7 @@ static int spell_read_dic(spellinfo_T *spin, char *fname, afffile_T *affile)
|
||||
if (os_time() > last_msg_time) {
|
||||
last_msg_time = os_time();
|
||||
vim_snprintf(message, sizeof(message),
|
||||
_("line %6d, word %6ld - %s"),
|
||||
_("line %6d, word %6d - %s"),
|
||||
lnum, spin->si_foldwcount + spin->si_keepwcount, w);
|
||||
msg_start();
|
||||
msg_outtrans_long(message, 0);
|
||||
@ -3635,7 +3635,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char *afflist, afffile_
|
||||
static int spell_read_wordfile(spellinfo_T *spin, char *fname)
|
||||
{
|
||||
FILE *fd;
|
||||
long lnum = 0;
|
||||
linenr_T lnum = 0;
|
||||
char rline[MAXLINELEN];
|
||||
char *line;
|
||||
char *pc = NULL;
|
||||
@ -3682,7 +3682,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname)
|
||||
if (spin->si_conv.vc_type != CONV_NONE) {
|
||||
pc = string_convert(&spin->si_conv, rline, NULL);
|
||||
if (pc == NULL) {
|
||||
smsg(0, _("Conversion failure for word in %s line %ld: %s"),
|
||||
smsg(0, _("Conversion failure for word in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, rline);
|
||||
continue;
|
||||
}
|
||||
@ -3696,10 +3696,10 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname)
|
||||
line++;
|
||||
if (strncmp(line, "encoding=", 9) == 0) {
|
||||
if (spin->si_conv.vc_type != CONV_NONE) {
|
||||
smsg(0, _("Duplicate /encoding= line ignored in %s line %ld: %s"),
|
||||
smsg(0, _("Duplicate /encoding= line ignored in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, line - 1);
|
||||
} else if (did_word) {
|
||||
smsg(0, _("/encoding= line after word ignored in %s line %ld: %s"),
|
||||
smsg(0, _("/encoding= line after word ignored in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, line - 1);
|
||||
} else {
|
||||
char *enc;
|
||||
@ -3720,12 +3720,12 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname)
|
||||
|
||||
if (strncmp(line, "regions=", 8) == 0) {
|
||||
if (spin->si_region_count > 1) {
|
||||
smsg(0, _("Duplicate /regions= line ignored in %s line %ld: %s"),
|
||||
smsg(0, _("Duplicate /regions= line ignored in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, line);
|
||||
} else {
|
||||
line += 8;
|
||||
if (strlen(line) > MAXREGIONS * 2) {
|
||||
smsg(0, _("Too many regions in %s line %ld: %s"),
|
||||
smsg(0, _("Too many regions in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, line);
|
||||
} else {
|
||||
spin->si_region_count = (int)strlen(line) / 2;
|
||||
@ -3738,7 +3738,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname)
|
||||
continue;
|
||||
}
|
||||
|
||||
smsg(0, _("/ line ignored in %s line %ld: %s"),
|
||||
smsg(0, _("/ line ignored in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, line - 1);
|
||||
continue;
|
||||
}
|
||||
@ -3765,13 +3765,13 @@ static int spell_read_wordfile(spellinfo_T *spin, char *fname)
|
||||
|
||||
l = (uint8_t)(*p) - '0';
|
||||
if (l == 0 || l > spin->si_region_count) {
|
||||
smsg(0, _("Invalid region nr in %s line %ld: %s"),
|
||||
smsg(0, _("Invalid region nr in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, p);
|
||||
break;
|
||||
}
|
||||
regionmask |= 1 << (l - 1);
|
||||
} else {
|
||||
smsg(0, _("Unrecognized flags in %s line %ld: %s"),
|
||||
smsg(0, _("Unrecognized flags in %s line %" PRIdLINENR ": %s"),
|
||||
fname, lnum, p);
|
||||
break;
|
||||
}
|
||||
@ -4168,7 +4168,7 @@ static void wordtree_compress(spellinfo_T *spin, wordnode_T *root, const char *n
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
hashtab_T ht;
|
||||
long tot = 0;
|
||||
int tot = 0;
|
||||
long perc;
|
||||
|
||||
// Skip the root itself, it's not actually used. The first sibling is the
|
||||
@ -4178,7 +4178,7 @@ static void wordtree_compress(spellinfo_T *spin, wordnode_T *root, const char *n
|
||||
}
|
||||
|
||||
hash_init(&ht);
|
||||
const long n = node_compress(spin, root->wn_sibling, &ht, &tot);
|
||||
const int n = node_compress(spin, root->wn_sibling, &ht, &tot);
|
||||
|
||||
#ifndef SPELL_PRINTTREE
|
||||
if (spin->si_verbose || p_verbose > 2)
|
||||
@ -4192,7 +4192,7 @@ static void wordtree_compress(spellinfo_T *spin, wordnode_T *root, const char *n
|
||||
perc = (tot - n) * 100 / tot;
|
||||
}
|
||||
vim_snprintf(IObuff, IOSIZE,
|
||||
_("Compressed %s of %ld nodes; %ld (%ld%%) remaining"),
|
||||
_("Compressed %s of %d nodes; %d (%ld%%) remaining"),
|
||||
name, tot, tot - n, perc);
|
||||
spell_message(spin, IObuff);
|
||||
}
|
||||
@ -4206,7 +4206,7 @@ static void wordtree_compress(spellinfo_T *spin, wordnode_T *root, const char *n
|
||||
/// Returns the number of compressed nodes.
|
||||
///
|
||||
/// @param tot total count of nodes before compressing, incremented while going through the tree
|
||||
static long node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, long *tot)
|
||||
static int node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int *tot)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
wordnode_T *np;
|
||||
@ -4216,7 +4216,7 @@ static long node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, lo
|
||||
hashitem_T *hi;
|
||||
long len = 0;
|
||||
unsigned nr, n;
|
||||
long compressed = 0;
|
||||
int compressed = 0;
|
||||
|
||||
// Go through the list of siblings. Compress each child and then try
|
||||
// finding an identical child to replace it.
|
||||
@ -4262,7 +4262,7 @@ static long node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, lo
|
||||
}
|
||||
}
|
||||
}
|
||||
*tot += len + 1; // add one for the node that stores the length
|
||||
*tot += (int)len + 1; // add one for the node that stores the length
|
||||
|
||||
// Make a hash key for the node and its siblings, so that we can quickly
|
||||
// find a lookalike node. This must be done after compressing the sibling
|
||||
@ -5559,15 +5559,15 @@ void spell_add_word(char *word, int len, SpellAddType what, int idx, bool undo)
|
||||
}
|
||||
|
||||
if (what == SPELL_ADD_BAD || undo) {
|
||||
long fpos_next = 0;
|
||||
long fpos = 0;
|
||||
int fpos_next = 0;
|
||||
int fpos = 0;
|
||||
// When the word appears as good word we need to remove that one,
|
||||
// since its flags sort before the one with WF_BANNED.
|
||||
fd = os_fopen(fname, "r");
|
||||
if (fd != NULL) {
|
||||
while (!vim_fgets(line, MAXWLEN * 2, fd)) {
|
||||
fpos = fpos_next;
|
||||
fpos_next = ftell(fd);
|
||||
fpos_next = (int)ftell(fd);
|
||||
if (fpos_next < 0) {
|
||||
break; // should never happen
|
||||
}
|
||||
|
@ -3555,7 +3555,7 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const
|
||||
msg_putchar(','); // Separate with commas.
|
||||
}
|
||||
msg_puts(spo_name_tab[i]);
|
||||
const long n = spp->sp_offsets[i];
|
||||
const int n = spp->sp_offsets[i];
|
||||
if (i != SPO_LC_OFF) {
|
||||
if (spp->sp_off_flags & mask) {
|
||||
msg_putchar('s');
|
||||
|
@ -822,7 +822,7 @@ void op_format(oparg_T *oap, bool keep_cursor)
|
||||
saved_cursor = oap->cursor_start;
|
||||
}
|
||||
|
||||
format_lines((linenr_T)oap->line_count, keep_cursor);
|
||||
format_lines(oap->line_count, keep_cursor);
|
||||
|
||||
// Leave the cursor at the first non-blank of the last formatted line.
|
||||
// If the cursor was moved one line back (e.g. with "Q}") go to the next
|
||||
|
@ -260,10 +260,10 @@ int u_save_buf(buf_T *buf, linenr_T top, linenr_T bot)
|
||||
}
|
||||
|
||||
if (top + 2 == bot) {
|
||||
u_saveline(buf, (linenr_T)(top + 1));
|
||||
u_saveline(buf, top + 1);
|
||||
}
|
||||
|
||||
return u_savecommon(buf, top, bot, (linenr_T)0, false);
|
||||
return u_savecommon(buf, top, bot, 0, false);
|
||||
}
|
||||
|
||||
/// Save the line "lnum" (used by ":s" and "~" command).
|
||||
@ -289,9 +289,9 @@ int u_inssub(linenr_T lnum)
|
||||
/// becomes empty.
|
||||
/// Careful: may trigger autocommands that reload the buffer.
|
||||
/// Returns FAIL when lines could not be saved, OK otherwise.
|
||||
int u_savedel(linenr_T lnum, long nlines)
|
||||
int u_savedel(linenr_T lnum, linenr_T nlines)
|
||||
{
|
||||
return u_savecommon(curbuf, lnum - 1, lnum + (linenr_T)nlines,
|
||||
return u_savecommon(curbuf, lnum - 1, lnum + nlines,
|
||||
nlines == curbuf->b_ml.ml_line_count ? 2 : lnum, false);
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
|
||||
|
||||
u_entry_T *uep;
|
||||
u_entry_T *prev_uep;
|
||||
long size = bot - top - 1;
|
||||
linenr_T size = bot - top - 1;
|
||||
|
||||
// If curbuf->b_u_synced == true make a new header.
|
||||
if (buf->b_u_synced) {
|
||||
@ -1488,7 +1488,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT
|
||||
time_t seq_time = undo_read_time(&bi);
|
||||
|
||||
// Optional header fields.
|
||||
long last_save_nr = 0;
|
||||
int last_save_nr = 0;
|
||||
while (true) {
|
||||
int len = undo_read_byte(&bi);
|
||||
|
||||
@ -1519,7 +1519,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT
|
||||
}
|
||||
}
|
||||
|
||||
long num_read_uhps = 0;
|
||||
int num_read_uhps = 0;
|
||||
|
||||
int c;
|
||||
while ((c = undo_read_2c(&bi)) == UF_HEADER_MAGIC) {
|
||||
@ -1655,7 +1655,7 @@ void u_read_undo(char *name, const uint8_t *hash, const char *orig_name FUNC_ATT
|
||||
error:
|
||||
xfree(line_ptr);
|
||||
if (uhp_table != NULL) {
|
||||
for (long i = 0; i < num_read_uhps; i++) {
|
||||
for (int i = 0; i < num_read_uhps; i++) {
|
||||
if (uhp_table[i] != NULL) {
|
||||
u_free_uhp(uhp_table[i]);
|
||||
}
|
||||
@ -1920,7 +1920,7 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event)
|
||||
// When "file" is true use "step" as a number of file writes.
|
||||
// When "absolute" is true use "step" as the sequence number to jump to.
|
||||
// "sec" must be false then.
|
||||
void undo_time(long step, bool sec, bool file, bool absolute)
|
||||
void undo_time(int step, bool sec, bool file, bool absolute)
|
||||
{
|
||||
if (text_locked()) {
|
||||
text_locked_msg();
|
||||
@ -1938,8 +1938,8 @@ void undo_time(long step, bool sec, bool file, bool absolute)
|
||||
u_oldcount = -1;
|
||||
}
|
||||
|
||||
long target;
|
||||
long closest;
|
||||
int target;
|
||||
int closest;
|
||||
u_header_T *uhp = NULL;
|
||||
bool dosec = sec;
|
||||
bool dofile = file;
|
||||
@ -1953,7 +1953,7 @@ void undo_time(long step, bool sec, bool file, bool absolute)
|
||||
closest = -1;
|
||||
} else {
|
||||
if (dosec) {
|
||||
target = (long)(curbuf->b_u_time_cur) + step;
|
||||
target = (int)curbuf->b_u_time_cur + step;
|
||||
} else if (dofile) {
|
||||
if (step < 0) {
|
||||
// Going back to a previous write. If there were changes after
|
||||
@ -1998,7 +1998,7 @@ void undo_time(long step, bool sec, bool file, bool absolute)
|
||||
closest = -1;
|
||||
} else {
|
||||
if (dosec) {
|
||||
closest = (long)(os_time() + 1);
|
||||
closest = (int)(os_time() + 1);
|
||||
} else if (dofile) {
|
||||
closest = curbuf->b_u_save_nr_last + 2;
|
||||
} else {
|
||||
@ -2010,7 +2010,7 @@ void undo_time(long step, bool sec, bool file, bool absolute)
|
||||
}
|
||||
}
|
||||
long closest_start = closest;
|
||||
long closest_seq = curbuf->b_u_seq_cur;
|
||||
int closest_seq = curbuf->b_u_seq_cur;
|
||||
int mark;
|
||||
int nomark = 0; // shut up compiler
|
||||
|
||||
@ -2042,8 +2042,8 @@ void undo_time(long step, bool sec, bool file, bool absolute)
|
||||
|
||||
while (uhp != NULL) {
|
||||
uhp->uh_walk = mark;
|
||||
long val = dosec ? (long)(uhp->uh_time) :
|
||||
dofile ? uhp->uh_save_nr
|
||||
int val = dosec ? (int)(uhp->uh_time) :
|
||||
dofile ? uhp->uh_save_nr
|
||||
: uhp->uh_seq;
|
||||
|
||||
if (round == 1 && !(dofile && val == 0)) {
|
||||
@ -2298,7 +2298,7 @@ static void u_undoredo(int undo, bool do_buf_event)
|
||||
}
|
||||
|
||||
linenr_T oldsize = bot - top - 1; // number of lines before undo
|
||||
linenr_T newsize = (linenr_T)uep->ue_size; // number of lines after undo
|
||||
linenr_T newsize = uep->ue_size; // number of lines after undo
|
||||
|
||||
if (top < newlnum) {
|
||||
// If the saved cursor is somewhere in this undo block, move it to
|
||||
@ -2676,13 +2676,13 @@ void ex_undolist(exarg_T *eap)
|
||||
while (uhp != NULL) {
|
||||
if (uhp->uh_prev.ptr == NULL && uhp->uh_walk != nomark
|
||||
&& uhp->uh_walk != mark) {
|
||||
vim_snprintf(IObuff, IOSIZE, "%6ld %7d ", uhp->uh_seq, changes);
|
||||
vim_snprintf(IObuff, IOSIZE, "%6d %7d ", uhp->uh_seq, changes);
|
||||
undo_fmt_time(IObuff + strlen(IObuff), IOSIZE - strlen(IObuff), uhp->uh_time);
|
||||
if (uhp->uh_save_nr > 0) {
|
||||
while (strlen(IObuff) < 33) {
|
||||
xstrlcat(IObuff, " ", IOSIZE);
|
||||
}
|
||||
vim_snprintf_add(IObuff, IOSIZE, " %3ld", uhp->uh_save_nr);
|
||||
vim_snprintf_add(IObuff, IOSIZE, " %3d", uhp->uh_save_nr);
|
||||
}
|
||||
GA_APPEND(char *, &ga, xstrdup(IObuff));
|
||||
}
|
||||
@ -2850,7 +2850,7 @@ static void u_getbot(buf_T *buf)
|
||||
// inserted (0 - deleted) since calling u_save. This is equal to the
|
||||
// old line count subtracted from the current line count.
|
||||
linenr_T extra = buf->b_ml.ml_line_count - uep->ue_lcount;
|
||||
uep->ue_bot = uep->ue_top + (linenr_T)uep->ue_size + 1 + extra;
|
||||
uep->ue_bot = uep->ue_top + uep->ue_size + 1 + extra;
|
||||
if (uep->ue_bot < 1 || uep->ue_bot > buf->b_ml.ml_line_count) {
|
||||
iemsg(_(e_undo_line_missing));
|
||||
uep->ue_bot = uep->ue_top + 1; // assume all lines deleted, will
|
||||
|
@ -26,7 +26,7 @@ struct u_entry {
|
||||
linenr_T ue_bot; // number of line below undo block
|
||||
linenr_T ue_lcount; // linecount when u_save called
|
||||
char **ue_array; // array of lines in undo block
|
||||
long ue_size; // number of lines in ue_array
|
||||
linenr_T ue_size; // number of lines in ue_array
|
||||
#ifdef U_DEBUG
|
||||
int ue_magic; // magic number to check allocation
|
||||
#endif
|
||||
@ -51,19 +51,19 @@ struct u_header {
|
||||
u_header_T *ptr; // pointer to previous header for alt. redo
|
||||
long seq;
|
||||
} uh_alt_prev;
|
||||
long uh_seq; // sequence number, higher == newer undo
|
||||
int uh_seq; // sequence number, higher == newer undo
|
||||
int uh_walk; // used by undo_time()
|
||||
u_entry_T *uh_entry; // pointer to first entry
|
||||
u_entry_T *uh_entry; // pointer to first entry
|
||||
u_entry_T *uh_getbot_entry; // pointer to where ue_bot must be set
|
||||
pos_T uh_cursor; // cursor position before saving
|
||||
colnr_T uh_cursor_vcol;
|
||||
int uh_flags; // see below
|
||||
fmark_T uh_namedm[NMARKS]; // marks before undo/after redo
|
||||
int uh_flags; // see below
|
||||
fmark_T uh_namedm[NMARKS]; // marks before undo/after redo
|
||||
extmark_undo_vec_t uh_extmark; // info to move extmarks
|
||||
visualinfo_T uh_visual; // Visual areas before undo/after redo
|
||||
time_t uh_time; // timestamp when the change was made
|
||||
long uh_save_nr; // set when the file was saved after the
|
||||
// changes in this block
|
||||
visualinfo_T uh_visual; // Visual areas before undo/after redo
|
||||
time_t uh_time; // timestamp when the change was made
|
||||
int uh_save_nr; // set when the file was saved after the
|
||||
// changes in this block
|
||||
#ifdef U_DEBUG
|
||||
int uh_magic; // magic number to check allocation
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user