Use portable format specifiers: Case %ld - localized - sprintf.

Fix uses of localized "%ld" within sprintf():
- Replace "%ld" with "%" PRId64.
- Cast corresponding argument to (int64_t).
This commit is contained in:
Eliseo Martínez
2014-04-20 18:33:45 +02:00
committed by Thiago de Arruda
parent fb94edf373
commit b536c22550
2 changed files with 10 additions and 10 deletions

View File

@@ -1884,11 +1884,11 @@ failed:
}
if (conv_error != 0) {
sprintf((char *)IObuff + STRLEN(IObuff),
_("[CONVERSION ERROR in line %ld]"), (long)conv_error);
_("[CONVERSION ERROR in line %" PRId64 "]"), (int64_t)conv_error);
c = TRUE;
} else if (illegal_byte > 0) {
sprintf((char *)IObuff + STRLEN(IObuff),
_("[ILLEGAL BYTE in line %ld]"), (long)illegal_byte);
_("[ILLEGAL BYTE in line %" PRId64 "]"), (int64_t)illegal_byte);
c = TRUE;
} else if (error) {
STRCAT(IObuff, _("[READ ERRORS]"));
@@ -4154,12 +4154,12 @@ void msg_add_lines(int insert_space, long lnum, off_t nchars)
if (lnum == 1)
STRCPY(p, _("1 line, "));
else
sprintf((char *)p, _("%ld lines, "), lnum);
sprintf((char *)p, _("%" PRId64 " lines, "), (int64_t)lnum);
p += STRLEN(p);
if (nchars == 1)
STRCPY(p, _("1 character"));
else {
sprintf((char *)p, _("%" PRId64 " characters"), nchars);
sprintf((char *)p, _("%" PRId64 " characters"), (int64_t)nchars);
}
}
}

View File

@@ -255,11 +255,11 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
sprintf((char *)IObuff, _("1 line %sed %d times"), s, amount);
} else {
if (amount == 1)
sprintf((char *)IObuff, _("%ld lines %sed 1 time"),
oap->line_count, s);
sprintf((char *)IObuff, _("%" PRId64 " lines %sed 1 time"),
(int64_t)oap->line_count, s);
else
sprintf((char *)IObuff, _("%ld lines %sed %d times"),
oap->line_count, s, amount);
sprintf((char *)IObuff, _("%" PRId64 " lines %sed %d times"),
(int64_t)oap->line_count, s, amount);
}
msg(IObuff);
}
@@ -5192,8 +5192,8 @@ void cursor_pos_info(void)
byte_count = bomb_size();
if (byte_count > 0)
sprintf((char *)IObuff + STRLEN(IObuff), _("(+%ld for BOM)"),
byte_count);
sprintf((char *)IObuff + STRLEN(IObuff), _("(+%" PRId64 " for BOM)"),
(int64_t)byte_count);
/* Don't shorten this message, the user asked for it. */
p = p_shm;
p_shm = (char_u *)"";