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 dacd34364f
commit 8e932480f6
52 changed files with 280 additions and 290 deletions

View File

@ -1766,10 +1766,10 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
patcmd.data = data; patcmd.data = data;
// set v:cmdarg (only when there is a matching pattern) // set v:cmdarg (only when there is a matching pattern)
save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG); save_cmdbang = get_vim_var_nr(VV_CMDBANG);
if (eap != NULL) { if (eap != NULL) {
save_cmdarg = set_cmdarg(eap, NULL); save_cmdarg = set_cmdarg(eap, NULL);
set_vim_var_nr(VV_CMDBANG, (long)eap->forceit); set_vim_var_nr(VV_CMDBANG, eap->forceit);
} else { } else {
save_cmdarg = NULL; // avoid gcc warning save_cmdarg = NULL; // avoid gcc warning
} }

View File

@ -274,8 +274,8 @@ typedef struct qf_info_S qf_info_T;
typedef struct { typedef struct {
proftime_T total; // total time used proftime_T total; // total time used
proftime_T slowest; // time of slowest call proftime_T slowest; // time of slowest call
long count; // nr of times used int count; // nr of times used
long match; // nr of times matched int match; // nr of times matched
} syn_time_T; } syn_time_T;
// These are items normally related to a buffer. But when using ":ownsyntax" // These are items normally related to a buffer. But when using ":ownsyntax"
@ -440,10 +440,10 @@ struct file_buffer {
disptick_T b_mod_tick_decor; // last display tick decoration providers disptick_T b_mod_tick_decor; // last display tick decoration providers
// where invoked // where invoked
long b_mtime; // last change time of original file int64_t b_mtime; // last change time of original file
long b_mtime_ns; // nanoseconds of last change time int64_t b_mtime_ns; // nanoseconds of last change time
long b_mtime_read; // last change time when reading int64_t b_mtime_read; // last change time when reading
long b_mtime_read_ns; // nanoseconds of last read time int64_t b_mtime_read_ns; // nanoseconds of last read time
uint64_t b_orig_size; // size of original file in bytes uint64_t b_orig_size; // size of original file in bytes
int b_orig_mode; // mode of original file int b_orig_mode; // mode of original file
time_t b_last_used; // time when the buffer was last used; used time_t b_last_used; // time when the buffer was last used; used
@ -1268,7 +1268,7 @@ struct window_S {
int w_briopt_list; // additional indent for lists int w_briopt_list; // additional indent for lists
int w_briopt_vcol; // indent for specific column int w_briopt_vcol; // indent for specific column
long w_scbind_pos; int w_scbind_pos;
ScopeDictDictItem w_winvar; ///< Variable for "w:" dictionary. ScopeDictDictItem w_winvar; ///< Variable for "w:" dictionary.
dict_T *w_vars; ///< Dictionary with w: variables. dict_T *w_vars; ///< Dictionary with w: variables.

View File

@ -339,7 +339,7 @@ static int buf_write_bytes(struct bw_info *ip)
// Only checking conversion, which is OK if we get here. // Only checking conversion, which is OK if we get here.
return OK; return OK;
} }
int wlen = (int)write_eintr(ip->bw_fd, buf, (size_t)len); int wlen = write_eintr(ip->bw_fd, buf, (size_t)len);
return (wlen < len) ? FAIL : OK; return (wlen < len) ? FAIL : OK;
} }
@ -619,14 +619,14 @@ static void emit_err(Error_T *e)
#if defined(UNIX) #if defined(UNIX)
static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwriting, long *perm, static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwriting, int *perm,
bool *device, bool *newfile, Error_T *err) bool *device, bool *newfile, Error_T *err)
{ {
*perm = -1; *perm = -1;
if (!os_fileinfo(fname, file_info_old)) { if (!os_fileinfo(fname, file_info_old)) {
*newfile = true; *newfile = true;
} else { } else {
*perm = (long)file_info_old->stat.st_mode; *perm = (int)file_info_old->stat.st_mode;
if (!S_ISREG(file_info_old->stat.st_mode)) { // not a file if (!S_ISREG(file_info_old->stat.st_mode)) { // not a file
if (S_ISDIR(file_info_old->stat.st_mode)) { if (S_ISDIR(file_info_old->stat.st_mode)) {
*err = set_err_num("E502", _("is a directory")); *err = set_err_num("E502", _("is a directory"));
@ -648,7 +648,7 @@ static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwritin
#else #else
static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwriting, long *perm, static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwriting, int *perm,
bool *device, bool *newfile, Error_T *err) bool *device, bool *newfile, Error_T *err)
{ {
// Check for a writable device name. // Check for a writable device name.
@ -688,7 +688,7 @@ static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwritin
/// @param[out] newfile /// @param[out] newfile
/// @param[out] readonly /// @param[out] readonly
static int get_fileinfo(buf_T *buf, char *fname, bool overwriting, bool forceit, static int get_fileinfo(buf_T *buf, char *fname, bool overwriting, bool forceit,
FileInfo *file_info_old, long *perm, bool *device, bool *newfile, FileInfo *file_info_old, int *perm, bool *device, bool *newfile,
bool *readonly, Error_T *err) bool *readonly, Error_T *err)
{ {
if (get_fileinfo_os(fname, file_info_old, overwriting, perm, device, newfile, err) == FAIL) { if (get_fileinfo_os(fname, file_info_old, overwriting, perm, device, newfile, err) == FAIL) {
@ -723,7 +723,7 @@ static int get_fileinfo(buf_T *buf, char *fname, bool overwriting, bool forceit,
} }
static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_old, vim_acl_T acl, static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_old, vim_acl_T acl,
long perm, unsigned bkc, bool file_readonly, bool forceit, int perm, unsigned bkc, bool file_readonly, bool forceit,
int *backup_copyp, char **backupp, Error_T *err) int *backup_copyp, char **backupp, Error_T *err)
{ {
FileInfo file_info; FileInfo file_info;
@ -755,7 +755,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
} }
} }
int fd = os_open(IObuff, int fd = os_open(IObuff,
O_CREAT|O_WRONLY|O_EXCL|O_NOFOLLOW, (int)perm); O_CREAT|O_WRONLY|O_EXCL|O_NOFOLLOW, perm);
if (fd < 0) { // can't write in directory if (fd < 0) { // can't write in directory
*backup_copyp = true; *backup_copyp = true;
} else { } else {
@ -764,7 +764,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
if (!os_fileinfo(IObuff, &file_info) if (!os_fileinfo(IObuff, &file_info)
|| file_info.stat.st_uid != file_info_old->stat.st_uid || file_info.stat.st_uid != file_info_old->stat.st_uid
|| file_info.stat.st_gid != file_info_old->stat.st_gid || file_info.stat.st_gid != file_info_old->stat.st_gid
|| (long)file_info.stat.st_mode != perm) { || (int)file_info.stat.st_mode != perm) {
*backup_copyp = true; *backup_copyp = true;
} }
#endif #endif
@ -911,7 +911,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
// //
if (file_info_new.stat.st_gid != file_info_old->stat.st_gid if (file_info_new.stat.st_gid != file_info_old->stat.st_gid
&& os_chown(*backupp, (uv_uid_t)-1, (uv_gid_t)file_info_old->stat.st_gid) != 0) { && os_chown(*backupp, (uv_uid_t)-1, (uv_gid_t)file_info_old->stat.st_gid) != 0) {
os_setperm(*backupp, ((int)perm & 0707) | (((int)perm & 07) << 3)); os_setperm(*backupp, (perm & 0707) | ((perm & 07) << 3));
} }
# ifdef HAVE_XATTR # ifdef HAVE_XATTR
os_copy_xattr(fname, *backupp); os_copy_xattr(fname, *backupp);
@ -1193,7 +1193,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
} }
Error_T err = { 0 }; Error_T err = { 0 };
long perm; // file permissions int perm; // file permissions
bool newfile = false; // true if file doesn't exist yet bool newfile = false; // true if file doesn't exist yet
bool device = false; // writing to a device bool device = false; // writing to a device
bool file_readonly = false; // overwritten file is read-only bool file_readonly = false; // overwritten file is read-only
@ -1255,7 +1255,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
&& file_info_old.stat.st_uid == getuid() && file_info_old.stat.st_uid == getuid()
&& vim_strchr(p_cpo, CPO_FWRITE) == NULL) { && vim_strchr(p_cpo, CPO_FWRITE) == NULL) {
perm |= 0200; perm |= 0200;
(void)os_setperm(fname, (int)perm); (void)os_setperm(fname, perm);
made_writable = true; made_writable = true;
} }
#endif #endif
@ -1658,7 +1658,7 @@ restore_backup:
|| file_info.stat.st_gid != file_info_old.stat.st_gid) { || file_info.stat.st_gid != file_info_old.stat.st_gid) {
os_fchown(fd, (uv_uid_t)file_info_old.stat.st_uid, (uv_gid_t)file_info_old.stat.st_gid); os_fchown(fd, (uv_uid_t)file_info_old.stat.st_uid, (uv_gid_t)file_info_old.stat.st_gid);
if (perm >= 0) { // Set permission again, may have changed. if (perm >= 0) { // Set permission again, may have changed.
(void)os_setperm(wfname, (int)perm); (void)os_setperm(wfname, perm);
} }
} }
buf_set_file_id(buf); buf_set_file_id(buf);
@ -1679,7 +1679,7 @@ restore_backup:
} }
#endif #endif
if (perm >= 0) { // Set perm. of new file same as old file. if (perm >= 0) { // Set perm. of new file same as old file.
(void)os_setperm(wfname, (int)perm); (void)os_setperm(wfname, perm);
} }
// Probably need to set the ACL before changing the user (can't set the // Probably need to set the ACL before changing the user (can't set the
// ACL on a file the user doesn't own). // ACL on a file the user doesn't own).

View File

