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:
Eliseo Martínez 2014-04-25 11:47:25 +02:00 committed by Thiago de Arruda
parent c79ff046a0
commit 6e2cb1bddb

View File

@ -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) {
if (load_marks) {
if (line[1] != NUL) {
int64_t lnum_64;
unsigned u;
sscanf((char *)line + 2, "%ld %u", &pos.lnum, &u);
sscanf((char *)line + 2, "%" SCNd64 "%u", &lnum_64, &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;
switch (line[1]) {
case '"': curbuf->b_last_cursor = pos; break;