mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 12:08:33 +00:00
Use portable format specifiers: Case %ld - plain - sscanf.
Fix uses of plain "%ld" within sscanf(): - Replace "%ld" with "%" SCNd64. - Create (int64_t) local variable and sscanf into that. - Safely downcast into previous type (introduce assertion, to be removed when variable type refactored).
This commit is contained in:

committed by
Thiago de Arruda

parent
c79ff046a0
commit
6e2cb1bddb
@@ -1493,9 +1493,12 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
|
|||||||
while (!(eof = viminfo_readline(virp)) && line[0] == TAB) {
|
while (!(eof = viminfo_readline(virp)) && line[0] == TAB) {
|
||||||
if (load_marks) {
|
if (load_marks) {
|
||||||
if (line[1] != NUL) {
|
if (line[1] != NUL) {
|
||||||
|
int64_t lnum_64;
|
||||||
unsigned u;
|
unsigned u;
|
||||||
|
sscanf((char *)line + 2, "%" SCNd64 "%u", &lnum_64, &u);
|
||||||
sscanf((char *)line + 2, "%ld %u", &pos.lnum, &u);
|
// safely downcast to linenr_T (long); remove when linenr_T refactored
|
||||||
|
assert(lnum_64 <= LONG_MAX);
|
||||||
|
pos.lnum = (linenr_T)lnum_64;
|
||||||
pos.col = u;
|
pos.col = u;
|
||||||
switch (line[1]) {
|
switch (line[1]) {
|
||||||
case '"': curbuf->b_last_cursor = pos; break;
|
case '"': curbuf->b_last_cursor = pos; break;
|
||||||
|
Reference in New Issue
Block a user