@ -831,7 +831,7 @@ int del_chars(int count, int fixpos)
{ {
int bytes = 0; int bytes = 0;
char *p = get_cursor_pos_ptr(); char *p = get_cursor_pos_ptr();
for (long i = 0; i < count && *p != NUL; i++) { for (int i = 0; i < count && *p != NUL; i++) {
int l = utfc_ptr2len(p); int l = utfc_ptr2len(p);
bytes += l; bytes += l;
p += l; p += l;
@ -1829,7 +1829,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (flags & OPENLINE_MARKFIX) { if (flags & OPENLINE_MARKFIX) {
mark_col_adjust(curwin->w_cursor.lnum, mark_col_adjust(curwin->w_cursor.lnum,
curwin->w_cursor.col + less_cols_off, curwin->w_cursor.col + less_cols_off,
1L, (long)-less_cols, 0); 1L, -less_cols, 0);
} }
// Always move extmarks - Here we move only the line where the // Always move extmarks - Here we move only the line where the
// cursor is, the previous mark_adjust takes care of the lines after // cursor is, the previous mark_adjust takes care of the lines after

View File

@ -82,7 +82,7 @@ static bool diff_need_update = false; // ex_diffupdate needs to be called
#define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL) #define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL)
static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF; static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF;
static long diff_algorithm = 0; static int diff_algorithm = 0;
static int linematch_lines = 0; static int linematch_lines = 0;
#define LBUFLEN 50 // length of line in diff file #define LBUFLEN 50 // length of line in diff file
@ -3402,7 +3402,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp)
/// ///
static int parse_diff_ed(char *line, diffhunk_T *hunk) static int parse_diff_ed(char *line, diffhunk_T *hunk)
{ {
long l1, l2; int l1, l2;
// The line must be one of three formats: // The line must be one of three formats:
// change: {first}[,{last}]c{first}[,{last}] // change: {first}[,{last}]c{first}[,{last}]
@ -3412,7 +3412,7 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk)
linenr_T f1 = getdigits_int32(&p, true, 0); linenr_T f1 = getdigits_int32(&p, true, 0);
if (*p == ',') { if (*p == ',') {
p++; p++;
l1 = getdigits_long(&p, true, 0); l1 = getdigits_int(&p, true, 0);
} else { } else {
l1 = f1; l1 = f1;
} }
@ -3420,10 +3420,10 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk)
return FAIL; // invalid diff format return FAIL; // invalid diff format
} }
int difftype = (uint8_t)(*p++); int difftype = (uint8_t)(*p++);
long f2 = getdigits_long(&p, true, 0); int f2 = getdigits_int(&p, true, 0);
if (*p == ',') { if (*p == ',') {
p++; p++;
l2 = getdigits_long(&p, true, 0); l2 = getdigits_int(&p, true, 0);
} else { } else {
l2 = f2; l2 = f2;
} }
@ -3448,31 +3448,29 @@ static int parse_diff_ed(char *line, diffhunk_T *hunk)
return OK; return OK;
} }
///
/// Parses unified diff with zero(!) context lines. /// Parses unified diff with zero(!) context lines.
/// Return FAIL if there is no diff information in "line". /// Return FAIL if there is no diff information in "line".
///
static int parse_diff_unified(char *line, diffhunk_T *hunk) static int parse_diff_unified(char *line, diffhunk_T *hunk)
{ {
// Parse unified diff hunk header: // Parse unified diff hunk header:
// @@ -oldline,oldcount +newline,newcount @@ // @@ -oldline,oldcount +newline,newcount @@
char *p = line; char *p = line;
if (*p++ == '@' && *p++ == '@' && *p++ == ' ' && *p++ == '-') { if (*p++ == '@' && *p++ == '@' && *p++ == ' ' && *p++ == '-') {
long oldcount; int oldcount;
long newline; linenr_T newline;
long newcount; int newcount;
long oldline = getdigits_long(&p, true, 0); linenr_T oldline = getdigits_int32(&p, true, 0);
if (*p == ',') { if (*p == ',') {
p++; p++;
oldcount = getdigits_long(&p, true, 0); oldcount = getdigits_int(&p, true, 0);
} else { } else {
oldcount = 1; oldcount = 1;
} }
if (*p++ == ' ' && *p++ == '+') { if (*p++ == ' ' && *p++ == '+') {
newline = getdigits_long(&p, true, 0); newline = getdigits_int(&p, true, 0);
if (*p == ',') { if (*p == ',') {
p++; p++;
newcount = getdigits_long(&p, true, 0); newcount = getdigits_int(&p, true, 0);
} else { } else {
newcount = 1; newcount = 1;
} }
@ -3490,9 +3488,9 @@ static int parse_diff_unified(char *line, diffhunk_T *hunk)
newline = 1; newline = 1;
} }
hunk->lnum_orig = (linenr_T)oldline; hunk->lnum_orig = oldline;
hunk->count_orig = oldcount; hunk->count_orig = oldcount;
hunk->lnum_new = (linenr_T)newline; hunk->lnum_new = newline;
hunk->count_new = newcount; hunk->count_new = newcount;
return OK; return OK;
@ -3501,11 +3499,9 @@ static int parse_diff_unified(char *line, diffhunk_T *hunk)
return FAIL; return FAIL;
} }
///
/// Callback function for the xdl_diff() function. /// Callback function for the xdl_diff() function.
/// Stores the diff output in a grow array. /// Stores the diff output in a grow array.
/// static int xdiff_out(int start_a, int count_a, int start_b, int count_b, void *priv)
static int xdiff_out(long start_a, long count_a, long start_b, long count_b, void *priv)
{ {
diffout_T *dout = (diffout_T *)priv; diffout_T *dout = (diffout_T *)priv;
GA_APPEND(diffhunk_T, &(dout->dout_ga), ((diffhunk_T){ GA_APPEND(diffhunk_T, &(dout->dout_ga), ((diffhunk_T){

View File

@ -1647,11 +1647,11 @@ static void win_update(win_T *wp, DecorProviders *providers)
// When only displaying the lines at the top, set top_end. Used when // When only displaying the lines at the top, set top_end. Used when
// window has scrolled down for msg_scrolled. // window has scrolled down for msg_scrolled.
if (type == UPD_REDRAW_TOP) { if (type == UPD_REDRAW_TOP) {
long j = 0; int j = 0;
for (int i = 0; i < wp->w_lines_valid; i++) { for (int i = 0; i < wp->w_lines_valid; i++) {
j += wp->w_lines[i].wl_size; j += wp->w_lines[i].wl_size;
if (j >= wp->w_upd_rows) { if (j >= wp->w_upd_rows) {
top_end = (int)j; top_end = j;
break; break;
} }
} }
@ -1684,7 +1684,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
|| (wp->w_topline == wp->w_lines[0].wl_lnum || (wp->w_topline == wp->w_lines[0].wl_lnum
&& wp->w_topfill > wp->w_old_topfill))) { && wp->w_topfill > wp->w_old_topfill))) {
// New topline is above old topline: May scroll down. // New topline is above old topline: May scroll down.
long j; int j;
if (hasAnyFolding(wp)) { if (hasAnyFolding(wp)) {
linenr_T ln; linenr_T ln;
@ -1744,7 +1744,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
// needs updating. // needs updating.
// try to find wp->w_topline in wp->w_lines[].wl_lnum // try to find wp->w_topline in wp->w_lines[].wl_lnum
long j = -1; int j = -1;
int row = 0; int row = 0;
for (int i = 0; i < wp->w_lines_valid; i++) { for (int i = 0; i < wp->w_lines_valid; i++) {
if (wp->w_lines[i].wl_valid if (wp->w_lines[i].wl_valid
@ -2151,7 +2151,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
int new_rows = 0; int new_rows = 0;
// Able to count old number of rows: Count new window // Able to count old number of rows: Count new window
// rows, and may insert/delete lines // rows, and may insert/delete lines
long j = idx; int j = idx;
for (l = lnum; l < mod_bot; l++) { for (l = lnum; l < mod_bot; l++) {
if (hasFoldingWin(wp, l, NULL, &l, true, NULL)) { if (hasFoldingWin(wp, l, NULL, &l, true, NULL)) {
new_rows++; new_rows++;
@ -2212,14 +2212,14 @@ static void win_update(win_T *wp, DecorProviders *providers)
while (true) { while (true) {
// stop at last valid entry in w_lines[] // stop at last valid entry in w_lines[]
if (i >= wp->w_lines_valid) { if (i >= wp->w_lines_valid) {
wp->w_lines_valid = (int)j; wp->w_lines_valid = j;
break; break;
} }
wp->w_lines[j] = wp->w_lines[i]; wp->w_lines[j] = wp->w_lines[i];
// stop at a line that won't fit // stop at a line that won't fit
if (x + (int)wp->w_lines[j].wl_size if (x + (int)wp->w_lines[j].wl_size
> wp->w_grid.rows) { > wp->w_grid.rows) {
wp->w_lines_valid = (int)j + 1; wp->w_lines_valid = j + 1;
break; break;
} }
x += wp->w_lines[j++].wl_size; x += wp->w_lines[j++].wl_size;
@ -2407,7 +2407,7 @@ static void win_update(win_T *wp, DecorProviders *providers)
} else { } else {
if (eof) { // we hit the end of the file if (eof) { // we hit the end of the file
wp->w_botline = buf->b_ml.ml_line_count + 1; wp->w_botline = buf->b_ml.ml_line_count + 1;
long j = win_get_fill(wp, wp->w_botline); int j = win_get_fill(wp, wp->w_botline);
if (j > 0 && !wp->w_botfill && row < wp->w_grid.rows) { if (j > 0 && !wp->w_botfill && row < wp->w_grid.rows) {
// Display filler text below last line. win_line() will check // Display filler text below last line. win_line() will check
// for ml_line_count+1 and only draw filler lines // for ml_line_count+1 and only draw filler lines

View File

@ -1645,7 +1645,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
lp->ll_n1 = 0; lp->ll_n1 = 0;
} else { } else {
// Is number or string. // Is number or string.
lp->ll_n1 = (long)tv_get_number(&var1); lp->ll_n1 = (int)tv_get_number(&var1);
} }
tv_clear(&var1); tv_clear(&var1);
@ -1655,7 +1655,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
return NULL; return NULL;
} }
if (lp->ll_range && !lp->ll_empty2) { if (lp->ll_range && !lp->ll_empty2) {
lp->ll_n2 = (long)tv_get_number(&var2); lp->ll_n2 = (int)tv_get_number(&var2);
tv_clear(&var2); tv_clear(&var2);
if (tv_blob_check_range(bloblen, lp->ll_n1, lp->ll_n2, quiet) == FAIL) { if (tv_blob_check_range(bloblen, lp->ll_n1, lp->ll_n2, quiet) == FAIL) {
return NULL; return NULL;
@ -1670,7 +1670,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
lp->ll_n1 = 0; lp->ll_n1 = 0;
} else { } else {
// Is number or string. // Is number or string.
lp->ll_n1 = (long)tv_get_number(&var1); lp->ll_n1 = (int)tv_get_number(&var1);
} }
tv_clear(&var1); tv_clear(&var1);
@ -1687,7 +1687,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
// When no index given: "lp->ll_empty2" is true. // When no index given: "lp->ll_empty2" is true.
// Otherwise "lp->ll_n2" is set to the second index. // Otherwise "lp->ll_n2" is set to the second index.
if (lp->ll_range && !lp->ll_empty2) { if (lp->ll_range && !lp->ll_empty2) {
lp->ll_n2 = (long)tv_get_number(&var2); // Is number or string. lp->ll_n2 = (int)tv_get_number(&var2); // Is number or string.
tv_clear(&var2); tv_clear(&var2);
if (tv_list_check_range_index_two(lp->ll_list, if (tv_list_check_range_index_two(lp->ll_list,
&lp->ll_n1, lp->ll_li, &lp->ll_n1, lp->ll_li,
@ -1746,7 +1746,7 @@ void set_var_lval(lval_T *lp, char *endp, typval_T *rettv, int copy, const bool
bool error = false; bool error = false;
const char val = (char)tv_get_number_chk(rettv, &error); const char val = (char)tv_get_number_chk(rettv, &error);
if (!error) { if (!error) {
tv_blob_set_append(lp->ll_blob, (int)lp->ll_n1, (uint8_t)val); tv_blob_set_append(lp->ll_blob, lp->ll_n1, (uint8_t)val);
} }
} }
} else if (op != NULL && *op != '=') { } else if (op != NULL && *op != '=') {
@ -5914,7 +5914,7 @@ void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, bool retlist
char **argv = tv_to_argv(&argvars[0], NULL, &executable); char **argv = tv_to_argv(&argvars[0], NULL, &executable);
if (!argv) { if (!argv) {
if (!executable) { if (!executable) {
set_vim_var_nr(VV_SHELL_ERROR, (long)-1); set_vim_var_nr(VV_SHELL_ERROR, -1);
} }
xfree(input); xfree(input);
return; // Already did emsg. return; // Already did emsg.
@ -5944,7 +5944,7 @@ void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, bool retlist
xfree(input); xfree(input);
set_vim_var_nr(VV_SHELL_ERROR, (long)status); set_vim_var_nr(VV_SHELL_ERROR, status);
if (res == NULL) { if (res == NULL) {
if (retlist) { if (retlist) {
@ -6231,7 +6231,7 @@ void timer_due_cb(TimeWatcher *tw, void *data)
timer_decref(timer); timer_decref(timer);
} }
uint64_t timer_start(const long timeout, const int repeat_count, const Callback *const callback) uint64_t timer_start(const int64_t timeout, const int repeat_count, const Callback *const callback)
{ {
timer_T *timer = xmalloc(sizeof *timer); timer_T *timer = xmalloc(sizeof *timer);
timer->refcount = 1; timer->refcount = 1;
@ -7122,7 +7122,7 @@ void set_vim_var_char(int c)
/// Set v:count to "count" and v:count1 to "count1". /// Set v:count to "count" and v:count1 to "count1".
/// ///
/// @param set_prevcount if true, first set v:prevcount from v:count. /// @param set_prevcount if true, first set v:prevcount from v:count.
void set_vcount(long count, long count1, int set_prevcount) void set_vcount(int64_t count, int64_t count1, bool set_prevcount)
{ {
if (set_prevcount) { if (set_prevcount) {
vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;

View File

@ -53,11 +53,11 @@ typedef struct lval_S {
list_T *ll_list; ///< The list or NULL. list_T *ll_list; ///< The list or NULL.
bool ll_range; ///< true when a [i:j] range was used. bool ll_range; ///< true when a [i:j] range was used.
bool ll_empty2; ///< Second index is empty: [i:]. bool ll_empty2; ///< Second index is empty: [i:].
long ll_n1; ///< First index for list. int ll_n1; ///< First index for list.
long ll_n2; ///< Second index for list range. int ll_n2; ///< Second index for list range.
dict_T *ll_dict; ///< The Dictionary or NULL. dict_T *ll_dict; ///< The Dictionary or NULL.
dictitem_T *ll_di; ///< The dictitem or NULL. dictitem_T *ll_di; ///< The dictitem or NULL.
char *ll_newkey; ///< New key for Dict in allocated memory or NULL. char *ll_newkey; ///< New key for Dict in allocated memory or NULL.
blob_T *ll_blob; ///< The Blob or NULL. blob_T *ll_blob; ///< The Blob or NULL.
} lval_T; } lval_T;
@ -225,7 +225,7 @@ typedef struct {
int repeat_count; int repeat_count;
int refcount; int refcount;
int emsg_count; ///< Errors in a repeating timer. int emsg_count; ///< Errors in a repeating timer.
long timeout; int64_t timeout;
bool stopped; bool stopped;
bool paused; bool paused;
Callback callback; Callback callback;

View File

@ -152,9 +152,9 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
? 0 ? 0
: (v.data.l.li == NULL : (v.data.l.li == NULL
? tv_list_len(v.data.l.list) - 1 ? tv_list_len(v.data.l.list) - 1
: (int)tv_list_idx_of_item(v.data.l.list, : tv_list_idx_of_item(v.data.l.list,
TV_LIST_ITEM_PREV(v.data.l.list, TV_LIST_ITEM_PREV(v.data.l.list,
v.data.l.li)))); v.data.l.li))));
const listitem_T *const li = (v.data.l.li == NULL const listitem_T *const li = (v.data.l.li == NULL
? tv_list_last(v.data.l.list) ? tv_list_last(v.data.l.list)
: TV_LIST_ITEM_PREV(v.data.l.list, : TV_LIST_ITEM_PREV(v.data.l.list,

View File

@ -526,7 +526,7 @@ buf_T *get_buf_arg(typval_T *arg)
/// "byte2line(byte)" function /// "byte2line(byte)" function
static void f_byte2line(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) static void f_byte2line(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{ {
long boff = (long)tv_get_number(&argvars[0]) - 1; int boff = (int)tv_get_number(&argvars[0]) - 1;
if (boff < 0) { if (boff < 0) {
rettv->vval.v_number = -1; rettv->vval.v_number = -1;
} else { } else {
@ -8708,8 +8708,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (!callback_from_typval(&callback, &argvars[1])) { if (!callback_from_typval(&callback, &argvars[1])) {
return; return;
} }
rettv->vval.v_number = (varnumber_T)timer_start((const long)tv_get_number(&argvars[0]), repeat, rettv->vval.v_number = (varnumber_T)timer_start(tv_get_number(&argvars[0]), repeat, &callback);
&callback);
} }
/// "timer_stop(timerid)" function /// "timer_stop(timerid)" function

View File

@ -620,7 +620,7 @@ tv_list_copy_error:
/// Get the list item in "l" with index "n1". "n1" is adjusted if needed. /// Get the list item in "l" with index "n1". "n1" is adjusted if needed.
/// Return NULL if there is no such item. /// Return NULL if there is no such item.
listitem_T *tv_list_check_range_index_one(list_T *const l, long *const n1, const bool quiet) listitem_T *tv_list_check_range_index_one(list_T *const l, int *const n1, const bool quiet)
{ {
listitem_T *li = tv_list_find_index(l, n1); listitem_T *li = tv_list_find_index(l, n1);
if (li == NULL) { if (li == NULL) {
@ -636,11 +636,11 @@ listitem_T *tv_list_check_range_index_one(list_T *const l, long *const n1, const
/// If "n1" or "n2" is negative it is changed to the positive index. /// If "n1" or "n2" is negative it is changed to the positive index.
/// "li1" is the item for item "n1". /// "li1" is the item for item "n1".
/// Return OK or FAIL. /// Return OK or FAIL.
int tv_list_check_range_index_two(list_T *const l, long *const n1, const listitem_T *const li1, int tv_list_check_range_index_two(list_T *const l, int *const n1, const listitem_T *const li1,
long *const n2, const bool quiet) int *const n2, const bool quiet)
{ {
if (*n2 < 0) { if (*n2 < 0) {
listitem_T *ni = tv_list_find(l, (int)(*n2)); listitem_T *ni = tv_list_find(l, *n2);
if (ni == NULL) { if (ni == NULL) {
if (!quiet) { if (!quiet) {
semsg(_(e_list_index_out_of_range_nr), (int64_t)(*n2)); semsg(_(e_list_index_out_of_range_nr), (int64_t)(*n2));
@ -670,11 +670,10 @@ int tv_list_check_range_index_two(list_T *const l, long *const n1, const listite
/// "op" is the operator, normally "=" but can be "+=" and the like. /// "op" is the operator, normally "=" but can be "+=" and the like.
/// "varname" is used for error messages. /// "varname" is used for error messages.
/// Returns OK or FAIL. /// Returns OK or FAIL.
int tv_list_assign_range(list_T *const dest, list_T *const src, const long idx1_arg, int tv_list_assign_range(list_T *const dest, list_T *const src, const int idx1_arg, const int idx2,
const long idx2, const bool empty_idx2, const char *const op, const bool empty_idx2, const char *const op, const char *const varname)
const char *const varname)
{ {
long idx1 = idx1_arg; int idx1 = idx1_arg;
listitem_T *const first_li = tv_list_find_index(dest, &idx1); listitem_T *const first_li = tv_list_find_index(dest, &idx1);
listitem_T *src_li; listitem_T *src_li;
@ -1634,14 +1633,14 @@ const char *tv_list_find_str(list_T *const l, const int n)
/// Like tv_list_find() but when a negative index is used that is not found use /// Like tv_list_find() but when a negative index is used that is not found use
/// zero and set "idx" to zero. Used for first index of a range. /// zero and set "idx" to zero. Used for first index of a range.
static listitem_T *tv_list_find_index(list_T *const l, long *const idx) static listitem_T *tv_list_find_index(list_T *const l, int *const idx)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_WARN_UNUSED_RESULT
{ {
listitem_T *li = tv_list_find(l, (int)(*idx)); listitem_T *li = tv_list_find(l, *idx);
if (li == NULL) { if (li == NULL) {
if (*idx < 0) { if (*idx < 0) {
*idx = 0; *idx = 0;
li = tv_list_find(l, (int)(*idx)); li = tv_list_find(l, *idx);
} }
} }
return li; return li;
@ -1653,7 +1652,7 @@ static listitem_T *tv_list_find_index(list_T *const l, long *const idx)
/// @param[in] item Item to search for. /// @param[in] item Item to search for.
/// ///
/// @return Index of an item or -1 if item is not in the list. /// @return Index of an item or -1 if item is not in the list.
long tv_list_idx_of_item(const list_T *const l, const listitem_T *const item) int tv_list_idx_of_item(const list_T *const l, const listitem_T *const item)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE
{ {
if (l == NULL) { if (l == NULL) {

View File

@ -3521,8 +3521,8 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_n
&& (cmdpreview_ns <= 0 || preview_lines.lines_needed <= (linenr_T)p_cwh && (cmdpreview_ns <= 0 || preview_lines.lines_needed <= (linenr_T)p_cwh
|| lnum <= curwin->w_botline); || lnum <= curwin->w_botline);
lnum++) { lnum++) {
int nmatch = (int)vim_regexec_multi(&regmatch, curwin, curbuf, lnum, int nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
(colnr_T)0, NULL, NULL); (colnr_T)0, NULL, NULL);
if (nmatch) { if (nmatch) {
colnr_T copycol; colnr_T copycol;
colnr_T matchcol; colnr_T matchcol;
@ -4087,9 +4087,9 @@ skip:
// need to replace the line first (using \zs after \n). // need to replace the line first (using \zs after \n).
if (lastone if (lastone
|| nmatch_tl > 0 || nmatch_tl > 0
|| (nmatch = (int)vim_regexec_multi(&regmatch, curwin, || (nmatch = vim_regexec_multi(&regmatch, curwin,
curbuf, sub_firstlnum, curbuf, sub_firstlnum,
matchcol, NULL, NULL)) == 0 matchcol, NULL, NULL)) == 0
|| regmatch.startpos[0].lnum > 0) { || regmatch.startpos[0].lnum > 0) {
if (new_start != NULL) { if (new_start != NULL) {
// Copy the rest of the line, that didn't match. // Copy the rest of the line, that didn't match.
@ -4149,8 +4149,8 @@ skip:
copycol = 0; copycol = 0;
} }
if (nmatch == -1 && !lastone) { if (nmatch == -1 && !lastone) {
nmatch = (int)vim_regexec_multi(&regmatch, curwin, curbuf, nmatch = vim_regexec_multi(&regmatch, curwin, curbuf,
sub_firstlnum, matchcol, NULL, NULL); sub_firstlnum, matchcol, NULL, NULL);
} }
// 5. break if there isn't another match in this line // 5. break if there isn't another match in this line
@ -4446,7 +4446,7 @@ void ex_global(exarg_T *eap)
if (global_busy) { if (global_busy) {
lnum = curwin->w_cursor.lnum; lnum = curwin->w_cursor.lnum;
match = (int)vim_regexec_multi(&regmatch, curwin, curbuf, lnum, 0, NULL, NULL); match = vim_regexec_multi(&regmatch, curwin, curbuf, lnum, 0, NULL, NULL);
if ((type == 'g' && match) || (type == 'v' && !match)) { if ((type == 'g' && match) || (type == 'v' && !match)) {
global_exe_one(cmd, lnum); global_exe_one(cmd, lnum);
} }
@ -4455,7 +4455,7 @@ void ex_global(exarg_T *eap)
// pass 1: set marks for each (not) matching line // pass 1: set marks for each (not) matching line
for (lnum = eap->line1; lnum <= eap->line2 && !got_int; lnum++) { for (lnum = eap->line1; lnum <= eap->line2 && !got_int; lnum++) {
// a match on this line? // a match on this line?
match = (int)vim_regexec_multi(&regmatch, curwin, curbuf, lnum, 0, NULL, NULL); match = vim_regexec_multi(&regmatch, curwin, curbuf, lnum, 0, NULL, NULL);
if (regmatch.regprog == NULL) { if (regmatch.regprog == NULL) {
break; // re-compiling regprog failed break; // re-compiling regprog failed
} }

View File

@ -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. // Call the function to execute the builtin command or the preview callback.
eap->errmsg = NULL; eap->errmsg = NULL;
if (preview) { if (preview) {
*retv = (cmdnames[eap->cmdidx].cmd_preview_func)(eap, (int)cmdpreview_get_ns(), *retv = (cmdnames[eap->cmdidx].cmd_preview_func)(eap, cmdpreview_get_ns(),
cmdpreview_get_bufnr()); cmdpreview_get_bufnr());
} else { } else {
(cmdnames[eap->cmdidx].cmd_func)(eap); (cmdnames[eap->cmdidx].cmd_func)(eap);

View File

@ -2208,7 +2208,7 @@ handle_T cmdpreview_get_bufnr(void)
return cmdpreview_bufnr; return cmdpreview_bufnr;
} }
long cmdpreview_get_ns(void) int cmdpreview_get_ns(void)
{ {
return cmdpreview_ns; return cmdpreview_ns;
} }

View File

@ -615,7 +615,7 @@ void extmark_splice(buf_T *buf, int start_row, colnr_T start_col, int old_row, c
bcount_t old_byte, int new_row, colnr_T new_col, bcount_t new_byte, bcount_t old_byte, int new_row, colnr_T new_col, bcount_t new_byte,
ExtmarkOp undo) ExtmarkOp undo)
{ {
long offset = ml_find_line_or_offset(buf, start_row + 1, NULL, true); int offset = ml_find_line_or_offset(buf, start_row + 1, NULL, true);
// On empty buffers, when editing the first line, the line is buffered, // On empty buffers, when editing the first line, the line is buffered,
// causing offset to be < 0. While the buffer is not actually empty, the // causing offset to be < 0. While the buffer is not actually empty, the

View File

@ -212,7 +212,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
bool fenc_alloced; // fenc_next is in allocated memory bool fenc_alloced; // fenc_next is in allocated memory
char *fenc_next = NULL; // next item in 'fencs' or NULL char *fenc_next = NULL; // next item in 'fencs' or NULL
bool advance_fenc = false; bool advance_fenc = false;
long real_size = 0; int real_size = 0;
iconv_t iconv_fd = (iconv_t)-1; // descriptor for iconv() or -1 iconv_t iconv_fd = (iconv_t)-1; // descriptor for iconv() or -1
bool did_iconv = false; // true when iconv() failed and trying bool did_iconv = false; // true when iconv() failed and trying
// 'charconvert' next // 'charconvert' next
@ -947,11 +947,11 @@ retry:
size = 0; size = 0;
} else { } else {
int ni; int ni;
long tlen = 0; int tlen = 0;
while (true) { while (true) {
p = (uint8_t *)ml_get(read_buf_lnum) + read_buf_col; p = (uint8_t *)ml_get(read_buf_lnum) + read_buf_col;
int n = (int)strlen((char *)p); int n = (int)strlen((char *)p);
if ((int)tlen + n + 1 > size) { if (tlen + n + 1 > size) {
// Filled up to "size", append partial line. // Filled up to "size", append partial line.
// Change NL to NUL to reverse the effect done // Change NL to NUL to reverse the effect done
// below. // below.
@ -2177,7 +2177,8 @@ void msg_add_lines(int insert_space, linenr_T lnum, off_T nchars)
} }
} }
bool time_differs(const FileInfo *file_info, long mtime, long mtime_ns) FUNC_ATTR_CONST bool time_differs(const FileInfo *file_info, int64_t mtime, int64_t mtime_ns)
FUNC_ATTR_CONST
{ {
#if defined(__linux__) || defined(MSWIN) #if defined(__linux__) || defined(MSWIN)
return file_info->stat.st_mtim.tv_nsec != mtime_ns return file_info->stat.st_mtim.tv_nsec != mtime_ns
@ -2728,7 +2729,7 @@ int vim_rename(const char *from, const char *to)
} }
int n; int n;
while ((n = (int)read_eintr(fd_in, buffer, WRITEBUFSIZE)) > 0) { while ((n = read_eintr(fd_in, buffer, WRITEBUFSIZE)) > 0) {
if (write_eintr(fd_out, buffer, (size_t)n) != n) { if (write_eintr(fd_out, buffer, (size_t)n) != n) {
errmsg = _("E208: Error writing to \"%s\""); errmsg = _("E208: Error writing to \"%s\"");
break; break;
@ -2905,7 +2906,7 @@ int buf_check_timestamp(buf_T *buf)
&& (!(file_info_ok = os_fileinfo(buf->b_ffname, &file_info)) && (!(file_info_ok = os_fileinfo(buf->b_ffname, &file_info))
|| time_differs(&file_info, buf->b_mtime, buf->b_mtime_ns) || time_differs(&file_info, buf->b_mtime, buf->b_mtime_ns)
|| (int)file_info.stat.st_mode != buf->b_orig_mode)) { || (int)file_info.stat.st_mode != buf->b_orig_mode)) {
const int prev_b_mtime = (int)buf->b_mtime; const int64_t prev_b_mtime = buf->b_mtime;
retval = 1; retval = 1;
@ -3823,9 +3824,9 @@ char *file_pat_to_reg_pat(const char *pat, const char *pat_end, char *allow_dirs
/// Version of read() that retries when interrupted by EINTR (possibly /// Version of read() that retries when interrupted by EINTR (possibly
/// by a SIGWINCH). /// by a SIGWINCH).
long read_eintr(int fd, void *buf, size_t bufsize) int read_eintr(int fd, void *buf, size_t bufsize)
{ {
long ret; ssize_t ret;
while (true) { while (true) {
ret = read(fd, buf, (unsigned)bufsize); ret = read(fd, buf, (unsigned)bufsize);
@ -3833,25 +3834,25 @@ long read_eintr(int fd, void *buf, size_t bufsize)
break; break;
} }
} }
return ret; return (int)ret;
} }
/// Version of write() that retries when interrupted by EINTR (possibly /// Version of write() that retries when interrupted by EINTR (possibly
/// by a SIGWINCH). /// by a SIGWINCH).
long write_eintr(int fd, void *buf, size_t bufsize) int write_eintr(int fd, void *buf, size_t bufsize)
{ {
long ret = 0; int ret = 0;
// Repeat the write() so long it didn't fail, other than being interrupted // Repeat the write() so long it didn't fail, other than being interrupted
// by a signal. // by a signal.
while (ret < (long)bufsize) { while (ret < (int)bufsize) {
long wlen = write(fd, (char *)buf + ret, (unsigned)(bufsize - (size_t)ret)); ssize_t wlen = write(fd, (char *)buf + ret, (unsigned)(bufsize - (size_t)ret));
if (wlen < 0) { if (wlen < 0) {
if (errno != EINTR) { if (errno != EINTR) {
break; break;
} }
} else { } else {
ret += wlen; ret += (int)wlen;
} }
} }
return ret; return ret;

View File

@ -363,7 +363,7 @@ int foldmethodIsDiff(win_T *wp)
// closeFold() {{{2 // closeFold() {{{2
/// Close fold for current window at position "pos". /// Close fold for current window at position "pos".
/// Repeat "count" times. /// Repeat "count" times.
void closeFold(pos_T pos, long count) void closeFold(pos_T pos, int count)
{ {
setFoldRepeat(pos, count, false); setFoldRepeat(pos, count, false);
} }
@ -417,7 +417,7 @@ void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, int ha
// openFold() {{{2 // openFold() {{{2
/// Open fold for current window at position "pos". /// Open fold for current window at position "pos".
/// Repeat "count" times. /// Repeat "count" times.
void openFold(pos_T pos, long count) void openFold(pos_T pos, int count)
{ {
setFoldRepeat(pos, count, true); setFoldRepeat(pos, count, true);
} }
@ -847,7 +847,7 @@ void foldUpdateAll(win_T *win)
/// @return FAIL if not moved. /// @return FAIL if not moved.
/// ///
/// @param dir FORWARD or BACKWARD /// @param dir FORWARD or BACKWARD
int foldMoveTo(const bool updown, const int dir, const long count) int foldMoveTo(const bool updown, const int dir, const int count)
{ {
int retval = FAIL; int retval = FAIL;
linenr_T lnum; linenr_T lnum;
@ -856,7 +856,7 @@ int foldMoveTo(const bool updown, const int dir, const long count)
checkupdate(curwin); checkupdate(curwin);
// Repeat "count" times. // Repeat "count" times.
for (long n = 0; n < count; n++) { for (int n = 0; n < count; n++) {
// Find nested folds. Stop when a fold is closed. The deepest fold // Find nested folds. Stop when a fold is closed. The deepest fold
// that moves the cursor is used. // that moves the cursor is used.
linenr_T lnum_off = 0; linenr_T lnum_off = 0;
@ -1136,7 +1136,7 @@ static void checkupdate(win_T *wp)
// setFoldRepeat() {{{2 // setFoldRepeat() {{{2
/// Open or close fold for current window at position `pos`. /// Open or close fold for current window at position `pos`.
/// Repeat "count" times. /// Repeat "count" times.
static void setFoldRepeat(pos_T pos, long count, int do_open) static void setFoldRepeat(pos_T pos, int count, int do_open)
{ {
for (int n = 0; n < count; n++) { for (int n = 0; n < count; n++) {
int done = DONE_NOTHING; int done = DONE_NOTHING;
@ -1816,11 +1816,11 @@ char *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldinfo
} }
} }
if (text == NULL) { if (text == NULL) {
long count = lnume - lnum + 1; int count = lnume - lnum + 1;
vim_snprintf(buf, FOLD_TEXT_LEN, vim_snprintf(buf, FOLD_TEXT_LEN,
NGETTEXT("+--%3ld line folded", NGETTEXT("+--%3d line folded",
"+--%3ld lines folded ", count), "+--%3d lines folded ", count),
count); count);
text = buf; text = buf;
} }
@ -3304,8 +3304,8 @@ void f_foldtext(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
} }
} }
} }
long count = foldend - foldstart + 1; int count = foldend - foldstart + 1;
char *txt = NGETTEXT("+-%s%3ld line: ", "+-%s%3ld lines: ", count); char *txt = NGETTEXT("+-%s%3d line: ", "+-%s%3d lines: ", count);
size_t len = strlen(txt) size_t len = strlen(txt)
+ strlen(dashes) // for %s + strlen(dashes) // for %s
+ 20 // for %3ld + 20 // for %3ld

View File

@ -108,7 +108,7 @@ static pos_T *ind_find_start_CORS(linenr_T *is_raw)
static pos_T *find_start_rawstring(int ind_maxcomment) // XXX static pos_T *find_start_rawstring(int ind_maxcomment) // XXX
{ {
pos_T *pos; pos_T *pos;
long cur_maxcomment = ind_maxcomment; int cur_maxcomment = ind_maxcomment;
while (true) { while (true) {
pos = findmatchlimit(NULL, 'R', FM_BACKWARD, cur_maxcomment); pos = findmatchlimit(NULL, 'R', FM_BACKWARD, cur_maxcomment);
@ -1508,10 +1508,10 @@ static pos_T *find_match_paren_after_brace(int ind_maxparen)
// looking a few lines further. // looking a few lines further.
static int corr_ind_maxparen(pos_T *startpos) static int corr_ind_maxparen(pos_T *startpos)
{ {
long n = (long)startpos->lnum - (long)curwin->w_cursor.lnum; int n = startpos->lnum - curwin->w_cursor.lnum;
if (n > 0 && n < curbuf->b_ind_maxparen / 2) { if (n > 0 && n < curbuf->b_ind_maxparen / 2) {
return curbuf->b_ind_maxparen - (int)n; return curbuf->b_ind_maxparen - n;
} }
return curbuf->b_ind_maxparen; return curbuf->b_ind_maxparen;
} }

View File

@ -144,9 +144,9 @@ static int count_n_matched_chars(const char **sp, const size_t n, bool iwhite)
return matched_chars; return matched_chars;
} }
void fastforward_buf_to_lnum(const char **s, long lnum) void fastforward_buf_to_lnum(const char **s, linenr_T lnum)
{ {
for (long i = 0; i < lnum - 1; i++) { for (int i = 0; i < lnum - 1; i++) {
*s = strchr(*s, '\n'); *s = strchr(*s, '\n');
if (!*s) { if (!*s) {
return; return;

View File

@ -3,6 +3,8 @@
#include <stddef.h> #include <stddef.h>
#include "nvim/pos.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "linematch.h.generated.h" # include "linematch.h.generated.h"
#endif #endif

View File

@ -694,7 +694,7 @@ static int parser_get_timeout(lua_State *L)
return 0; return 0;
} }
lua_pushinteger(L, (long)ts_parser_timeout_micros(*p)); lua_pushinteger(L, (lua_Integer)ts_parser_timeout_micros(*p));
return 1; return 1;
} }

View File

@ -71,8 +71,8 @@ static void get_linematch_results(lua_State *lstate, mmfile_t *ma, mmfile_t *mb,
const char *diff_begin[2] = { ma->ptr, mb->ptr }; const char *diff_begin[2] = { ma->ptr, mb->ptr };
int diff_length[2] = { (int)count_a, (int)count_b }; int diff_length[2] = { (int)count_a, (int)count_b };
fastforward_buf_to_lnum(&diff_begin[0], start_a + 1); fastforward_buf_to_lnum(&diff_begin[0], (linenr_T)start_a + 1);
fastforward_buf_to_lnum(&diff_begin[1], start_b + 1); fastforward_buf_to_lnum(&diff_begin[1], (linenr_T)start_b + 1);
int *decisions = NULL; int *decisions = NULL;
size_t decisions_length = linematch_nbuffers(diff_begin, diff_length, 2, &decisions, iwhite); size_t decisions_length = linematch_nbuffers(diff_begin, diff_length, 2, &decisions, iwhite);
@ -125,7 +125,7 @@ static int write_string(void *priv, mmbuffer_t *mb, int nbuf)
} }
// hunk_func callback used when opts.hunk_lines = true // hunk_func callback used when opts.hunk_lines = true
static int hunk_locations_cb(long start_a, long count_a, long start_b, long count_b, void *cb_data) static int hunk_locations_cb(int start_a, int count_a, int start_b, int count_b, void *cb_data)
{ {
hunkpriv_t *priv = (hunkpriv_t *)cb_data; hunkpriv_t *priv = (hunkpriv_t *)cb_data;
lua_State *lstate = priv->lstate; lua_State *lstate = priv->lstate;
@ -140,7 +140,7 @@ static int hunk_locations_cb(long start_a, long count_a, long start_b, long coun
} }
// hunk_func callback used when opts.on_hunk is given // hunk_func callback used when opts.on_hunk is given
static int call_on_hunk_cb(long start_a, long count_a, long start_b, long count_b, void *cb_data) static int call_on_hunk_cb(int start_a, int count_a, int start_b, int count_b, void *cb_data)
{ {
// Mimic extra offsets done by xdiff, see: // Mimic extra offsets done by xdiff, see:
// src/xdiff/xemit.c:284 // src/xdiff/xemit.c:284

View File

@ -2074,7 +2074,7 @@ void f_hasmapto(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// ///
/// @return A Dictionary. /// @return A Dictionary.
static Dictionary mapblock_fill_dict(const mapblock_T *const mp, const char *lhsrawalt, static Dictionary mapblock_fill_dict(const mapblock_T *const mp, const char *lhsrawalt,
const long buffer_value, const bool compatible) const int buffer_value, const bool compatible)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
Dictionary dict = ARRAY_DICT_INIT; Dictionary dict = ARRAY_DICT_INIT;
@ -2694,7 +2694,7 @@ ArrayOf(Dictionary) keymap_array(String mode, buf_T *buf)
int int_mode = get_map_mode(&p, 0); int int_mode = get_map_mode(&p, 0);
// Determine the desired buffer value // Determine the desired buffer value
long buffer_value = (buf == NULL) ? 0 : buf->handle; int buffer_value = (buf == NULL) ? 0 : buf->handle;
for (int i = 0; i < MAX_MAPHASH; i++) { for (int i = 0; i < MAX_MAPHASH; i++) {
for (const mapblock_T *current_maphash = get_maphash(i, buf); for (const mapblock_T *current_maphash = get_maphash(i, buf);

View File

@ -1315,7 +1315,7 @@ void mark_adjust_buf(buf_T *buf, linenr_T line1, linenr_T line2, linenr_T amount
// position. // position.
// "spaces_removed" is the number of spaces that were removed, matters when the // "spaces_removed" is the number of spaces that were removed, matters when the
// cursor is inside them. // cursor is inside them.
void mark_col_adjust(linenr_T lnum, colnr_T mincol, linenr_T lnum_amount, long col_amount, void mark_col_adjust(linenr_T lnum, colnr_T mincol, linenr_T lnum_amount, colnr_T col_amount,
int spaces_removed) int spaces_removed)
{ {
int fnum = curbuf->b_fnum; int fnum = curbuf->b_fnum;

View File

@ -419,7 +419,7 @@ static void next_search_hl(win_T *win, match_T *search_hl, match_T *shl, linenr_
FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_NONNULL_ARG(2)
{ {
colnr_T matchcol; colnr_T matchcol;
long nmatched = 0; int nmatched = 0;
const int called_emsg_before = called_emsg; const int called_emsg_before = called_emsg;
// for :{range}s/pat only highlight inside the range // for :{range}s/pat only highlight inside the range

View File

@ -2396,7 +2396,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
} }
// The line was inserted below 'lnum' // The line was inserted below 'lnum'
ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE); ml_updatechunk(buf, lnum + 1, len, ML_CHNK_ADDLINE);
return OK; return OK;
} }
@ -2546,11 +2546,11 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
buf->b_ml.ml_line_count--; buf->b_ml.ml_line_count--;
int line_start = ((dp->db_index[idx]) & DB_INDEX_MASK); int line_start = ((dp->db_index[idx]) & DB_INDEX_MASK);
long line_size; int line_size;
if (idx == 0) { // first line in block, text at the end if (idx == 0) { // first line in block, text at the end
line_size = dp->db_txt_end - (unsigned)line_start; line_size = (int)(dp->db_txt_end - (unsigned)line_start);
} else { } else {
line_size = ((dp->db_index[idx - 1]) & DB_INDEX_MASK) - (unsigned)line_start; line_size = (int)(((dp->db_index[idx - 1]) & DB_INDEX_MASK) - (unsigned)line_start);
} }
// Line should always have an NL char internally (represented as NUL), // Line should always have an NL char internally (represented as NUL),
@ -2788,7 +2788,7 @@ static void ml_flush_line(buf_T *buf)
memmove(old_line - extra, new_line, (size_t)new_len); memmove(old_line - extra, new_line, (size_t)new_len);
buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS); buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
// The else case is already covered by the insert and delete // The else case is already covered by the insert and delete
ml_updatechunk(buf, lnum, (long)extra, ML_CHNK_UPDLINE); ml_updatechunk(buf, lnum, extra, ML_CHNK_UPDLINE);
} else { } else {
// Cannot do it in one data block: Delete and append. // Cannot do it in one data block: Delete and append.
// Append first, because ml_delete_int() cannot delete the // Append first, because ml_delete_int() cannot delete the
@ -3705,7 +3705,7 @@ enum {
/// Careful: ML_CHNK_ADDLINE may cause ml_find_line() to be called. /// Careful: ML_CHNK_ADDLINE may cause ml_find_line() to be called.
/// ML_CHNK_DELLINE: Subtract len from parent chunk, possibly deleting it /// ML_CHNK_DELLINE: Subtract len from parent chunk, possibly deleting it
/// ML_CHNK_UPDLINE: Add len to parent chunk, as a signed entity. /// ML_CHNK_UPDLINE: Add len to parent chunk, as a signed entity.
static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype) static void ml_updatechunk(buf_T *buf, linenr_T line, int len, int updtype)
{ {
static buf_T *ml_upd_lastbuf = NULL; static buf_T *ml_upd_lastbuf = NULL;
static linenr_T ml_upd_lastline; static linenr_T ml_upd_lastline;
@ -3732,8 +3732,7 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
// First line in empty buffer from ml_flush_line() -- reset // First line in empty buffer from ml_flush_line() -- reset
buf->b_ml.ml_usedchunks = 1; buf->b_ml.ml_usedchunks = 1;
buf->b_ml.ml_chunksize[0].mlcs_numlines = 1; buf->b_ml.ml_chunksize[0].mlcs_numlines = 1;
buf->b_ml.ml_chunksize[0].mlcs_totalsize = buf->b_ml.ml_chunksize[0].mlcs_totalsize = (int)strlen(buf->b_ml.ml_line_ptr) + 1;
(long)strlen(buf->b_ml.ml_line_ptr) + 1;
return; return;
} }
@ -3779,7 +3778,7 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
buf->b_ml.ml_chunksize + curix, buf->b_ml.ml_chunksize + curix,
(size_t)(buf->b_ml.ml_usedchunks - curix) * sizeof(chunksize_T)); (size_t)(buf->b_ml.ml_usedchunks - curix) * sizeof(chunksize_T));
// Compute length of first half of lines in the split chunk // Compute length of first half of lines in the split chunk
long size = 0; int size = 0;
int linecnt = 0; int linecnt = 0;
while (curline < buf->b_ml.ml_line_count while (curline < buf->b_ml.ml_line_count
&& linecnt < MLCS_MINL) { && linecnt < MLCS_MINL) {
@ -3893,14 +3892,14 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
/// @param no_ff ignore 'fileformat' option, always use one byte for NL. /// @param no_ff ignore 'fileformat' option, always use one byte for NL.
/// ///
/// @return -1 if information is not available /// @return -1 if information is not available
long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp, bool no_ff) int ml_find_line_or_offset(buf_T *buf, linenr_T lnum, int *offp, bool no_ff)
{ {
linenr_T curline; linenr_T curline;
int curix; int curix;
long size; int size;
bhdr_T *hp; bhdr_T *hp;
int text_end; int text_end;
long offset; int offset;
int ffdos = !no_ff && (get_fileformat(buf) == EOL_DOS); int ffdos = !no_ff && (get_fileformat(buf) == EOL_DOS);
int extra = 0; int extra = 0;
@ -3918,7 +3917,7 @@ long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp, bool no_ff)
if (lnum == 0 || buf->b_ml.ml_line_lnum < lnum || !no_ff) { if (lnum == 0 || buf->b_ml.ml_line_lnum < lnum || !no_ff) {
ml_flush_line(curbuf); ml_flush_line(curbuf);
} else if (can_cache && buf->b_ml.ml_line_offset > 0) { } else if (can_cache && buf->b_ml.ml_line_offset > 0) {
return (long)buf->b_ml.ml_line_offset; return (int)buf->b_ml.ml_line_offset;
} }
if (buf->b_ml.ml_usedchunks == -1 if (buf->b_ml.ml_usedchunks == -1
@ -3951,7 +3950,7 @@ long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp, bool no_ff)
|| (offset != 0 || (offset != 0
&& offset > size + && offset > size +
buf->b_ml.ml_chunksize[curix].mlcs_totalsize buf->b_ml.ml_chunksize[curix].mlcs_totalsize
+ (long)ffdos * buf->b_ml.ml_chunksize[curix].mlcs_numlines))) { + ffdos * buf->b_ml.ml_chunksize[curix].mlcs_numlines))) {
curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines;
size += buf->b_ml.ml_chunksize[curix].mlcs_totalsize; size += buf->b_ml.ml_chunksize[curix].mlcs_totalsize;
if (offset && ffdos) { if (offset && ffdos) {
@ -4039,9 +4038,9 @@ long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp, bool no_ff)
} }
/// Goto byte in buffer with offset 'cnt'. /// Goto byte in buffer with offset 'cnt'.
void goto_byte(long cnt) void goto_byte(int cnt)
{ {
long boff = cnt; int boff = cnt;
ml_flush_line(curbuf); // cached line may be dirty ml_flush_line(curbuf); // cached line may be dirty
setpcmark(); setpcmark();

View File

@ -17,7 +17,7 @@ typedef struct info_pointer {
typedef struct ml_chunksize { typedef struct ml_chunksize {
int mlcs_numlines; int mlcs_numlines;
long mlcs_totalsize; int mlcs_totalsize;
} chunksize_T; } chunksize_T;
// Flags when calling ml_updatechunk() // Flags when calling ml_updatechunk()

View File

@ -78,7 +78,7 @@ void ex_menu(exarg_T *eap)
char *arg; char *arg;
char *p; char *p;
int i; int i;
long pri_tab[MENUDEPTH + 1]; int pri_tab[MENUDEPTH + 1];
TriState enable = kNone; // kTrue for "menu enable", TriState enable = kNone; // kTrue for "menu enable",
// kFalse for "menu disable // kFalse for "menu disable
vimmenu_T menuarg; vimmenu_T menuarg;
@ -129,7 +129,7 @@ void ex_menu(exarg_T *eap)
} }
if (ascii_iswhite(*p)) { if (ascii_iswhite(*p)) {
for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); i++) { for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); i++) {
pri_tab[i] = getdigits_long(&arg, false, 0); pri_tab[i] = getdigits_int(&arg, false, 0);
if (pri_tab[i] == 0) { if (pri_tab[i] == 0) {
pri_tab[i] = 500; pri_tab[i] = 500;
} }
@ -265,7 +265,7 @@ theend:
/// @param[out] menuarg menu entry /// @param[out] menuarg menu entry
/// @param[] pri_tab priority table /// @param[] pri_tab priority table
/// @param[in] call_data Right hand side command /// @param[in] call_data Right hand side command
static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const long *const pri_tab, static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const int *const pri_tab,
const char *const call_data) const char *const call_data)
{ {
char *path_name; char *path_name;
@ -366,7 +366,7 @@ static int add_menu_path(const char *const menu_path, vimmenu_T *menuarg, const
menu->en_name = NULL; menu->en_name = NULL;
menu->en_dname = NULL; menu->en_dname = NULL;
} }
menu->priority = (int)pri_tab[pri_idx]; menu->priority = pri_tab[pri_idx];
menu->parent = parent; menu->parent = parent;
// Add after menu that has lower priority. // Add after menu that has lower priority.

View File

@ -567,10 +567,10 @@ static char *get_emsg_lnum(void)
if (SOURCING_NAME != NULL if (SOURCING_NAME != NULL
&& (other_sourcing_name() || SOURCING_LNUM != last_sourcing_lnum) && (other_sourcing_name() || SOURCING_LNUM != last_sourcing_lnum)
&& SOURCING_LNUM != 0) { && SOURCING_LNUM != 0) {
const char *const p = _("line %4ld:"); const char *const p = _("line %4" PRIdLINENR ":");
const size_t buf_len = 20 + strlen(p); const size_t buf_len = 20 + strlen(p);
char *const buf = xmalloc(buf_len); char *const buf = xmalloc(buf_len);
snprintf(buf, buf_len, p, (long)SOURCING_LNUM); snprintf(buf, buf_len, p, SOURCING_LNUM);
return buf; return buf;
} }
return NULL; return NULL;
@ -693,8 +693,8 @@ bool emsg_multiline(const char *s, bool multiline)
// Log (silent) errors as debug messages. // Log (silent) errors as debug messages.
if (SOURCING_NAME != NULL && SOURCING_LNUM != 0) { if (SOURCING_NAME != NULL && SOURCING_LNUM != 0) {
DLOG("(:silent) %s (%s (line %ld))", DLOG("(:silent) %s (%s (line %" PRIdLINENR "))",
s, SOURCING_NAME, (long)SOURCING_LNUM); s, SOURCING_NAME, SOURCING_LNUM);
} else { } else {
DLOG("(:silent) %s", s); DLOG("(:silent) %s", s);
} }
@ -704,7 +704,7 @@ bool emsg_multiline(const char *s, bool multiline)
// Log editor errors as INFO. // Log editor errors as INFO.
if (SOURCING_NAME != NULL && SOURCING_LNUM != 0) { if (SOURCING_NAME != NULL && SOURCING_LNUM != 0) {
ILOG("%s (%s (line %ld))", s, SOURCING_NAME, (long)SOURCING_LNUM); ILOG("%s (%s (line %" PRIdLINENR "))", s, SOURCING_NAME, SOURCING_LNUM);
} else { } else {
ILOG("%s", s); ILOG("%s", s);
} }
@ -1357,7 +1357,7 @@ bool messaging(void)
void msgmore(int n) void msgmore(int n)
{ {
long pn; int pn;
if (global_busy // no messages now, wait until global is finished if (global_busy // no messages now, wait until global is finished
|| !messaging()) { // 'lazyredraw' set, don't do messages now || !messaging()) { // 'lazyredraw' set, don't do messages now
@ -1380,11 +1380,11 @@ void msgmore(int n)
if (pn > p_report) { if (pn > p_report) {
if (n > 0) { if (n > 0) {
vim_snprintf(msg_buf, MSG_BUF_LEN, vim_snprintf(msg_buf, MSG_BUF_LEN,
NGETTEXT("%ld more line", "%ld more lines", pn), NGETTEXT("%d more line", "%d more lines", pn),
pn); pn);
} else { } else {
vim_snprintf(msg_buf, MSG_BUF_LEN, vim_snprintf(msg_buf, MSG_BUF_LEN,
NGETTEXT("%ld line less", "%ld fewer lines", pn), NGETTEXT("%d line less", "%d fewer lines", pn),
pn); pn);
} }
if (got_int) { if (got_int) {

View File

@ -340,9 +340,7 @@ void update_topline(win_T *wp)
assert(wp->w_buffer != 0); assert(wp->w_buffer != 0);
if (wp->w_botline <= wp->w_buffer->b_ml.ml_line_count) { if (wp->w_botline <= wp->w_buffer->b_ml.ml_line_count) {
if (wp->w_cursor.lnum < wp->w_botline) { if (wp->w_cursor.lnum < wp->w_botline) {
if (((long)wp->w_cursor.lnum if ((wp->w_cursor.lnum >= wp->w_botline - *so_ptr || hasAnyFolding(wp))) {
>= (long)wp->w_botline - *so_ptr
|| hasAnyFolding(wp))) {
lineoff_T loff; lineoff_T loff;
// Cursor is (a few lines) above botline, check if there are // Cursor is (a few lines) above botline, check if there are
@ -1188,7 +1186,7 @@ void f_virtcol2col(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// ///
/// @param line_count number of lines to scroll /// @param line_count number of lines to scroll
/// @param byfold if true, count a closed fold as one line /// @param byfold if true, count a closed fold as one line
bool scrolldown(long line_count, int byfold) bool scrolldown(linenr_T line_count, int byfold)
{ {
int done = 0; // total # of physical lines done int done = 0; // total # of physical lines done
int width1 = 0; int width1 = 0;
@ -1203,7 +1201,7 @@ bool scrolldown(long line_count, int byfold)
// Make sure w_topline is at the first of a sequence of folded lines. // Make sure w_topline is at the first of a sequence of folded lines.
(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
validate_cursor(); // w_wrow needs to be valid validate_cursor(); // w_wrow needs to be valid
for (long todo = line_count; todo > 0; todo--) { for (int todo = line_count; todo > 0; todo--) {
if (curwin->w_topfill < win_get_fill(curwin, curwin->w_topline) if (curwin->w_topfill < win_get_fill(curwin, curwin->w_topline)
&& curwin->w_topfill < curwin->w_height_inner - 1) { && curwin->w_topfill < curwin->w_height_inner - 1) {
curwin->w_topfill++; curwin->w_topfill++;
@ -1301,11 +1299,11 @@ bool scrolldown(long line_count, int byfold)
if (curwin->w_cursor.lnum == curwin->w_topline && do_sms) { if (curwin->w_cursor.lnum == curwin->w_topline && do_sms) {
int so = get_scrolloff_value(curwin); int so = get_scrolloff_value(curwin);
long scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2; colnr_T scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
// make sure the cursor is in the visible text // make sure the cursor is in the visible text
validate_virtcol(); validate_virtcol();
long col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols; colnr_T col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0; int row = 0;
if (col >= width1) { if (col >= width1) {
col -= width1; col -= width1;
@ -1346,7 +1344,7 @@ bool scrollup(linenr_T line_count, int byfold)
// 'smoothscroll': increase "w_skipcol" until it goes over the end of // 'smoothscroll': increase "w_skipcol" until it goes over the end of
// the line, then advance to the next line. // the line, then advance to the next line.
// folding: count each sequence of folded lines as one logical line. // folding: count each sequence of folded lines as one logical line.
for (long todo = line_count; todo > 0; todo--) { for (int todo = line_count; todo > 0; todo--) {
if (curwin->w_topfill > 0) { if (curwin->w_topfill > 0) {
curwin->w_topfill--; curwin->w_topfill--;
} else { } else {
@ -1428,7 +1426,7 @@ bool scrollup(linenr_T line_count, int byfold)
int width2 = width1 + col_off2; int width2 = width1 + col_off2;
int extra2 = col_off - col_off2; int extra2 = col_off - col_off2;
int so = get_scrolloff_value(curwin); int so = get_scrolloff_value(curwin);
long scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2; colnr_T scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
int space_cols = (curwin->w_height_inner - 1) * width2; int space_cols = (curwin->w_height_inner - 1) * width2;
// If we have non-zero scrolloff, just ignore the marker as we are // If we have non-zero scrolloff, just ignore the marker as we are
@ -1479,7 +1477,7 @@ void adjust_skipcol(void)
} }
int width2 = width1 + curwin_col_off2(); int width2 = width1 + curwin_col_off2();
int so = get_scrolloff_value(curwin); int so = get_scrolloff_value(curwin);
long scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2; colnr_T scrolloff_cols = so == 0 ? 0 : width1 + (so - 1) * width2;
bool scrolled = false; bool scrolled = false;
validate_cheight(); validate_cheight();
@ -1509,7 +1507,7 @@ void adjust_skipcol(void)
redraw_later(curwin, UPD_NOT_VALID); redraw_later(curwin, UPD_NOT_VALID);
return; // don't scroll in the other direction now return; // don't scroll in the other direction now
} }
long col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols; colnr_T col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0; int row = 0;
if (col >= width1) { if (col >= width1) {
col -= width1; col -= width1;
@ -2317,9 +2315,9 @@ void cursor_correct(void)
/// and update the screen. /// and update the screen.
/// ///
/// @return FAIL for failure, OK otherwise. /// @return FAIL for failure, OK otherwise.
int onepage(Direction dir, long count) int onepage(Direction dir, int count)
{ {
long n; int n;
int retval = OK; int retval = OK;
lineoff_T loff; lineoff_T loff;
linenr_T old_topline = curwin->w_topline; linenr_T old_topline = curwin->w_topline;
@ -2560,7 +2558,7 @@ static void get_scroll_overlap(lineoff_T *lp, int dir)
// Scroll 'scroll' lines up or down. // Scroll 'scroll' lines up or down.
void halfpage(bool flag, linenr_T Prenum) void halfpage(bool flag, linenr_T Prenum)
{ {
long scrolled = 0; int scrolled = 0;
int i; int i;
if (Prenum) { if (Prenum) {

View File

@ -1496,7 +1496,7 @@ static int normal_check(VimState *state)
/// Set v:prevcount only when "set_prevcount" is true. /// Set v:prevcount only when "set_prevcount" is true.
static void set_vcount_ca(cmdarg_T *cap, bool *set_prevcount) static void set_vcount_ca(cmdarg_T *cap, bool *set_prevcount)
{ {
long count = cap->count0; int64_t count = cap->count0;
// multiply with cap->opcount the same way as above // multiply with cap->opcount the same way as above
if (cap->opcount != 0) { if (cap->opcount != 0) {
@ -1856,7 +1856,7 @@ void clear_showcmd(void)
if (VIsual_active && !char_avail()) { if (VIsual_active && !char_avail()) {
int cursor_bot = lt(VIsual, curwin->w_cursor); int cursor_bot = lt(VIsual, curwin->w_cursor);
long lines; int lines;
colnr_T leftcol, rightcol; colnr_T leftcol, rightcol;
linenr_T top, bot; linenr_T top, bot;
@ -2115,8 +2115,7 @@ void do_check_scrollbind(bool check)
&& (curwin->w_topline != old_topline && (curwin->w_topline != old_topline
|| curwin->w_topfill != old_topfill || curwin->w_topfill != old_topfill
|| curwin->w_leftcol != old_leftcol)) { || curwin->w_leftcol != old_leftcol)) {
check_scrollbind(curwin->w_topline - old_topline, check_scrollbind(curwin->w_topline - old_topline, curwin->w_leftcol - old_leftcol);
(long)(curwin->w_leftcol - old_leftcol));
} }
} else if (vim_strchr(p_sbo, 'j')) { // jump flag set in 'scrollopt' } else if (vim_strchr(p_sbo, 'j')) { // jump flag set in 'scrollopt'
// When switching between windows, make sure that the relative // When switching between windows, make sure that the relative
@ -2142,7 +2141,7 @@ void do_check_scrollbind(bool check)
/// Synchronize any windows that have "scrollbind" set, based on the /// Synchronize any windows that have "scrollbind" set, based on the
/// number of rows by which the current window has changed /// number of rows by which the current window has changed
/// (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>) /// (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>)
void check_scrollbind(linenr_T topline_diff, long leftcol_diff) void check_scrollbind(linenr_T topline_diff, int leftcol_diff)
{ {
bool want_ver; bool want_ver;
bool want_hor; bool want_hor;
@ -2468,7 +2467,7 @@ bool find_decl(char *ptr, size_t len, bool locally, bool thisblock, int flags_ar
/// 'dist' must be positive. /// 'dist' must be positive.
/// ///
/// @return true if able to move cursor, false otherwise. /// @return true if able to move cursor, false otherwise.
static bool nv_screengo(oparg_T *oap, int dir, long dist) static bool nv_screengo(oparg_T *oap, int dir, int dist)
{ {
int linelen = (int)linetabsize(curwin, curwin->w_cursor.lnum); int linelen = (int)linetabsize(curwin, curwin->w_cursor.lnum);
bool retval = true; bool retval = true;
@ -2784,7 +2783,7 @@ static void nv_zet(cmdarg_T *cap)
{ {
colnr_T col; colnr_T col;
int nchar = cap->nchar; int nchar = cap->nchar;
long old_fdl = (long)curwin->w_p_fdl; int old_fdl = (int)curwin->w_p_fdl;
int old_fen = curwin->w_p_fen; int old_fen = curwin->w_p_fen;
int siso = get_sidescrolloff_value(curwin); int siso = get_sidescrolloff_value(curwin);

View File

@ -2202,7 +2202,7 @@ bool swapchar(int op_type, pos_T *pos)
} }
/// Insert and append operators for Visual mode. /// Insert and append operators for Visual mode.
void op_insert(oparg_T *oap, long count1) void op_insert(oparg_T *oap, int count1)
{ {
int pre_textlen = 0; int pre_textlen = 0;
char *firstline; char *firstline;
@ -2491,7 +2491,7 @@ int op_change(oparg_T *oap)
ins_len = (int)strlen(firstline) - pre_textlen; ins_len = (int)strlen(firstline) - pre_textlen;
if (ins_len > 0) { if (ins_len > 0) {
long offset; int offset;
char *newp; char *newp;
char *oldp; char *oldp;
// Subsequent calls to ml_get() flush the firstline data - take a // Subsequent calls to ml_get() flush the firstline data - take a
@ -2932,7 +2932,7 @@ void do_put(int regname, yankreg_T *reg, int dir, int count, int flags)
pos_T old_pos; pos_T old_pos;
char *insert_string = NULL; char *insert_string = NULL;
bool allocated = false; bool allocated = false;
long cnt; int cnt;
const pos_T orig_start = curbuf->b_op_start; const pos_T orig_start = curbuf->b_op_start;
const pos_T orig_end = curbuf->b_op_end; const pos_T orig_end = curbuf->b_op_end;
unsigned cur_ve_flags = get_ve_flags(); unsigned cur_ve_flags = get_ve_flags();
@ -3334,7 +3334,7 @@ void do_put(int regname, yankreg_T *reg, int dir, int count, int flags)
ptr += bd.startspaces; ptr += bd.startspaces;
// insert the new text // insert the new text
for (long j = 0; j < count; j++) { for (int j = 0; j < count; j++) {
memmove(ptr, y_array[i], (size_t)yanklen); memmove(ptr, y_array[i], (size_t)yanklen);
ptr += yanklen; ptr += yanklen;
@ -5339,7 +5339,7 @@ void cursor_pos_info(dict_T *dict)
linenr_T lnum; linenr_T lnum;
int eol_size; int eol_size;
varnumber_T last_check = 100000L; varnumber_T last_check = 100000L;
long line_count_selected = 0; int line_count_selected = 0;
if (get_fileformat(curbuf) == EOL_DOS) { if (get_fileformat(curbuf) == EOL_DOS) {
eol_size = 2; eol_size = 2;
} else { } else {
@ -5398,7 +5398,7 @@ void cursor_pos_info(dict_T *dict)
if (l_VIsual_active if (l_VIsual_active
&& lnum >= min_pos.lnum && lnum <= max_pos.lnum) { && lnum >= min_pos.lnum && lnum <= max_pos.lnum) {
char *s = NULL; char *s = NULL;
long len = 0L; int len = 0L;
switch (l_VIsual_mode) { switch (l_VIsual_mode) {
case Ctrl_V: case Ctrl_V:
@ -5406,7 +5406,7 @@ void cursor_pos_info(dict_T *dict)
block_prep(&oparg, &bd, lnum, false); block_prep(&oparg, &bd, lnum, false);
virtual_op = kNone; virtual_op = kNone;
s = bd.textstart; s = bd.textstart;
len = (long)bd.textlen; len = bd.textlen;
break; break;
case 'V': case 'V':
s = ml_get(lnum); s = ml_get(lnum);
@ -5429,7 +5429,7 @@ void cursor_pos_info(dict_T *dict)
if (lnum == curbuf->b_ml.ml_line_count if (lnum == curbuf->b_ml.ml_line_count
&& !curbuf->b_p_eol && !curbuf->b_p_eol
&& (curbuf->b_p_bin || !curbuf->b_p_fixeol) && (curbuf->b_p_bin || !curbuf->b_p_fixeol)
&& (long)strlen(s) < len) { && (int)strlen(s) < len) {
byte_count_cursor -= eol_size; byte_count_cursor -= eol_size;
} }
} }

View File

@ -131,7 +131,7 @@ typedef struct qf_list_S {
bool qf_multiline; bool qf_multiline;
bool qf_multiignore; bool qf_multiignore;
bool qf_multiscan; bool qf_multiscan;
long qf_changedtick; int qf_changedtick;
} qf_list_T; } qf_list_T;
/// Quickfix/Location list stack definition /// Quickfix/Location list stack definition
@ -234,7 +234,7 @@ typedef struct {
/// :vimgrep command arguments /// :vimgrep command arguments
typedef struct vgr_args_S { typedef struct vgr_args_S {
long tomatch; ///< maximum number of matches to find int tomatch; ///< maximum number of matches to find
char *spat; ///< search pattern char *spat; ///< search pattern
int flags; ///< search modifier int flags; ///< search modifier
char **fnames; ///< list of files to search char **fnames; ///< list of files to search
@ -2756,7 +2756,7 @@ static int qf_jump_edit_buffer(qf_info_T *qi, qfline_T *qf_ptr, int forceit, int
int *opened_window) int *opened_window)
{ {
qf_list_T *qfl = qf_get_curlist(qi); qf_list_T *qfl = qf_get_curlist(qi);
long old_changetick = qfl->qf_changedtick; int old_changetick = qfl->qf_changedtick;
int old_qf_curlist = qi->qf_curlist; int old_qf_curlist = qi->qf_curlist;
qfltype_T qfl_type = qfl->qfl_type; qfltype_T qfl_type = qfl->qfl_type;
int retval = OK; int retval = OK;
@ -2836,7 +2836,7 @@ static void qf_jump_goto_line(linenr_T qf_lnum, int qf_col, char qf_viscol, char
// Move the cursor to the first line in the buffer // Move the cursor to the first line in the buffer
pos_T save_cursor = curwin->w_cursor; pos_T save_cursor = curwin->w_cursor;
curwin->w_cursor.lnum = 0; curwin->w_cursor.lnum = 0;
if (!do_search(NULL, '/', '/', qf_pattern, (long)1, SEARCH_KEEP, NULL)) { if (!do_search(NULL, '/', '/', qf_pattern, 1, SEARCH_KEEP, NULL)) {
curwin->w_cursor = save_cursor; curwin->w_cursor = save_cursor;
} }
} }
@ -2891,7 +2891,7 @@ static void qf_jump_print_msg(qf_info_T *qi, int qf_index, qfline_T *qf_ptr, buf
static int qf_jump_open_window(qf_info_T *qi, qfline_T *qf_ptr, bool newwin, int *opened_window) static int qf_jump_open_window(qf_info_T *qi, qfline_T *qf_ptr, bool newwin, int *opened_window)
{ {
qf_list_T *qfl = qf_get_curlist(qi); qf_list_T *qfl = qf_get_curlist(qi);
long old_changetick = qfl->qf_changedtick; int old_changetick = qfl->qf_changedtick;
int old_qf_curlist = qi->qf_curlist; int old_qf_curlist = qi->qf_curlist;
qfltype_T qfl_type = qfl->qfl_type; qfltype_T qfl_type = qfl->qfl_type;
@ -4051,7 +4051,7 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
// Call the 'quickfixtextfunc' function to get the list of lines to display in // Call the 'quickfixtextfunc' function to get the list of lines to display in
// the quickfix window for the entries 'start_idx' to 'end_idx'. // the quickfix window for the entries 'start_idx' to 'end_idx'.
static list_T *call_qftf_func(qf_list_T *qfl, int qf_winid, long start_idx, long end_idx) static list_T *call_qftf_func(qf_list_T *qfl, int qf_winid, int start_idx, int end_idx)
{ {
Callback *cb = &qftf_cb; Callback *cb = &qftf_cb;
list_T *qftf_list = NULL; list_T *qftf_list = NULL;
@ -4142,7 +4142,7 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last, int q
lnum = buf->b_ml.ml_line_count; lnum = buf->b_ml.ml_line_count;
} }
list_T *qftf_list = call_qftf_func(qfl, qf_winid, lnum + 1, (long)qfl->qf_count); list_T *qftf_list = call_qftf_func(qfl, qf_winid, lnum + 1, qfl->qf_count);
listitem_T *qftf_li = tv_list_first(qftf_list); listitem_T *qftf_li = tv_list_first(qftf_list);
int prev_bufnr = -1; int prev_bufnr = -1;
@ -5227,7 +5227,7 @@ static bool vgr_qflist_valid(win_T *wp, qf_info_T *qi, unsigned qfid, char *titl
/// Search for a pattern in all the lines in a buffer and add the matching lines /// Search for a pattern in all the lines in a buffer and add the matching lines
/// to a quickfix list. /// to a quickfix list.
static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *spat, static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *spat,
regmmatch_T *regmatch, long *tomatch, int duplicate_name, int flags) regmmatch_T *regmatch, int *tomatch, int duplicate_name, int flags)
FUNC_ATTR_NONNULL_ARG(1, 3, 4, 5, 6) FUNC_ATTR_NONNULL_ARG(1, 3, 4, 5, 6)
{ {
bool found_match = false; bool found_match = false;

View File

@ -893,11 +893,11 @@ static int64_t getoctchrs(void)
// If the first character is '-', then the range is reversed. // If the first character is '-', then the range is reversed.
// Should end with 'end'. If minval is missing, zero is default, if maxval is // Should end with 'end'. If minval is missing, zero is default, if maxval is
// missing, a very big number is the default. // missing, a very big number is the default.
static int read_limits(long *minval, long *maxval) static int read_limits(int *minval, int *maxval)
{ {
int reverse = false; int reverse = false;
char *first_char; char *first_char;
long tmp; int tmp;
if (*regparse == '-') { if (*regparse == '-') {
// Starts with '-', so reverse the range later. // Starts with '-', so reverse the range later.
@ -905,10 +905,10 @@ static int read_limits(long *minval, long *maxval)
reverse = true; reverse = true;
} }
first_char = regparse; first_char = regparse;
*minval = getdigits_long(&regparse, false, 0); *minval = getdigits_int(&regparse, false, 0);
if (*regparse == ',') { // There is a comma. if (*regparse == ',') { // There is a comma.
if (ascii_isdigit(*++regparse)) { if (ascii_isdigit(*++regparse)) {
*maxval = getdigits_long(&regparse, false, MAX_LIMIT); *maxval = getdigits_int(&regparse, false, MAX_LIMIT);
} else { } else {
*maxval = MAX_LIMIT; *maxval = MAX_LIMIT;
} }
@ -2515,8 +2515,8 @@ bool vim_regexec_nl(regmatch_T *rmp, const char *line, colnr_T col)
/// ///
/// @return zero if there is no match. Return number of lines contained in the /// @return zero if there is no match. Return number of lines contained in the
/// match otherwise. /// match otherwise.
long vim_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, int vim_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col,
proftime_T *tm, int *timed_out) proftime_T *tm, int *timed_out)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
regexec_T rex_save; regexec_T rex_save;
@ -2535,7 +2535,7 @@ long vim_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum,
} }
rex_in_use = true; rex_in_use = true;
long result = rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm, timed_out); int result = rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm, timed_out);
rmp->regprog->re_in_use = false; rmp->regprog->re_in_use = false;
// NFA engine aborted because it's very slow, use backtracking engine instead. // NFA engine aborted because it's very slow, use backtracking engine instead.

View File

@ -2466,8 +2466,8 @@ static uint8_t *regpiece(int *flagp)
int op; int op;
uint8_t *next; uint8_t *next;
int flags; int flags;
long minval; int minval;
long maxval; int maxval;
ret = regatom(&flags); ret = regatom(&flags);
if (ret == NULL) { if (ret == NULL) {
@ -4869,7 +4869,7 @@ static bool regmatch(uint8_t *scan, proftime_T *tm, int *timed_out)
/// @param timed_out flag set on timeout or NULL /// @param timed_out flag set on timeout or NULL
/// ///
/// @return 0 for failure, or number of lines contained in the match. /// @return 0 for failure, or number of lines contained in the match.
static long regtry(bt_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_out) static int regtry(bt_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_out)
{ {
rex.input = rex.line + col; rex.input = rex.line + col;
rex.need_clear_subexpr = true; rex.need_clear_subexpr = true;
@ -4939,12 +4939,12 @@ static long regtry(bt_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_o
/// @param timed_out flag set on timeout or NULL /// @param timed_out flag set on timeout or NULL
/// ///
/// @return 0 for failure, or number of lines contained in the match. /// @return 0 for failure, or number of lines contained in the match.
static long bt_regexec_both(uint8_t *line, colnr_T startcol, proftime_T *tm, int *timed_out) static int bt_regexec_both(uint8_t *line, colnr_T startcol, proftime_T *tm, int *timed_out)
{ {
bt_regprog_T *prog; bt_regprog_T *prog;
uint8_t *s; uint8_t *s;
colnr_T col = startcol; colnr_T col = startcol;
long retval = 0L; int retval = 0;
// Create "regstack" and "backpos" if they are not allocated yet. // Create "regstack" and "backpos" if they are not allocated yet.
// We allocate *_INITIAL amount of bytes first and then set the grow size // We allocate *_INITIAL amount of bytes first and then set the grow size
@ -5175,8 +5175,8 @@ static int bt_regexec_nl(regmatch_T *rmp, uint8_t *line, colnr_T col, bool line_
/// ///
/// @return zero if there is no match and number of lines contained in the match /// @return zero if there is no match and number of lines contained in the match
/// otherwise. /// otherwise.
static long bt_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, static int bt_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col,
proftime_T *tm, int *timed_out) proftime_T *tm, int *timed_out)
{ {
init_regexec_multi(rmp, win, buf, lnum); init_regexec_multi(rmp, win, buf, lnum);
return bt_regexec_both(NULL, col, tm, timed_out); return bt_regexec_both(NULL, col, tm, timed_out);

View File

@ -169,7 +169,7 @@ struct regengine {
/// bt_regexec_nl or nfa_regexec_nl /// bt_regexec_nl or nfa_regexec_nl
int (*regexec_nl)(regmatch_T *, uint8_t *, colnr_T, bool); int (*regexec_nl)(regmatch_T *, uint8_t *, colnr_T, bool);
/// bt_regexec_mult or nfa_regexec_mult /// bt_regexec_mult or nfa_regexec_mult
long (*regexec_multi)(regmmatch_T *, win_T *, buf_T *, linenr_T, colnr_T, proftime_T *, int *); int (*regexec_multi)(regmmatch_T *, win_T *, buf_T *, linenr_T, colnr_T, proftime_T *, int *);
// uint8_t *expr; // uint8_t *expr;
}; };

View File

@ -2541,7 +2541,7 @@ static int nfa_regpiece(void)
int i; int i;
int op; int op;
int ret; int ret;
long minval, maxval; int minval, maxval;
bool greedy = true; // Braces are prefixed with '-' ? bool greedy = true; // Braces are prefixed with '-' ?
parse_state_T old_state; parse_state_T old_state;
parse_state_T new_state; parse_state_T new_state;
@ -5792,7 +5792,7 @@ static int skip_to_start(int c, colnr_T *colp)
// Check for a match with match_text. // Check for a match with match_text.
// Called after skip_to_start() has found regstart. // Called after skip_to_start() has found regstart.
// Returns zero for no match, 1 for a match. // Returns zero for no match, 1 for a match.
static long find_match_text(colnr_T *startcol, int regstart, uint8_t *match_text) static int find_match_text(colnr_T *startcol, int regstart, uint8_t *match_text)
{ {
#define PTR2LEN(x) utf_ptr2len(x) #define PTR2LEN(x) utf_ptr2len(x)
@ -7207,7 +7207,7 @@ theend:
/// @param timed_out flag set on timeout or NULL /// @param timed_out flag set on timeout or NULL
/// ///
/// @return <= 0 for failure, number of lines contained in the match otherwise. /// @return <= 0 for failure, number of lines contained in the match otherwise.
static long nfa_regtry(nfa_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_out) static int nfa_regtry(nfa_regprog_T *prog, colnr_T col, proftime_T *tm, int *timed_out)
{ {
int i; int i;
regsubs_T subs, m; regsubs_T subs, m;
@ -7334,10 +7334,10 @@ static long nfa_regtry(nfa_regprog_T *prog, colnr_T col, proftime_T *tm, int *ti
/// ///
/// @return <= 0 if there is no match and number of lines contained in the /// @return <= 0 if there is no match and number of lines contained in the
/// match otherwise. /// match otherwise.
static long nfa_regexec_both(uint8_t *line, colnr_T startcol, proftime_T *tm, int *timed_out) static int nfa_regexec_both(uint8_t *line, colnr_T startcol, proftime_T *tm, int *timed_out)
{ {
nfa_regprog_T *prog; nfa_regprog_T *prog;
long retval = 0L; int retval = 0;
colnr_T col = startcol; colnr_T col = startcol;
if (REG_MULTI) { if (REG_MULTI) {
@ -7631,8 +7631,8 @@ static int nfa_regexec_nl(regmatch_T *rmp, uint8_t *line, colnr_T col, bool line
/// ///
/// @par /// @par
/// FIXME if this behavior is not compatible. /// FIXME if this behavior is not compatible.
static long nfa_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, static int nfa_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col,
proftime_T *tm, int *timed_out) proftime_T *tm, int *timed_out)
{ {
init_regexec_multi(rmp, win, buf, lnum); init_regexec_multi(rmp, win, buf, lnum);
return nfa_regexec_both(NULL, col, tm, timed_out); return nfa_regexec_both(NULL, col, tm, timed_out);

View File

@ -2554,9 +2554,9 @@ static int is_zero_width(char *pattern, int move, pos_T *cur, Direction directio
// start and end are in the same position. // start and end are in the same position.
do { do {
regmatch.startpos[0].col++; regmatch.startpos[0].col++;
nmatched = (int)vim_regexec_multi(&regmatch, curwin, curbuf, nmatched = vim_regexec_multi(&regmatch, curwin, curbuf,
pos.lnum, regmatch.startpos[0].col, pos.lnum, regmatch.startpos[0].col,
NULL, NULL); NULL, NULL);
if (nmatched != 0) { if (nmatched != 0) {
break; break;
} }

View File

@ -120,7 +120,7 @@ struct slang_S {
bool sl_add; // true if it's a .add file. bool sl_add; // true if it's a .add file.
uint8_t *sl_fbyts; // case-folded word bytes uint8_t *sl_fbyts; // case-folded word bytes
long sl_fbyts_len; // length of sl_fbyts int sl_fbyts_len; // length of sl_fbyts
idx_T *sl_fidxs; // case-folded word indexes idx_T *sl_fidxs; // case-folded word indexes
uint8_t *sl_kbyts; // keep-case word bytes uint8_t *sl_kbyts; // keep-case word bytes
idx_T *sl_kidxs; // keep-case word indexes idx_T *sl_kidxs; // keep-case word indexes

View File

@ -1678,7 +1678,7 @@ static int *mb_str2wide(const char *s)
/// @param prefixcnt when "prefixtree" is true: prefix count /// @param prefixcnt when "prefixtree" is true: prefix count
/// ///
/// @return zero when OK, SP_ value for an error. /// @return zero when OK, SP_ value for an error.
static int spell_read_tree(FILE *fd, uint8_t **bytsp, long *bytsp_len, idx_T **idxsp, static int spell_read_tree(FILE *fd, uint8_t **bytsp, int *bytsp_len, idx_T **idxsp,
bool prefixtree, int prefixcnt) bool prefixtree, int prefixcnt)
FUNC_ATTR_NONNULL_ARG(1, 2, 4) FUNC_ATTR_NONNULL_ARG(1, 2, 4)
{ {
@ -4214,7 +4214,7 @@ static int node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int
wordnode_T *child; wordnode_T *child;
hash_T hash; hash_T hash;
hashitem_T *hi; hashitem_T *hi;
long len = 0; int len = 0;
unsigned nr, n; unsigned nr, n;
int compressed = 0; int compressed = 0;
@ -4262,7 +4262,7 @@ static int node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int
} }
} }
} }
*tot += (int)len + 1; // add one for the node that stores the length *tot += 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 // 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 // find a lookalike node. This must be done after compressing the sibling

View File

@ -875,7 +875,7 @@ void draw_tabline(void)
/// the v:lnum and v:relnum variables don't have to be updated. /// the v:lnum and v:relnum variables don't have to be updated.
/// ///
/// @return The width of the built status column string for line "lnum" /// @return The width of the built status column string for line "lnum"
int build_statuscol_str(win_T *wp, linenr_T lnum, long relnum, statuscol_T *stcp) int build_statuscol_str(win_T *wp, linenr_T lnum, linenr_T relnum, statuscol_T *stcp)
{ {
// Only update click definitions once per window per redraw. // Only update click definitions once per window per redraw.
// Don't update when current width is 0, since it will be redrawn again if not empty. // Don't update when current width is 0, since it will be redrawn again if not empty.
@ -1170,7 +1170,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// { Determine the number of bytes to remove // { Determine the number of bytes to remove
// Find the first character that should be included. // Find the first character that should be included.
long n = 0; int n = 0;
while (group_len >= stl_items[stl_groupitems[groupdepth]].maxwid) { while (group_len >= stl_items[stl_groupitems[groupdepth]].maxwid) {
group_len -= ptr2cells(t + n); group_len -= ptr2cells(t + n);
n += utfc_ptr2len(t + n); n += utfc_ptr2len(t + n);
@ -1295,7 +1295,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
if (*fmt_p == STL_TABCLOSENR) { if (*fmt_p == STL_TABCLOSENR) {
if (minwid == 0) { if (minwid == 0) {
// %X ends the close label, go back to the previous tab label nr. // %X ends the close label, go back to the previous tab label nr.
for (long n = curitem - 1; n >= 0; n--) { for (int n = curitem - 1; n >= 0; n--) {
if (stl_items[n].type == TabPage && stl_items[n].minwid >= 0) { if (stl_items[n].type == TabPage && stl_items[n].minwid >= 0) {
minwid = stl_items[n].minwid; minwid = stl_items[n].minwid;
break; break;
@ -1540,8 +1540,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
} }
case STL_PERCENTAGE: case STL_PERCENTAGE:
num = (int)(((long)wp->w_cursor.lnum * 100L) / num = ((wp->w_cursor.lnum * 100) / wp->w_buffer->b_ml.ml_line_count);
(long)wp->w_buffer->b_ml.ml_line_count);
break; break;
case STL_ALTPERCENT: case STL_ALTPERCENT:
@ -1592,11 +1591,11 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
base = kNumBaseHexadecimal; base = kNumBaseHexadecimal;
FALLTHROUGH; FALLTHROUGH;
case STL_OFFSET: { case STL_OFFSET: {
long l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL, int l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL,
false); false);
num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0 ? num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0 ?
0L : (int)l + 1 + ((State & MODE_INSERT) == 0 && empty_line ? 0L : l + 1 + ((State & MODE_INSERT) == 0 && empty_line ?
0 : (int)wp->w_cursor.col); 0 : (int)wp->w_cursor.col);
break; break;
} }
case STL_BYTEVAL_X: case STL_BYTEVAL_X:
@ -1778,7 +1777,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
} }
// } // }
long l = vim_strsize(t); int l = vim_strsize(t);
// If this item is non-empty, record that the last thing // If this item is non-empty, record that the last thing
// we put in the output buffer was an item // we put in the output buffer was an item
@ -1881,8 +1880,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// { Determine how many characters the number will take up when printed // { Determine how many characters the number will take up when printed
// Note: We have to cast the base because the compiler uses // Note: We have to cast the base because the compiler uses
// unsigned ints for the enum values. // unsigned ints for the enum values.
long num_chars = 1; int num_chars = 1;
for (long n = num; n >= (int)base; n /= (int)base) { for (int n = num; n >= (int)base; n /= (int)base) {
num_chars++; num_chars++;
} }
@ -1905,7 +1904,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
num_chars += 2; num_chars += 2;
// How many extra characters there are // How many extra characters there are
long n = num_chars - maxwid; int n = num_chars - maxwid;
// { Reduce the number by base^n // { Reduce the number by base^n
while (num_chars-- > maxwid) { while (num_chars-- > maxwid) {
@ -2029,7 +2028,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// Truncate at the truncation point we found // Truncate at the truncation point we found
} else { } else {
// { Determine how many bytes to remove // { Determine how many bytes to remove
long trunc_len = 0; int trunc_len = 0;
while (width >= maxwidth) { while (width >= maxwidth) {
width -= ptr2cells(trunc_p + trunc_len); width -= ptr2cells(trunc_p + trunc_len);
trunc_len += utfc_ptr2len(trunc_p + trunc_len); trunc_len += utfc_ptr2len(trunc_p + trunc_len);
@ -2049,7 +2048,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
// Note: The offset is one less than the truncation length because // Note: The offset is one less than the truncation length because
// the truncation marker `<` is not counted. // the truncation marker `<` is not counted.
long item_offset = trunc_len - 1; int item_offset = trunc_len - 1;
for (int i = item_idx; i < itemcnt; i++) { for (int i = item_idx; i < itemcnt; i++) {
// Items starting at or after the end of the truncated section need // Items starting at or after the end of the truncated section need
@ -2124,7 +2123,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
if (hltab != NULL) { if (hltab != NULL) {
*hltab = stl_hltab; *hltab = stl_hltab;
stl_hlrec_t *sp = stl_hltab; stl_hlrec_t *sp = stl_hltab;
for (long l = 0; l < itemcnt; l++) { for (int l = 0; l < itemcnt; l++) {
if (stl_items[l].type == Highlight) { if (stl_items[l].type == Highlight) {
sp->start = stl_items[l].start; sp->start = stl_items[l].start;
sp->userhl = stl_items[l].minwid; sp->userhl = stl_items[l].minwid;
@ -2139,7 +2138,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
if (tabtab != NULL) { if (tabtab != NULL) {
*tabtab = stl_tabtab; *tabtab = stl_tabtab;
StlClickRecord *cur_tab_rec = stl_tabtab; StlClickRecord *cur_tab_rec = stl_tabtab;
for (long l = 0; l < itemcnt; l++) { for (int l = 0; l < itemcnt; l++) {
if (stl_items[l].type == TabPage) { if (stl_items[l].type == TabPage) {
cur_tab_rec->start = stl_items[l].start; cur_tab_rec->start = stl_items[l].start;
if (stl_items[l].minwid == 0) { if (stl_items[l].minwid == 0) {

View File

@ -5646,11 +5646,11 @@ static void syntime_report(void)
p = GA_APPEND_VIA_PTR(time_entry_T, &ga); p = GA_APPEND_VIA_PTR(time_entry_T, &ga);
p->total = spp->sp_time.total; p->total = spp->sp_time.total;
total_total = profile_add(total_total, spp->sp_time.total); total_total = profile_add(total_total, spp->sp_time.total);
p->count = (int)spp->sp_time.count; p->count = spp->sp_time.count;
p->match = (int)spp->sp_time.match; p->match = spp->sp_time.match;
total_count += (int)spp->sp_time.count; total_count += spp->sp_time.count;
p->slowest = spp->sp_time.slowest; p->slowest = spp->sp_time.slowest;
proftime_T tm = profile_divide(spp->sp_time.total, (int)spp->sp_time.count); proftime_T tm = profile_divide(spp->sp_time.total, spp->sp_time.count);
p->average = tm; p->average = tm;
p->id = spp->sp_syn.id; p->id = spp->sp_syn.id;
p->pattern = spp->sp_pattern; p->pattern = spp->sp_pattern;

View File

@ -714,7 +714,7 @@ static bool is_filter_char(int c)
return !!(tpf_flags & flag); return !!(tpf_flags & flag);
} }
void terminal_paste(long count, char **y_array, size_t y_size) void terminal_paste(int count, char **y_array, size_t y_size)
{ {
if (y_size == 0) { if (y_size == 0) {
return; return;
@ -1584,7 +1584,7 @@ static void refresh_terminal(Terminal *term)
} }
return; return;
} }
long ml_before = buf->b_ml.ml_line_count; linenr_T ml_before = buf->b_ml.ml_line_count;
// refresh_ functions assume the terminal buffer is current // refresh_ functions assume the terminal buffer is current
aco_save_T aco; aco_save_T aco;
@ -1594,7 +1594,7 @@ static void refresh_terminal(Terminal *term)
refresh_screen(term, buf); refresh_screen(term, buf);
aucmd_restbuf(&aco); aucmd_restbuf(&aco);
long ml_added = buf->b_ml.ml_line_count - ml_before; int ml_added = buf->b_ml.ml_line_count - ml_before;
adjust_topline(term, buf, ml_added); adjust_topline(term, buf, ml_added);
} }
@ -1754,7 +1754,7 @@ static void refresh_screen(Terminal *term, buf_T *buf)
term->invalid_end = -1; term->invalid_end = -1;
} }
static void adjust_topline(Terminal *term, buf_T *buf, long added) static void adjust_topline(Terminal *term, buf_T *buf, int added)
{ {
FOR_ALL_TAB_WINDOWS(tp, wp) { FOR_ALL_TAB_WINDOWS(tp, wp) {
if (wp->w_buffer == buf) { if (wp->w_buffer == buf) {

View File

@ -1108,15 +1108,13 @@ void format_lines(linenr_T line_count, bool avoid_fex)
} }
if (next_leader_len > 0) { if (next_leader_len > 0) {
(void)del_bytes(next_leader_len, false, false); (void)del_bytes(next_leader_len, false, false);
mark_col_adjust(curwin->w_cursor.lnum, (colnr_T)0, 0L, mark_col_adjust(curwin->w_cursor.lnum, 0, 0, -next_leader_len, 0);
(long)-next_leader_len, 0);
} else if (second_indent > 0) { // the "leader" for FO_Q_SECOND } else if (second_indent > 0) { // the "leader" for FO_Q_SECOND
int indent = (int)getwhitecols_curline(); int indent = (int)getwhitecols_curline();
if (indent > 0) { if (indent > 0) {
(void)del_bytes(indent, false, false); (void)del_bytes(indent, false, false);
mark_col_adjust(curwin->w_cursor.lnum, mark_col_adjust(curwin->w_cursor.lnum, 0, 0, -indent, 0);
(colnr_T)0, 0L, (long)-indent, 0);
} }
} }
curwin->w_cursor.lnum--; curwin->w_cursor.lnum--;

View File

@ -733,7 +733,7 @@ int current_sent(oparg_T *oap, int count, bool include)
bool start_blank; bool start_blank;
int c; int c;
bool at_start_sent; bool at_start_sent;
long ncount; int ncount;
start_pos = curwin->w_cursor; start_pos = curwin->w_cursor;
pos = start_pos; pos = start_pos;
@ -838,7 +838,7 @@ extend:
} }
} }
if (ncount > 0) { if (ncount > 0) {
findsent_forward((int)ncount, true); findsent_forward(ncount, true);
} else { } else {
decl(&curwin->w_cursor); decl(&curwin->w_cursor);
} }
@ -1142,7 +1142,7 @@ int current_tagblock(oparg_T *oap, int count_arg, bool include)
again: again:
// Search backwards for unclosed "<aaa>". // Search backwards for unclosed "<aaa>".
// Put this position in start_pos. // Put this position in start_pos.
for (long n = 0; n < count; n++) { for (int n = 0; n < count; n++) {
if (do_searchpair("<[^ \t>/!]\\+\\%(\\_s\\_[^>]\\{-}[^/]>\\|$\\|\\_s\\=>\\)", if (do_searchpair("<[^ \t>/!]\\+\\%(\\_s\\_[^>]\\{-}[^/]>\\|$\\|\\_s\\=>\\)",
"", "",
"</[^>]*>", BACKWARD, NULL, 0, "</[^>]*>", BACKWARD, NULL, 0,

View File

@ -287,7 +287,7 @@ static void terminfo_start(TUIData *tui)
const char *colorterm = os_getenv("COLORTERM"); const char *colorterm = os_getenv("COLORTERM");
const char *termprg = os_getenv("TERM_PROGRAM"); const char *termprg = os_getenv("TERM_PROGRAM");
const char *vte_version_env = os_getenv("VTE_VERSION"); const char *vte_version_env = os_getenv("VTE_VERSION");
long vtev = vte_version_env ? strtol(vte_version_env, NULL, 10) : 0; int vtev = vte_version_env ? (int)strtol(vte_version_env, NULL, 10) : 0;
bool iterm_env = termprg && strstr(termprg, "iTerm.app"); bool iterm_env = termprg && strstr(termprg, "iTerm.app");
bool nsterm = (termprg && strstr(termprg, "Apple_Terminal")) bool nsterm = (termprg && strstr(termprg, "Apple_Terminal"))
|| terminfo_is_term_family(term, "nsterm"); || terminfo_is_term_family(term, "nsterm");
@ -295,7 +295,7 @@ static void terminfo_start(TUIData *tui)
|| os_getenv("KONSOLE_PROFILE_NAME") || os_getenv("KONSOLE_PROFILE_NAME")
|| os_getenv("KONSOLE_DBUS_SESSION"); || os_getenv("KONSOLE_DBUS_SESSION");
const char *konsolev_env = os_getenv("KONSOLE_VERSION"); const char *konsolev_env = os_getenv("KONSOLE_VERSION");
long konsolev = konsolev_env ? strtol(konsolev_env, NULL, 10) int konsolev = konsolev_env ? (int)strtol(konsolev_env, NULL, 10)
: (konsole ? 1 : 0); : (konsole ? 1 : 0);
patch_terminfo_bugs(tui, term, colorterm, vtev, konsolev, iterm_env, nsterm); patch_terminfo_bugs(tui, term, colorterm, vtev, konsolev, iterm_env, nsterm);
@ -1456,7 +1456,7 @@ void tui_option_set(TUIData *tui, String name, Object value)
} else if (strequal(name.data, "ttimeout")) { } else if (strequal(name.data, "ttimeout")) {
tui->input.ttimeout = value.data.boolean; tui->input.ttimeout = value.data.boolean;
} else if (strequal(name.data, "ttimeoutlen")) { } else if (strequal(name.data, "ttimeoutlen")) {
tui->input.ttimeoutlen = (long)value.data.integer; tui->input.ttimeoutlen = (OptInt)value.data.integer;
} else if (strequal(name.data, "verbose")) { } else if (strequal(name.data, "verbose")) {
tui->verbose = value.data.integer; tui->verbose = value.data.integer;
} }
@ -1689,7 +1689,7 @@ static int unibi_find_ext_bool(unibi_term *ut, const char *name)
/// Several entries in terminfo are known to be deficient or outright wrong; /// Several entries in terminfo are known to be deficient or outright wrong;
/// and several terminal emulators falsely announce incorrect terminal types. /// and several terminal emulators falsely announce incorrect terminal types.
static void patch_terminfo_bugs(TUIData *tui, const char *term, const char *colorterm, static void patch_terminfo_bugs(TUIData *tui, const char *term, const char *colorterm,
long vte_version, long konsolev, bool iterm_env, bool nsterm) int vte_version, int konsolev, bool iterm_env, bool nsterm)
{ {
unibi_term *ut = tui->ut; unibi_term *ut = tui->ut;
const char *xterm_version = os_getenv("XTERM_VERSION"); const char *xterm_version = os_getenv("XTERM_VERSION");
@ -2019,7 +2019,7 @@ static void patch_terminfo_bugs(TUIData *tui, const char *term, const char *colo
/// This adds stuff that is not in standard terminfo as extended unibilium /// This adds stuff that is not in standard terminfo as extended unibilium
/// capabilities. /// capabilities.
static void augment_terminfo(TUIData *tui, const char *term, long vte_version, long konsolev, static void augment_terminfo(TUIData *tui, const char *term, int vte_version, int konsolev,
bool iterm_env, bool nsterm) bool iterm_env, bool nsterm)
{ {
unibi_term *ut = tui->ut; unibi_term *ut = tui->ut;

View File

@ -147,7 +147,7 @@ static const char e_write_error_in_undo_file_str[]
= N_("E829: Write error in undo file: %s"); = N_("E829: Write error in undo file: %s");
// used in undo_end() to report number of added and deleted lines // used in undo_end() to report number of added and deleted lines
static long u_newcount, u_oldcount; static int u_newcount, u_oldcount;
// When 'u' flag included in 'cpoptions', we behave like vi. Need to remember // When 'u' flag included in 'cpoptions', we behave like vi. Need to remember
// the action that "u" should do. // the action that "u" should do.
@ -507,7 +507,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
if (size == 1) { if (size == 1) {
uep = u_get_headentry(buf); uep = u_get_headentry(buf);
prev_uep = NULL; prev_uep = NULL;
for (long i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
if (uep == NULL) { if (uep == NULL) {
break; break;
} }
@ -589,7 +589,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
if (size > 0) { if (size > 0) {
uep->ue_array = xmalloc(sizeof(char *) * (size_t)size); uep->ue_array = xmalloc(sizeof(char *) * (size_t)size);
linenr_T lnum; linenr_T lnum;
long i; int i;
for (i = 0, lnum = top + 1; i < size; i++) { for (i = 0, lnum = top + 1; i < size; i++) {
fast_breakcheck(); fast_breakcheck();
if (got_int) { if (got_int) {
@ -2312,7 +2312,7 @@ static void u_undoredo(int undo, bool do_buf_event)
// Use the first line that actually changed. Avoids that // Use the first line that actually changed. Avoids that
// undoing auto-formatting puts the cursor in the previous // undoing auto-formatting puts the cursor in the previous
// line. // line.
long i; int i;
for (i = 0; i < newsize && i < oldsize; i++) { for (i = 0; i < newsize && i < oldsize; i++) {
if (strcmp(uep->ue_array[i], ml_get(top + 1 + (linenr_T)i)) != 0) { if (strcmp(uep->ue_array[i], ml_get(top + 1 + (linenr_T)i)) != 0) {
break; break;
@ -2334,7 +2334,7 @@ static void u_undoredo(int undo, bool do_buf_event)
if (oldsize > 0) { if (oldsize > 0) {
newarray = xmalloc(sizeof(char *) * (size_t)oldsize); newarray = xmalloc(sizeof(char *) * (size_t)oldsize);
// delete backwards, it goes faster in most cases // delete backwards, it goes faster in most cases
long i; int i;
linenr_T lnum; linenr_T lnum;
for (lnum = bot - 1, i = oldsize; --i >= 0; lnum--) { for (lnum = bot - 1, i = oldsize; --i >= 0; lnum--) {
// what can we do when we run out of memory? // what can we do when we run out of memory?
@ -2352,7 +2352,7 @@ static void u_undoredo(int undo, bool do_buf_event)
// insert the lines in u_array between top and bot // insert the lines in u_array between top and bot
if (newsize) { if (newsize) {
long i; int i;
linenr_T lnum; linenr_T lnum;
for (lnum = top, i = 0; i < newsize; i++, lnum++) { for (lnum = top, i = 0; i < newsize; i++, lnum++) {
// If the file is empty, there is an empty line 1 that we // If the file is empty, there is an empty line 1 that we
@ -2420,13 +2420,13 @@ static void u_undoredo(int undo, bool do_buf_event)
// Adjust Extmarks // Adjust Extmarks
ExtmarkUndoObject undo_info; ExtmarkUndoObject undo_info;
if (undo) { if (undo) {
for (long i = (int)kv_size(curhead->uh_extmark) - 1; i > -1; i--) { for (int i = (int)kv_size(curhead->uh_extmark) - 1; i > -1; i--) {
undo_info = kv_A(curhead->uh_extmark, i); undo_info = kv_A(curhead->uh_extmark, i);
extmark_apply_undo(undo_info, undo); extmark_apply_undo(undo_info, undo);
} }
// redo // redo
} else { } else {
for (long i = 0; i < (int)kv_size(curhead->uh_extmark); i++) { for (int i = 0; i < (int)kv_size(curhead->uh_extmark); i++) {
undo_info = kv_A(curhead->uh_extmark, i); undo_info = kv_A(curhead->uh_extmark, i);
extmark_apply_undo(undo_info, undo); extmark_apply_undo(undo_info, undo);
} }
@ -2457,7 +2457,7 @@ static void u_undoredo(int undo, bool do_buf_event)
} }
// restore marks from before undo/redo // restore marks from before undo/redo
for (long i = 0; i < NMARKS; i++) { for (int i = 0; i < NMARKS; i++) {
if (curhead->uh_namedm[i].mark.lnum != 0) { if (curhead->uh_namedm[i].mark.lnum != 0) {
free_fmark(curbuf->b_namedm[i]); free_fmark(curbuf->b_namedm[i]);
curbuf->b_namedm[i] = curhead->uh_namedm[i]; curbuf->b_namedm[i] = curhead->uh_namedm[i];
@ -2962,7 +2962,7 @@ static void u_freeentries(buf_T *buf, u_header_T *uhp, u_header_T **uhpp)
} }
/// free entry 'uep' and 'n' lines in uep->ue_array[] /// free entry 'uep' and 'n' lines in uep->ue_array[]
static void u_freeentry(u_entry_T *uep, long n) static void u_freeentry(u_entry_T *uep, int n)
{ {
while (n > 0) { while (n > 0) {
xfree(uep->ue_array[--n]); xfree(uep->ue_array[--n]);

View File

@ -37,19 +37,19 @@ struct u_header {
// the undo file in u_read_undo() // the undo file in u_read_undo()
union { union {
u_header_T *ptr; // pointer to next undo header in list u_header_T *ptr; // pointer to next undo header in list
long seq; int seq;
} uh_next; } uh_next;
union { union {
u_header_T *ptr; // pointer to previous header in list u_header_T *ptr; // pointer to previous header in list
long seq; int seq;
} uh_prev; } uh_prev;
union { union {
u_header_T *ptr; // pointer to next header for alt. redo u_header_T *ptr; // pointer to next header for alt. redo
long seq; int seq;
} uh_alt_next; } uh_alt_next;
union { union {
u_header_T *ptr; // pointer to previous header for alt. redo u_header_T *ptr; // pointer to previous header for alt. redo
long seq; int seq;
} uh_alt_prev; } uh_alt_prev;
int uh_seq; // sequence number, higher == newer undo int uh_seq; // sequence number, higher == newer undo
int uh_walk; // used by undo_time() int uh_walk; // used by undo_time()

View File

@ -706,7 +706,7 @@ int parse_compl_arg(const char *value, int vallen, int *complp, uint32_t *argt,
return OK; return OK;
} }
static int uc_scan_attr(char *attr, size_t len, uint32_t *argt, long *def, int *flags, int *complp, static int uc_scan_attr(char *attr, size_t len, uint32_t *argt, int *def, int *flags, int *complp,
char **compl_arg, cmd_addr_T *addr_type_arg) char **compl_arg, cmd_addr_T *addr_type_arg)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
@ -773,7 +773,7 @@ two_count:
return FAIL; return FAIL;
} }
*def = getdigits_long(&p, true, 0); *def = getdigits_int(&p, true, 0);
*argt |= EX_ZEROR; *argt |= EX_ZEROR;
if (p != val + vallen || vallen == 0) { if (p != val + vallen || vallen == 0) {
@ -799,7 +799,7 @@ invalid_count:
goto two_count; goto two_count;
} }
*def = getdigits_long(&p, true, 0); *def = getdigits_int(&p, true, 0);
if (p != val + vallen) { if (p != val + vallen) {
goto invalid_count; goto invalid_count;
@ -975,7 +975,7 @@ void ex_command(exarg_T *eap)
{ {
char *end; char *end;
uint32_t argt = 0; uint32_t argt = 0;
long def = -1; int def = -1;
int flags = 0; int flags = 0;
int context = EXPAND_NOTHING; int context = EXPAND_NOTHING;
char *compl_arg = NULL; char *compl_arg = NULL;

View File

@ -2773,7 +2773,7 @@ void intro_message(int colon)
size_t lines_size = ARRAY_SIZE(lines); size_t lines_size = ARRAY_SIZE(lines);
assert(lines_size <= LONG_MAX); assert(lines_size <= LONG_MAX);
long blanklines = Rows - ((long)lines_size - 1L); int blanklines = Rows - ((int)lines_size - 1);
// Don't overwrite a statusline. Depends on 'cmdheight'. // Don't overwrite a statusline. Depends on 'cmdheight'.
if (p_ls > 1) { if (p_ls > 1) {
@ -2790,7 +2790,7 @@ void intro_message(int colon)
sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0); sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);
// start displaying the message lines after half of the blank lines // start displaying the message lines after half of the blank lines
long row = blanklines / 2; int row = blanklines / 2;
if (((row >= 2) && (Columns >= 50)) || colon) { if (((row >= 2) && (Columns >= 50)) || colon) {
for (int i = 0; i < (int)ARRAY_SIZE(lines); i++) { for (int i = 0; i < (int)ARRAY_SIZE(lines); i++) {
@ -2827,7 +2827,7 @@ void intro_message(int colon)
} }
if (*mesg != NUL) { if (*mesg != NUL) {
do_intro_line((int)row, mesg, 0); do_intro_line(row, mesg, 0);
} }
row++; row++;

View File

@ -6619,8 +6619,8 @@ void scroll_to_fraction(win_T *wp, int prev_height)
if (lnum < 1) { // can happen when starting up if (lnum < 1) { // can happen when starting up
lnum = 1; lnum = 1;
} }
wp->w_wrow = (int)((long)wp->w_fraction * (long)height - 1L) / FRACTION_MULT; wp->w_wrow = (int)(wp->w_fraction * height - 1L) / FRACTION_MULT;
int line_size = plines_win_col(wp, lnum, (long)(wp->w_cursor.col)) - 1; int line_size = plines_win_col(wp, lnum, wp->w_cursor.col) - 1;
int sline = wp->w_wrow - line_size; int sline = wp->w_wrow - line_size;
if (sline >= 0) { if (sline >= 0) {
@ -6898,7 +6898,7 @@ char *grab_file_name(int count, linenr_T *file_lnum)
if (file_lnum != NULL && ptr[len] == ':' && isdigit((uint8_t)ptr[len + 1])) { if (file_lnum != NULL && ptr[len] == ':' && isdigit((uint8_t)ptr[len + 1])) {
char *p = ptr + len + 1; char *p = ptr + len + 1;
*file_lnum = (linenr_T)getdigits_long(&p, false, 0); *file_lnum = getdigits_int32(&p, false, 0);
} }
return find_file_name_in_path(ptr, len, options, count, curbuf->b_ffname); return find_file_name_in_path(ptr, len, options, count, curbuf->b_ffname);
} }

4
src/xdiff/xdiff.h vendored
View File

@ -102,8 +102,8 @@ typedef struct s_xdemitcb {
typedef long (*find_func_t)(const char *line, long line_len, char *buffer, long buffer_size, void *priv); typedef long (*find_func_t)(const char *line, long line_len, char *buffer, long buffer_size, void *priv);
typedef int (*xdl_emit_hunk_consume_func_t)(long start_a, long count_a, typedef int (*xdl_emit_hunk_consume_func_t)(int start_a, int count_a,
long start_b, long count_b, int start_b, int count_b,
void *cb_data); void *cb_data);
typedef struct s_xdemitconf { typedef struct s_xdemitconf {