mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 14:58:18 +00:00
Use portable format specifiers: Case %ld - plain - vim_snprintf.
Fix uses of plain "%ld" within vim_snprintf(): - Replace "%ld" with "%" PRId64. - Cast corresponding argument to (int64_t).
This commit is contained in:

committed by
Thiago de Arruda

parent
c049cb2b51
commit
3f8061f16c
@@ -4306,8 +4306,8 @@ void write_viminfo_bufferlist(FILE *fp)
|
|||||||
break;
|
break;
|
||||||
putc('%', fp);
|
putc('%', fp);
|
||||||
home_replace(NULL, buf->b_ffname, line, MAXPATHL, TRUE);
|
home_replace(NULL, buf->b_ffname, line, MAXPATHL, TRUE);
|
||||||
vim_snprintf_add((char *)line, LINE_BUF_LEN, "\t%ld\t%d",
|
vim_snprintf_add((char *)line, LINE_BUF_LEN, "\t%" PRId64 "\t%d",
|
||||||
(long)buf->b_last_cursor.lnum,
|
(int64_t)buf->b_last_cursor.lnum,
|
||||||
buf->b_last_cursor.col);
|
buf->b_last_cursor.col);
|
||||||
viminfo_writestring(fp, line);
|
viminfo_writestring(fp, line);
|
||||||
}
|
}
|
||||||
|
@@ -2738,7 +2738,7 @@ do_ecmd (
|
|||||||
if (command != NULL)
|
if (command != NULL)
|
||||||
vim_snprintf((char *)p, len, ":%s\r", command);
|
vim_snprintf((char *)p, len, ":%s\r", command);
|
||||||
else
|
else
|
||||||
vim_snprintf((char *)p, len, "%ldG", (long)newlnum);
|
vim_snprintf((char *)p, len, "%" PRId64 "G", (int64_t)newlnum);
|
||||||
set_vim_var_string(VV_SWAPCOMMAND, p, -1);
|
set_vim_var_string(VV_SWAPCOMMAND, p, -1);
|
||||||
did_set_swapcommand = TRUE;
|
did_set_swapcommand = TRUE;
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
|
@@ -4263,12 +4263,13 @@ static void ml_crypt_prepare(memfile_T *mfp, off_t offset, int reading)
|
|||||||
|
|
||||||
use_crypt_method = method; /* select pkzip or blowfish */
|
use_crypt_method = method; /* select pkzip or blowfish */
|
||||||
if (method == 0) {
|
if (method == 0) {
|
||||||
vim_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset);
|
vim_snprintf((char *)salt, sizeof(salt), "%s%" PRId64 "",
|
||||||
|
key, (int64_t)offset);
|
||||||
crypt_init_keys(salt);
|
crypt_init_keys(salt);
|
||||||
} else {
|
} else {
|
||||||
/* Using blowfish, add salt and seed. We use the byte offset of the
|
/* Using blowfish, add salt and seed. We use the byte offset of the
|
||||||
* block for the salt. */
|
* block for the salt. */
|
||||||
vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset);
|
vim_snprintf((char *)salt, sizeof(salt), "%" PRId64, (int64_t)offset);
|
||||||
bf_key_init(key, salt, (int)STRLEN(salt));
|
bf_key_init(key, salt, (int)STRLEN(salt));
|
||||||
bf_cfb_init(seed, MF_SEED_LEN);
|
bf_cfb_init(seed, MF_SEED_LEN);
|
||||||
}
|
}
|
||||||
|
@@ -7900,10 +7900,10 @@ static void win_redr_ruler(win_T *wp, int always)
|
|||||||
* Some sprintfs return the length, some return a pointer.
|
* Some sprintfs return the length, some return a pointer.
|
||||||
* To avoid portability problems we use strlen() here.
|
* To avoid portability problems we use strlen() here.
|
||||||
*/
|
*/
|
||||||
vim_snprintf((char *)buffer, RULER_BUF_LEN, "%ld,",
|
vim_snprintf((char *)buffer, RULER_BUF_LEN, "%" PRId64 ",",
|
||||||
(wp->w_buffer->b_ml.ml_flags & ML_EMPTY)
|
(wp->w_buffer->b_ml.ml_flags & ML_EMPTY)
|
||||||
? 0L
|
? (int64_t)0L
|
||||||
: (long)(wp->w_cursor.lnum));
|
: (int64_t)(wp->w_cursor.lnum));
|
||||||
len = STRLEN(buffer);
|
len = STRLEN(buffer);
|
||||||
col_print(buffer + len, RULER_BUF_LEN - len,
|
col_print(buffer + len, RULER_BUF_LEN - len,
|
||||||
empty_line ? 0 : (int)wp->w_cursor.col + 1,
|
empty_line ? 0 : (int)wp->w_cursor.col + 1,
|
||||||
|
@@ -172,7 +172,7 @@ do_window (
|
|||||||
STRCPY(cbuf, "split #");
|
STRCPY(cbuf, "split #");
|
||||||
if (Prenum)
|
if (Prenum)
|
||||||
vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7,
|
vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7,
|
||||||
"%ld", Prenum);
|
"%" PRId64, (int64_t)Prenum);
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ do_window (
|
|||||||
newwindow:
|
newwindow:
|
||||||
if (Prenum)
|
if (Prenum)
|
||||||
/* window height */
|
/* window height */
|
||||||
vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%ld", Prenum);
|
vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum);
|
||||||
else
|
else
|
||||||
cbuf[0] = NUL;
|
cbuf[0] = NUL;
|
||||||
if (nchar == 'v' || nchar == Ctrl_V)
|
if (nchar == 'v' || nchar == Ctrl_V)
|
||||||
|
Reference in New Issue
Block a user