aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt13
-rw-r--r--runtime/doc/job_control.txt48
-rw-r--r--runtime/doc/msgpack_rpc.txt66
-rw-r--r--src/nvim/buffer.c8
-rw-r--r--src/nvim/charset.c45
-rw-r--r--src/nvim/cursor_shape.c4
-rw-r--r--src/nvim/diff.c12
-rw-r--r--src/nvim/digraph.c4
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c26
-rw-r--r--src/nvim/hardcopy.c40
-rw-r--r--src/nvim/hardcopy.h2
-rw-r--r--src/nvim/indent_c.c8
-rw-r--r--src/nvim/mark.c4
-rw-r--r--src/nvim/menu.c2
-rw-r--r--src/nvim/misc1.c2
-rw-r--r--src/nvim/ops.c2
-rw-r--r--src/nvim/option.c14
-rw-r--r--src/nvim/regexp.c4
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/spell.c14
-rw-r--r--src/nvim/syntax.c8
-rw-r--r--src/nvim/term.c55
-rw-r--r--src/nvim/ui.c4
-rw-r--r--src/nvim/window.c2
27 files changed, 194 insertions, 209 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 6ffa37ac39..5ee66fc43b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5100,12 +5100,12 @@ rpcnotify({channel}, {event}[, {args}...]) {Nvim} *rpcnotify()*
rpcrequest({channel}, {method}[, {args}...]) {Nvim} *rpcrequest()*
Sends a request to {channel} to invoke {method} via
|msgpack-rpc| and blocks until a response is received.
- Example: >
+ Example: >
:let result = rpcrequest(rpc_chan, "func", 1, 2, 3)
rpcstart({prog}[, {argv}]) {Nvim} *rpcstart()*
- Spawns {prog} as a job(optionally passing the {argv} list),
- and opens a |msgpack-rpc| channel with the spawned process
+ Spawns {prog} as a job (optionally passing the list {argv}),
+ and opens a |msgpack-rpc| channel with the spawned process's
stdin/stdout. It returns:
- The channel id on success, which is used by |rpcrequest()|,
|rpcnotify()| and |rpcstop()|
@@ -5114,10 +5114,9 @@ rpcstart({prog}[, {argv}]) {Nvim} *rpcstart()*
:let rpc_chan = rpcstart('prog', ['arg1', 'arg2'])
rpcstop({channel}) {Nvim} *rpcstop()*
- Closes a |msgpack-rpc| channel, possibly created via
- |rpcstart()| (Though it will also close channels created by
- connections to |$NVIM_LISTEN_ADDRESS|). It accepts the rpc
- channel id as only argument.
+ Closes a |msgpack-rpc| {channel}, possibly created via
+ |rpcstart()|. Also closes channels created by connections to
+ |$NVIM_LISTEN_ADDRESS|.
screenattr(row, col) *screenattr()*
Like screenchar(), but return the attribute. This is a rather
diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt
index f381d5ad66..000409597f 100644
--- a/runtime/doc/job_control.txt
+++ b/runtime/doc/job_control.txt
@@ -13,7 +13,7 @@ Nvim's facilities for job control *job-control*
1. Introduction *job-control-intro*
Job control is a simple way to perform multitasking in vimscript. Wikipedia
-contains a more generic/detailed description:
+contains a more generic/detailed description:
"Job control in computing refers to the control of multiple tasks or Jobs on a
computer system, ensuring that they each have access to adequate resources to
@@ -27,8 +27,8 @@ control multiple processes without blocking the current Nvim instance.
Nvim's job control was designed to be simple and familiar to vimscript
programmers, instead of being very powerful but complex. Unlike Vim's
-facilities for calling with external commands, job control does not depend
-on installed shells, calling OS functions for process management directly.
+facilities for calling with external commands, job control does not depend on
+available shells, instead relying on OS functionality for process management.
Internally, Nvim job control is powered by libuv, which has a nice
cross-platform API for managing processes. See https://github.com/libuv/libuv
@@ -43,8 +43,8 @@ event. The best way to understand is with a complete example:
>
set nocp
let job1 = jobstart('shell1', 'bash')
- let job2 = jobstart('shell2', 'bash', ['-c', 'for ((i = 0; i < 10; i++)); do echo -n hello $i!; sleep 2; done'])
-
+ let job2 = jobstart('shell2', 'bash', ['-c', 'for ((i = 0; i < 10; i++)); do echo hello $i!; sleep 1; done'])
+
function JobHandler()
if v:job_data[1] == 'stdout'
let str = 'shell '. v:job_data[0].' stdout: '.join(v:job_data[2])
@@ -53,27 +53,27 @@ event. The best way to understand is with a complete example:
else
let str = 'shell '.v:job_data[0].' exited'
endif
-
+
call append(line('$'), str)
endfunction
-
+
au JobActivity shell* call JobHandler()
<
-To test the above, copy it to the ~/jobcontrol.vim file and start with a clean
+To test the above, copy it to the file ~/jobcontrol.vim and start with a clean
nvim instance:
- >
- nvim -u NONE -S ~/jobcontrol.vim
+>
+ nvim -u NONE -S ~/jobcontrol.vim
<
Here's what is happening:
-- Two bash instances are spawned by |jobstart()| and their stdin/stdout/stderr
- are connected to nvim.
-- The first shell is idle, waiting to read commands from it's stdin
-- The second shell is passed the -c option to execute a command and exit. In
- our case, the command is a for loop that will print numbers and exit after
- a while.
-- The JobHandler function is called by the JobActivity autocommand(notice how
- the shell* pattern matches the `shell1` and `shell2` names passed to
+- Two bash instances are spawned by |jobstart()| with their stdin/stdout/stderr
+ connected to nvim.
+- The first shell is idle, waiting to read commands from its stdin.
+- The second shell is started with the -c argument, causing it to execute a
+ command then exit. In this case, the command is a for loop that will print 0
+ through 9 then exit.
+- The |JobHandler()| function is called by the `JobActivity` autocommand (notice
+ how the shell* pattern matches the names `shell1` and `shell2` passed to
|jobstart()|), and it takes care of displaying stdout/stderr received from
the shells.
- The v:job_data is an array set by the JobActivity event. It has the
@@ -86,16 +86,16 @@ Here's what is happening:
To send data to the job's stdin, one can use the |jobsend()| function, like
this:
>
- :call jobsend(job1, 'ls\n')
- :call jobsend(job1, 'invalid-command\n')
- :call jobsend(job1, 'exit\n')
+ :call jobsend(job1, "ls\n")
+ :call jobsend(job1, "invalid-command\n")
+ :call jobsend(job1, "exit\n")
<
A job may be killed at any time with the |jobstop()| function:
>
:call jobstop(job1)
<
-When |jobstop()| is called, it will send `SIGTERM` to the job. If a job
-doesn't exit after a while, `SIGKILL` will be sent.
-
+When |jobstop()| is called, `SIGTERM` will be sent to the job. If a job does
+not exit after 2 seconds, `SIGKILL` will be sent.
+
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt
index 0fb419e5d5..af4ef3e132 100644
--- a/runtime/doc/msgpack_rpc.txt
+++ b/runtime/doc/msgpack_rpc.txt
@@ -4,10 +4,10 @@
NVIM REFERENCE MANUAL by Thiago de Arruda
-The Msgpack-RPC Interface to Nvim *msgpack-rpc*
+The Msgpack-RPC Interface to Nvim *msgpack-rpc*
1. Introduction |msgpack-rpc-intro|
-2. API |msgpack-rpc-api|
+2. API |msgpack-rpc-api|
3. Connecting |msgpack-rpc-connecting|
4. Clients |msgpack-rpc-clients|
5. Types |msgpack-rpc-types|
@@ -40,9 +40,9 @@ Nvim's msgpack-rpc interface can be seen as a more powerful version of Vim's
The Nvim C API is automatically exposed to the msgpack-rpc interface by the
build system, which parses headers at src/nvim/api from the project root. A
-dispatch function is generated, which matches msgpack-rpc method names
-with non-static API functions, converting/validating arguments and return
-values back to msgpack.
+dispatch function is generated, which matches msgpack-rpc method names with
+non-static API functions, converting/validating arguments and return values
+back to msgpack.
Client libraries will normally provide wrappers that hide msgpack-rpc details
from programmers, which can be automatically generated by reading bundled API
@@ -60,7 +60,7 @@ There are two ways to obtain API metadata:
separate compilation step.
Here's a simple way to get human-readable description of the API (requires
-python and the pyyaml/msgpack-python pip packages):
+python and the `pyyaml`/`msgpack-python` pip packages):
>
nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' > api.yaml
@@ -69,21 +69,19 @@ python and the pyyaml/msgpack-python pip packages):
There are four ways to open msgpack-rpc streams to nvim:
-1. Through nvim's stdin/stdout when started with the `--embed` option. This is
+1. Through Nvim's stdin/stdout when started with the `--embed` option. This is
how other programs can embed nvim.
-2. Through stdin/stdout of a program spawned by the |rpcstart()| function.
+2. Through the stdin/stdout of a program spawned by the |rpcstart()| function.
3. Through the socket automatically created with each instance. To find out
the socket location (which is random by default) from a running nvim
- instance, one can inspect the *$NVIM_LISTEN_ADDRESS* environment variable
- like this:
+ instance, one can inspect the |$NVIM_LISTEN_ADDRESS| environment variable:
>
:echo $NVIM_LISTEN_ADDRESS
<
-4. Through a TCP/IP socket. To make nvim listen on a TCP/IP socket, you need
- to set the $NVIM_LISTEN_ADDRESS environment variable before starting, like
- this:
+4. Through a TCP/IP socket. To make nvim listen on a TCP/IP socket, set the
+ |$NVIM_LISTEN_ADDRESS| environment variable in a shell before starting:
>
NVIM_LISTEN_ADDRESS=127.0.0.1:6666 nvim
<
@@ -120,34 +118,34 @@ functions can be called interactively:
==============================================================================
4. Implementing new clients *msgpack-rpc-clients*
-Nvim is still alpha and there's no in-depth documentation explaining how to
-properly implement a client library. The python client (neovim pip package)
-will be always up-to-date with the latest API changes, so its source code is
-the best documentation currently available. There are some guidelines however:
+Nvim is still in alpha, so there's no in-depth documentation explaining how to
+properly implement a client library yet. The python client (the pip package
+"neovim") will always be up-to-date with the latest API changes, so its source
+code is the best documentation currently available. There are some guidelines
+however:
-- Separate the transport layer from the rest of the library (see
- |msgpack-rpc-connecting| for details of how a client can connect to nvim).
-- Use a msgpack library that implements the spec version 5, Nvim uses the
- BIN/EXT types.
+- Separate the transport layer from the rest of the library. See
+ |msgpack-rpc-connecting| for details on how clients can connect to nvim.
+- Use a MessagePack library that implements at least version 5 of the
+ MessagePack spec, which supports the `bin` and `ext` types used by nvim.
- Read API metadata in order to create client-side wrappers for all
msgpack-rpc methods.
- Use a single-threaded event loop library/pattern.
-- Use a fiber/coroutine library for the language you are implementing a client
- for. These greatly simplify concurrency and allow the library to expose a
- blocking API on top of a non-blocking event loop without the complexity
- that comes with preemptive multitasking.
+- Use a fiber/coroutine library for the language being used for implementing a
+ client. These greatly simplify concurrency and allow the library to expose a
+ blocking API on top of a non-blocking event loop without the complexity that
+ comes with preemptive multitasking.
- Don't assume anything about the order that responses to msgpack-rpc requests
will arrive.
- Clients should expect to receive msgpack-rpc requests, which need to be
handled immediately because Nvim is blocked while waiting for the client
response.
- Clients should expect to receive msgpack-rpc notifications, but these don't
- need to be handled immediately because they won't block Nvim (though you
- probably want to handle them immediately anyway).
-
+ need to be handled immediately because they won't block Nvim (although they
+ should probably be handled immediately anyway).
Most of the complexity could be handled by a msgpack-rpc library that supports
-server->client requests and notifications, but it's not clear if this is part
+server to client requests and notifications, but it's not clear if this is part
of the msgpack-rpc spec. At least the ruby msgpack-rpc library does not seem
to support it:
https://github.com/msgpack-rpc/msgpack-rpc-ruby/blob/master/lib/msgpack/rpc/transport/tcp.rb#L150-L158
@@ -217,7 +215,7 @@ that makes this task easier:
- Methods that operate instances of Nvim's types are prefixed with the type
name in lower case, e.g. `buffer_get_line` represents the `get_line` method
of a Buffer instance.
-- Global methods are prefixed with `vim`, e.g.`vim_list_buffers`.
+- Global methods are prefixed with `vim`, e.g. `vim_list_buffers`.
So, for an object-oriented language, a client library would have the classes
that represent Nvim's types, and the methods of each class could be defined
@@ -227,13 +225,13 @@ class with methods mapped to functions prefixed with `vim_`
==============================================================================
7. Vimscript functions *msgpack-rpc-vim-functions*
-Four functions related to msgpack-rpc are available to vimscript:
+Four functions related to msgpack-rpc are available in vimscript:
1. |rpcstart()|: Similarly to |jobstart()|, this will spawn a co-process with
its standard handles connected to Nvim. The difference is that it's not
- possible to process raw data to/from the process stdin/stdout/stderr (since
- the job's stdin/stdout combo are used as a msgpack channel that is
- processed directly by Nvim C code).
+ possible to process raw data to/from the process's stdin/stdout/stderr.
+ This is because the job's stdin and stdout are used as a single msgpack
+ channel that is processed directly by Nvim.
2. |rpcstop()|: Same as |jobstop()|, but operates on handles returned by
|rpcstart()|.
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 4c40cd631e..58310a22a4 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -750,7 +750,7 @@ do_bufdel (
break;
arg = p;
} else
- bnr = getdigits(&arg);
+ bnr = getdigits_int(&arg);
}
}
if (!got_int && do_current && do_buffer(command, DOBUF_FIRST,
@@ -2997,7 +2997,7 @@ build_stl_str_hl (
l = -1;
}
if (VIM_ISDIGIT(*s)) {
- minwid = (int)getdigits(&s);
+ minwid = getdigits_int(&s);
if (minwid < 0) /* overflow */
minwid = 0;
}
@@ -3033,7 +3033,7 @@ build_stl_str_hl (
if (*s == '.') {
s++;
if (VIM_ISDIGIT(*s)) {
- maxwid = (int)getdigits(&s);
+ maxwid = getdigits_int(&s);
if (maxwid <= 0) /* overflow */
maxwid = 50;
}
@@ -4077,7 +4077,7 @@ chk_modeline (
e = s + 4;
else
e = s + 3;
- vers = getdigits(&e);
+ vers = getdigits_int(&e);
if (*e == ':'
&& (s[0] != 'V'
|| STRNCMP(skipwhite(e + 1), "set", 3) == 0)
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 32427cc3ba..8781e389ed 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -177,7 +177,7 @@ int buf_init_chartab(buf_T *buf, int global)
}
if (VIM_ISDIGIT(*p)) {
- c = getdigits(&p);
+ c = getdigits_int(&p);
} else if (has_mbyte) {
c = mb_ptr2char_adv(&p);
} else {
@@ -189,7 +189,7 @@ int buf_init_chartab(buf_T *buf, int global)
++p;
if (VIM_ISDIGIT(*p)) {
- c2 = getdigits(&p);
+ c2 = getdigits_int(&p);
} else if (has_mbyte) {
c2 = mb_ptr2char_adv(&p);
} else {
@@ -1676,26 +1676,37 @@ char_u* skiptowhite_esc(char_u *p) {
return p;
}
-/// Getdigits: Get a number from a string and skip over it.
+/// Get a number from a string and skip over it.
///
-/// Note: the argument is a pointer to a char_u pointer!
+/// @param[out] pp A pointer to a pointer to char_u.
+/// It will be advanced past the read number.
///
-/// @param pp
+/// @return Number read from the string.
+intmax_t getdigits(char_u **pp)
+{
+ intmax_t number = strtoimax((char *)*pp, (char **)pp, 10);
+ assert(errno != ERANGE);
+ return number;
+}
+
+/// Get an int number from a string.
///
-/// @return Number from the string.
-long getdigits(char_u **pp)
+/// A getdigits wrapper restricted to int values.
+int getdigits_int(char_u **pp)
{
- char_u *p = *pp;
- long retval = atol((char *)p);
+ intmax_t number = getdigits(pp);
+ assert(number >= INT_MIN && number <= INT_MAX);
+ return (int)number;
+}
- if (*p == '-') {
- // skip negative sign
- ++p;
- }
- // skip to next non-digit
- p = skipdigits(p);
- *pp = p;
- return retval;
+/// Get a long number from a string.
+///
+/// A getdigits wrapper restricted to long values.
+long getdigits_long(char_u **pp)
+{
+ intmax_t number = getdigits(pp);
+ assert(number >= LONG_MIN && number <= LONG_MAX);
+ return (long)number;
}
/// Return TRUE if "lbuf" is empty or only contains blanks.
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 87064b4ef3..2e98b8f512 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -135,9 +135,7 @@ char_u *parse_shape_opt(int what)
p += len;
if (!VIM_ISDIGIT(*p))
return (char_u *)N_("E548: digit expected");
- int64_t digits = getdigits(&p);
- assert(digits <= INT_MAX);
- int n = (int)digits;
+ int n = getdigits_int(&p);
if (len == 3) { /* "ver" or "hor" */
if (n == 0)
return (char_u *)N_("E549: Illegal percentage");
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 7e31c3f216..6cc75e948c 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1221,11 +1221,11 @@ static void diff_read(int idx_orig, int idx_new, char_u *fname)
// {first}a{first}[,{last}]
// {first}[,{last}]d{first}
p = linebuf;
- f1 = getdigits(&p);
+ f1 = getdigits_long(&p);
if (*p == ',') {
++p;
- l1 = getdigits(&p);
+ l1 = getdigits_long(&p);
} else {
l1 = f1;
}
@@ -1235,11 +1235,11 @@ static void diff_read(int idx_orig, int idx_new, char_u *fname)
continue;
}
difftype = *p++;
- f2 = getdigits(&p);
+ f2 = getdigits_long(&p);
if (*p == ',') {
++p;
- l2 = getdigits(&p);
+ l2 = getdigits_long(&p);
} else {
l2 = f2;
}
@@ -1783,7 +1783,7 @@ int diffopt_changed(void)
diff_flags_new |= DIFF_FILLER;
} else if ((STRNCMP(p, "context:", 8) == 0) && VIM_ISDIGIT(p[8])) {
p += 8;
- diff_context_new = getdigits(&p);
+ diff_context_new = getdigits_int(&p);
} else if (STRNCMP(p, "icase", 5) == 0) {
p += 5;
diff_flags_new |= DIFF_ICASE;
@@ -1798,7 +1798,7 @@ int diffopt_changed(void)
diff_flags_new |= DIFF_VERTICAL;
} else if ((STRNCMP(p, "foldcolumn:", 11) == 0) && VIM_ISDIGIT(p[11])) {
p += 11;
- diff_foldcolumn_new = getdigits(&p);
+ diff_foldcolumn_new = getdigits_int(&p);
}
if ((*p != ',') && (*p != NUL)) {
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 2b5fdea2fe..243468b680 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1611,9 +1611,7 @@ void putdigraph(char_u *str)
EMSG(_(e_number_exp));
return;
}
- int64_t digits = getdigits(&str);
- assert(digits <= INT_MAX);
- int n = (int)digits;
+ int n = getdigits_int(&str);
// If the digraph already exists, replace the result.
dp = (digr_T *)user_digraphs.ga_data;
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9974315d3f..d60ce2de73 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2750,7 +2750,7 @@ void ex_lockvar(exarg_T *eap)
if (eap->forceit)
deep = -1;
else if (vim_isdigit(*arg)) {
- deep = getdigits(&arg);
+ deep = getdigits_int(&arg);
arg = skipwhite(arg);
}
@@ -13370,7 +13370,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv)
yank_type = MBLOCK;
if (VIM_ISDIGIT(stropt[1])) {
++stropt;
- block_len = getdigits(&stropt) - 1;
+ block_len = getdigits_long(&stropt) - 1;
--stropt;
}
break;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 3278de3561..03b45f9d49 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -569,7 +569,7 @@ void ex_retab(exarg_T *eap)
save_list = curwin->w_p_list;
curwin->w_p_list = 0; /* don't want list mode here */
- new_ts = getdigits(&(eap->arg));
+ new_ts = getdigits_int(&(eap->arg));
if (new_ts < 0) {
EMSG(_(e_positive));
return;
@@ -3674,7 +3674,7 @@ void do_sub(exarg_T *eap)
*/
cmd = skipwhite(cmd);
if (VIM_ISDIGIT(*cmd)) {
- i = getdigits(&cmd);
+ i = getdigits_long(&cmd);
if (i <= 0 && !eap->skip && do_error) {
EMSG(_(e_zerocount));
return;
@@ -5920,7 +5920,7 @@ void ex_sign(exarg_T *eap)
arg1 = arg;
if (VIM_ISDIGIT(*arg))
{
- id = getdigits(&arg);
+ id = getdigits_int(&arg);
if (!vim_iswhite(*arg) && *arg != NUL)
{
id = -1;
@@ -5985,7 +5985,7 @@ void ex_sign(exarg_T *eap)
else if (STRNCMP(arg, "buffer=", 7) == 0)
{
arg += 7;
- buf = buflist_findnr((int)getdigits(&arg));
+ buf = buflist_findnr(getdigits_int(&arg));
if (*skipwhite(arg) != NUL)
EMSG(_(e_trailing));
break;
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 072972d24e..c796cf6ac7 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -471,7 +471,7 @@ dbg_parsearg (
else if (
gap != &prof_ga &&
VIM_ISDIGIT(*p)) {
- bp->dbg_lnum = getdigits(&p);
+ bp->dbg_lnum = getdigits_long(&p);
p = skipwhite(p);
} else
bp->dbg_lnum = 0;
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ca79270fcc..3661a65b11 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1733,7 +1733,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
if ((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)
&& (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|| vim_iswhite(*p))) {
- n = getdigits(&ea.arg);
+ n = getdigits_long(&ea.arg);
ea.arg = skipwhite(ea.arg);
if (n <= 0 && !ni && (ea.argt & ZEROR) == 0) {
errormsg = (char_u *)_(e_zerocount);
@@ -3250,7 +3250,7 @@ get_address (
default:
if (VIM_ISDIGIT(*cmd)) /* absolute line number */
- lnum = getdigits(&cmd);
+ lnum = getdigits_long(&cmd);
}
for (;; ) {
@@ -3267,7 +3267,7 @@ get_address (
if (!VIM_ISDIGIT(*cmd)) /* '+' is '+1', but '+0' is not '+1' */
n = 1;
else
- n = getdigits(&cmd);
+ n = getdigits_long(&cmd);
if (i == '-')
lnum -= n;
else
@@ -4439,7 +4439,7 @@ two_count:
return FAIL;
}
- *def = getdigits(&p);
+ *def = getdigits_long(&p);
*argt |= (ZEROR | NOTADR);
if (p != val + vallen || vallen == 0) {
@@ -4456,7 +4456,7 @@ invalid_count:
if (*def >= 0)
goto two_count;
- *def = getdigits(&p);
+ *def = getdigits_long(&p);
if (p != val + vallen)
goto invalid_count;
@@ -5819,7 +5819,7 @@ static void ex_tabmove(exarg_T *eap)
return;
}
- tab_number = getdigits(&p);
+ tab_number = getdigits_int(&p);
if (relative != 0)
tab_number = tab_number * relative + tabpage_index(curtab) - 1; ;
} else if (eap->addr_count != 0)
@@ -6441,10 +6441,10 @@ static void ex_winsize(exarg_T *eap)
char_u *arg = eap->arg;
char_u *p;
- w = getdigits(&arg);
+ w = getdigits_int(&arg);
arg = skipwhite(arg);
p = arg;
- h = getdigits(&arg);
+ h = getdigits_int(&arg);
if (*p != NUL && *arg == NUL)
screen_resize(w, h, TRUE);
else
@@ -6494,10 +6494,10 @@ static void ex_winpos(exarg_T *eap)
if (*arg == NUL) {
EMSG(_("E188: Obtaining window position not implemented for this platform"));
} else {
- x = getdigits(&arg);
+ x = getdigits_int(&arg);
arg = skipwhite(arg);
p = arg;
- y = getdigits(&arg);
+ y = getdigits_int(&arg);
if (*p == NUL || *arg != NUL) {
EMSG(_("E466: :winpos requires two number arguments"));
return;
@@ -6744,7 +6744,7 @@ static void ex_later(exarg_T *eap)
if (*p == NUL)
count = 1;
else if (isdigit(*p)) {
- count = getdigits(&p);
+ count = getdigits_long(&p);
switch (*p) {
case 's': ++p; sec = TRUE; break;
case 'm': ++p; sec = TRUE; count *= 60; break;
@@ -7354,7 +7354,7 @@ static void ex_findpat(exarg_T *eap)
n = 1;
if (vim_isdigit(*eap->arg)) { /* get count */
- n = getdigits(&eap->arg);
+ n = getdigits_long(&eap->arg);
eap->arg = skipwhite(eap->arg);
}
if (*eap->arg == '/') { /* Match regexp, not just whole words */
@@ -7618,7 +7618,7 @@ eval_vars (
s = src + 1;
if (*s == '<') /* "#<99" uses v:oldfiles */
++s;
- i = (int)getdigits(&s);
+ i = getdigits_int(&s);
*usedlen = (int)(s - src); /* length of what we expand */
if (src[1] == '<') {
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index d072277d38..993ec143bb 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -320,7 +320,7 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, int
if (!VIM_ISDIGIT(*p))
return (char_u *)N_("E552: digit expected");
- table[idx].number = getdigits(&p); /*advances p*/
+ table[idx].number = getdigits_int(&p);
}
table[idx].string = p;
@@ -358,7 +358,6 @@ static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
{
int colorindex;
uint32_t fg_color;
- uint32_t bg_color;
char *color;
pattr->bold = (highlight_has_attr(hl_id, HL_BOLD, modec) != NULL);
@@ -367,8 +366,6 @@ static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL);
{
- bg_color = PRCOLOR_WHITE;
-
color = (char *)highlight_color(hl_id, (char_u *)"fg", modec);
if (color == NULL)
colorindex = 0;
@@ -387,7 +384,7 @@ static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
fg_color = darken_rgb(fg_color);
pattr->fg_color = fg_color;
- pattr->bg_color = bg_color;
+ pattr->bg_color = PRCOLOR_WHITE;
}
static void prt_set_fg(uint32_t fg)
@@ -455,9 +452,7 @@ static void prt_line_number(prt_settings_T *psettings, int page_line, linenr_T l
int prt_header_height(void)
{
if (printer_opts[OPT_PRINT_HEADERHEIGHT].present) {
- assert(printer_opts[OPT_PRINT_HEADERHEIGHT].number >= INT_MIN
- && printer_opts[OPT_PRINT_HEADERHEIGHT].number <= INT_MAX);
- return (int)printer_opts[OPT_PRINT_HEADERHEIGHT].number;
+ return printer_opts[OPT_PRINT_HEADERHEIGHT].number;
}
return 2;
}
@@ -731,7 +726,8 @@ void ex_hardcopy(exarg_T *eap)
if (got_int || settings.user_abort)
goto print_fail;
- assert(prtpos.bytes_printed * 100 > prtpos.bytes_printed);
+ assert(prtpos.bytes_printed == 0
+ || prtpos.bytes_printed * 100 > prtpos.bytes_printed);
sprintf((char *)IObuff, _("Printing page %d (%zu%%)"),
page_count + 1 + side,
prtpos.bytes_printed * 100 / bytes_to_print);
@@ -1266,11 +1262,11 @@ static int prt_need_underline;
static int prt_underline;
static int prt_do_underline;
static int prt_need_fgcol;
-static int prt_fgcol;
+static uint32_t prt_fgcol;
static int prt_need_bgcol;
static int prt_do_bgcol;
-static int prt_bgcol;
-static int prt_new_bgcol;
+static uint32_t prt_bgcol;
+static uint32_t prt_new_bgcol;
static int prt_attribute_change;
static double prt_text_run;
static int prt_page_num;
@@ -1472,8 +1468,8 @@ static void prt_flush_buffer(void)
prt_write_real(prt_line_height, 2);
/* Lastly add the color of the background */
- r = ((unsigned)prt_new_bgcol & 0xff0000) >> 16;
- g = ((unsigned)prt_new_bgcol & 0xff00) >> 8;
+ r = (prt_new_bgcol & 0xff0000) >> 16;
+ g = (prt_new_bgcol & 0xff00) >> 8;
b = prt_new_bgcol & 0xff;
prt_write_real(r / 255.0, 3);
prt_write_real(g / 255.0, 3);
@@ -1960,9 +1956,7 @@ static double to_device_units(int idx, double physsize, int def_number)
u = PRT_UNIT_PERC;
nr = def_number;
} else {
- assert(printer_opts[idx].number >= INT_MIN
- && printer_opts[idx].number <= INT_MAX);
- nr = (int)printer_opts[idx].number;
+ nr = printer_opts[idx].number;
}
switch (u) {
@@ -2959,8 +2953,8 @@ int mch_print_text_out(char_u *p, int len)
}
if (prt_need_fgcol) {
unsigned int r, g, b;
- r = ((unsigned)prt_fgcol & 0xff0000) >> 16;
- g = ((unsigned)prt_fgcol & 0xff00) >> 8;
+ r = (prt_fgcol & 0xff0000) >> 16;
+ g = (prt_fgcol & 0xff00) >> 8;
b = prt_fgcol & 0xff;
prt_write_real(r / 255.0, 3);
@@ -3081,17 +3075,15 @@ void mch_print_set_font(int iBold, int iItalic, int iUnderline)
void mch_print_set_bg(uint32_t bgcol)
{
- assert(bgcol <= INT_MAX);
- prt_bgcol = (int)bgcol;
+ prt_bgcol = bgcol;
prt_attribute_change = TRUE;
prt_need_bgcol = TRUE;
}
void mch_print_set_fg(uint32_t fgcol)
{
- assert(fgcol <= INT_MAX);
- if ((int)fgcol != prt_fgcol) {
- prt_fgcol = (int)fgcol;
+ if (fgcol != prt_fgcol) {
+ prt_fgcol = fgcol;
prt_attribute_change = TRUE;
prt_need_fgcol = TRUE;
}
diff --git a/src/nvim/hardcopy.h b/src/nvim/hardcopy.h
index 9a74396ef4..4ead8dd5d4 100644
--- a/src/nvim/hardcopy.h
+++ b/src/nvim/hardcopy.h
@@ -40,7 +40,7 @@ typedef struct {
typedef struct {
const char *name;
int hasnum;
- long number;
+ int number;
char_u *string; /* points into option string */
int strlen;
int present;
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 39ad512227..56276db3ce 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -1463,9 +1463,7 @@ void parse_cino(buf_T *buf)
if (*p == '-')
++p;
char_u *digits_start = p; /* remember where the digits start */
- int64_t digits = getdigits(&p);
- assert(digits <= INT_MAX);
- int n = (int)digits;
+ int n = getdigits_int(&p);
divider = 0;
if (*p == '.') { /* ".5s" means a fraction */
fraction = atoi((char *)++p);
@@ -1678,9 +1676,7 @@ int get_c_indent(void)
else if (*p == COM_LEFT || *p == COM_RIGHT)
align = *p++;
else if (VIM_ISDIGIT(*p) || *p == '-') {
- int64_t digits = getdigits(&p);
- assert(digits <= INT_MAX);
- off = (int)digits;
+ off = getdigits_int(&p);
}
else
++p;
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index ef9f0ca408..cf11be665a 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -1226,9 +1226,9 @@ int read_viminfo_filemark(vir_T *virp, int force)
}
if (fm != NULL && (fm->fmark.mark.lnum == 0 || force)) {
str = skipwhite(str + 1);
- fm->fmark.mark.lnum = getdigits(&str);
+ fm->fmark.mark.lnum = getdigits_long(&str);
str = skipwhite(str);
- fm->fmark.mark.col = getdigits(&str);
+ fm->fmark.mark.col = getdigits_int(&str);
fm->fmark.mark.coladd = 0;
fm->fmark.fnum = 0;
str = skipwhite(str);
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index b31b6c1cec..ea15fd68e3 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -120,7 +120,7 @@ ex_menu (
break;
if (vim_iswhite(*p)) {
for (i = 0; i < MENUDEPTH && !vim_iswhite(*arg); ++i) {
- pri_tab[i] = getdigits(&arg);
+ pri_tab[i] = getdigits_int(&arg);
if (pri_tab[i] == 0)
pri_tab[i] = 500;
if (*arg == '.')
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 4f17f84e11..c0d2e254ac 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -525,7 +525,7 @@ open_line (
if (*p == COM_RIGHT || *p == COM_LEFT)
c = *p++;
else if (VIM_ISDIGIT(*p) || *p == '-')
- off = getdigits(&p);
+ off = getdigits_int(&p);
else
++p;
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 3cefc9f623..87a2c2ca05 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -4501,7 +4501,7 @@ int read_viminfo_register(vir_T *virp, int force)
y_current->y_type = MLINE;
/* get the block width; if it's missing we get a zero, which is OK */
str = skipwhite(skiptowhite(str));
- y_current->y_width = getdigits(&str);
+ y_current->y_width = getdigits_int(&str);
}
while (!(eof = viminfo_readline(virp))
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 20e983b253..6c774937cd 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2918,7 +2918,7 @@ do_set (
*/
else if (varp == (char_u *)&p_bs
&& VIM_ISDIGIT(**(char_u **)varp)) {
- i = getdigits((char_u **)varp);
+ i = getdigits_int((char_u **)varp);
switch (i) {
case 0:
*(char_u **)varp = empty_option;
@@ -2943,7 +2943,7 @@ do_set (
else if (varp == (char_u *)&p_ww
&& VIM_ISDIGIT(*arg)) {
*errbuf = NUL;
- i = getdigits(&arg);
+ i = getdigits_int(&arg);
if (i & 1)
STRCAT(errbuf, "b,");
if (i & 2)
@@ -4359,7 +4359,7 @@ did_set_string_option (
/* set ru_wid if 'ruf' starts with "%99(" */
if (*++s == '-') /* ignore a '-' */
s++;
- wid = getdigits(&s);
+ wid = getdigits_int(&s);
if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL)
ru_wid = wid;
else
@@ -4664,14 +4664,14 @@ char_u *check_colorcolumn(win_T *wp)
++s;
if (!VIM_ISDIGIT(*s))
return e_invarg;
- col = col * getdigits(&s);
+ col = col * getdigits_int(&s);
if (wp->w_buffer->b_p_tw == 0)
goto skip; /* 'textwidth' not set, skip this item */
col += wp->w_buffer->b_p_tw;
if (col < 0)
goto skip;
} else if (VIM_ISDIGIT(*s))
- col = getdigits(&s);
+ col = getdigits_int(&s);
else
return e_invarg;
color_cols[count++] = col - 1; /* 1-based to 0-based */
@@ -8114,12 +8114,12 @@ static bool briopt_check(win_T *wp)
&& ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
{
p += 6;
- bri_shift = getdigits(&p);
+ bri_shift = getdigits_int(&p);
}
else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
{
p += 4;
- bri_min = getdigits(&p);
+ bri_min = getdigits_long(&p);
}
else if (STRNCMP(p, "sbr", 3) == 0)
{
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index dd7af63ce0..62c01e3798 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -3082,10 +3082,10 @@ static int read_limits(long *minval, long *maxval)
reverse = TRUE;
}
first_char = regparse;
- *minval = getdigits(&regparse);
+ *minval = getdigits_long(&regparse);
if (*regparse == ',') { /* There is a comma */
if (vim_isdigit(*++regparse))
- *maxval = getdigits(&regparse);
+ *maxval = getdigits_long(&regparse);
else
*maxval = MAX_LIMIT;
} else if (VIM_ISDIGIT(*first_char))
diff --git a/src/nvim/search.c b/src/nvim/search.c
index d3946a9b63..25b8277933 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -4611,7 +4611,7 @@ int read_viminfo_search_pattern(vir_T *virp, int force)
if (lp[4] == 'E')
off_end = SEARCH_END;
lp += 5;
- off = getdigits(&lp);
+ off = getdigits_long(&lp);
}
if (lp[0] == '~') { /* use this pattern for last-used pattern */
setlast = TRUE;
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index b8713909b8..5e69a935ca 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -5162,7 +5162,7 @@ static unsigned get_affitem(int flagtype, char_u **pp)
++*pp; // always advance, avoid getting stuck
return 0;
}
- res = getdigits(pp);
+ res = getdigits_int(pp);
} else {
res = mb_ptr2char_adv(pp);
if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG
@@ -5283,7 +5283,9 @@ static bool flag_in_afflist(int flagtype, char_u *afflist, unsigned flag)
case AFT_NUM:
for (p = afflist; *p != NUL; ) {
- n = getdigits(&p);
+ int digits = getdigits_int(&p);
+ assert(digits >= 0);
+ n = (unsigned int)digits;
if (n == flag)
return true;
if (*p != NUL) // skip over comma
@@ -6357,19 +6359,19 @@ int spell_check_msm(void)
if (!VIM_ISDIGIT(*p))
return FAIL;
// block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)
- start = (getdigits(&p) * 10) / (SBLOCKSIZE / 102);
+ start = (getdigits_long(&p) * 10) / (SBLOCKSIZE / 102);
if (*p != ',')
return FAIL;
++p;
if (!VIM_ISDIGIT(*p))
return FAIL;
- incr = (getdigits(&p) * 102) / (SBLOCKSIZE / 10);
+ incr = (getdigits_long(&p) * 102) / (SBLOCKSIZE / 10);
if (*p != ',')
return FAIL;
++p;
if (!VIM_ISDIGIT(*p))
return FAIL;
- added = getdigits(&p) * 1024;
+ added = getdigits_long(&p) * 1024;
if (*p != NUL)
return FAIL;
@@ -8355,7 +8357,7 @@ int spell_check_sps(void)
f = 0;
if (VIM_ISDIGIT(*buf)) {
s = buf;
- sps_limit = getdigits(&s);
+ sps_limit = getdigits_int(&s);
if (*s != NUL && !VIM_ISDIGIT(*s))
f = -1;
} else if (STRCMP(buf, "best") == 0)
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index f35da39bb3..4e2be0cd44 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4900,7 +4900,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
ci->sp_off_flags |= (1 << idx);
if (idx == SPO_LC_OFF) { /* lc=99 */
end += 3;
- *p = getdigits(&end);
+ *p = getdigits_int(&end);
/* "lc=" offset automatically sets "ms=" offset */
if (!(ci->sp_off_flags & (1 << SPO_MS_OFF))) {
@@ -4911,10 +4911,10 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
end += 4;
if (*end == '+') {
++end;
- *p = getdigits(&end); /* positive offset */
+ *p = getdigits_int(&end); /* positive offset */
} else if (*end == '-') {
++end;
- *p = -getdigits(&end); /* negative offset */
+ *p = -getdigits_int(&end); /* negative offset */
}
}
if (*end != ',')
@@ -4980,7 +4980,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
illegal = TRUE;
break;
}
- n = getdigits(&arg_end);
+ n = getdigits_long(&arg_end);
if (!eap->skip) {
if (key[4] == 'B')
curwin->w_s->b_syn_sync_linebreaks = n;
diff --git a/src/nvim/term.c b/src/nvim/term.c
index dfc42632c6..b7c30300b0 100644
--- a/src/nvim/term.c
+++ b/src/nvim/term.c
@@ -2819,13 +2819,13 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
char_u bytes[6];
int num_bytes;
# endif
- long mouse_code = 0; /* init for GCC */
+ int mouse_code = 0; /* init for GCC */
int is_click, is_drag;
- long wheel_code = 0;
- long current_button;
- static long held_button = MOUSE_RELEASE;
+ int wheel_code = 0;
+ int current_button;
+ static int held_button = MOUSE_RELEASE;
static int orig_num_clicks = 1;
- static long orig_mouse_code = 0x0;
+ static int orig_mouse_code = 0x0;
int cpo_koffset;
cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL);
@@ -3230,7 +3230,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
*/
p = tp + slen;
- mouse_code = getdigits(&p);
+ mouse_code = getdigits_int(&p);
if (*p++ != ';')
return -1;
@@ -3238,15 +3238,11 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
if (key_name[0] == KS_SGR_MOUSE)
mouse_code += 32;
- long digits = getdigits(&p);
- assert(digits >= INT_MIN && digits <= INT_MAX);
- mouse_col = (int)digits - 1;
+ mouse_col = getdigits_int(&p);
if (*p++ != ';')
return -1;
- digits = getdigits(&p);
- assert(digits >= INT_MIN && digits <= INT_MAX);
- mouse_row = (int)digits - 1;
+ mouse_row = getdigits_int(&p);
if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
mouse_code |= MOUSE_RELEASE;
else if (*p != 'M')
@@ -3273,7 +3269,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
}
}
p += j;
- if (cmd_complete && getdigits(&p) == mouse_code) {
+ if (cmd_complete && getdigits_int(&p) == mouse_code) {
slen += j; /* skip the \033[ */
continue;
}
@@ -3312,24 +3308,22 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
}
# endif /* !UNIX || FEAT_MOUSE_XTERM */
if (key_name[0] == (int)KS_NETTERM_MOUSE) {
- long mc, mr;
+ int mc, mr;
/* expect a rather limited sequence like: balancing {
* \033}6,45\r
* '6' is the row, 45 is the column
*/
p = tp + slen;
- mr = getdigits(&p);
+ mr = getdigits_int(&p);
if (*p++ != ',')
return -1;
- mc = getdigits(&p);
+ mc = getdigits_int(&p);
if (*p++ != '\r')
return -1;
- assert(mc - 1 >= INT_MIN && mc - 1 <= INT_MAX);
- mouse_col = (int)(mc - 1);
- assert(mr - 1 >= INT_MIN && mr - 1 <= INT_MAX);
- mouse_row = (int)(mr - 1);
+ mouse_col = mc - 1;
+ mouse_row = mr - 1;
mouse_code = MOUSE_LEFT;
slen += (int)(p - (tp + slen));
}
@@ -3384,32 +3378,32 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
* The page coordinate may be omitted if the locator is on
* page one (the default). We ignore it anyway.
*/
- long Pe, Pb, Pr, Pc;
+ int Pe, Pb, Pr, Pc;
p = tp + slen;
/* get event status */
- Pe = getdigits(&p);
+ Pe = getdigits_int(&p);
if (*p++ != ';')
return -1;
/* get button status */
- Pb = getdigits(&p);
+ Pb = getdigits_int(&p);
if (*p++ != ';')
return -1;
/* get row status */
- Pr = getdigits(&p);
+ Pr = getdigits_int(&p);
if (*p++ != ';')
return -1;
/* get column status */
- Pc = getdigits(&p);
+ Pc = getdigits_int(&p);
/* the page parameter is optional */
if (*p == ';') {
p++;
- (void)getdigits(&p);
+ (void)getdigits_int(&p);
}
if (*p++ != '&')
return -1;
@@ -3453,10 +3447,8 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
default: return -1; /* should never occur */
}
- assert(Pc - 1 >= INT_MIN && Pc - 1 <= INT_MAX);
- mouse_col = (int)(Pc - 1);
- assert(Pr - 1 >= INT_MIN && Pr - 1 <= INT_MAX);
- mouse_row = (int)(Pr - 1);
+ mouse_col = Pc - 1;
+ mouse_row = Pr - 1;
slen += (int)(p - (tp + slen));
}
@@ -3544,8 +3536,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
key_name[1] = (wheel_code & 1)
? (int)KE_MOUSEUP : (int)KE_MOUSEDOWN;
} else {
- assert(current_button >= INT_MIN && current_button <= INT_MAX);
- key_name[1] = (char_u)get_pseudo_mouse_code((int)current_button,
+ key_name[1] = (char_u)get_pseudo_mouse_code(current_button,
is_click, is_drag);
}
}
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 9c58193e8c..25d6a81960 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -344,14 +344,14 @@ static void parse_abstract_ui_codes(uint8_t *ptr, int len)
assert(p != end);
if (VIM_ISDIGIT(*p)) {
- arg1 = (int)getdigits(&p);
+ arg1 = getdigits_int(&p);
if (p >= end) {
break;
}
if (*p == ';') {
p++;
- arg2 = (int)getdigits(&p);
+ arg2 = getdigits_int(&p);
if (p >= end)
break;
}
diff --git a/src/nvim/window.c b/src/nvim/window.c
index ed4a8d8e7a..0e336e8cbe 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -4908,7 +4908,7 @@ file_name_in_line (
++p; /* skip the separator */
p = skipwhite(p);
if (isdigit(*p))
- *file_lnum = (int)getdigits(&p);
+ *file_lnum = getdigits_long(&p);
}
}