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