vim-patch:7.4.2029

Problem:    printf() does not work with 64 bit numbers.
Solution:   use the "L" length modifier. (Ken Takata)

38ee6b041e
This commit is contained in:
James McCoy
2016-11-16 14:30:20 -05:00
parent 9c01efd6fb
commit c3efb2804a
3 changed files with 14 additions and 1 deletions

View File

@@ -910,6 +910,13 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap,
default: break; default: break;
} }
switch (fmt_spec) {
case 'd': case 'u': case 'o': case 'x': case 'X':
if (tvs && length_modifier == '\0') {
length_modifier = '2';
}
}
// get parameter value, do initial processing // get parameter value, do initial processing
switch (fmt_spec) { switch (fmt_spec) {
// '%' and 'c' behave similar to 's' regarding flags and field widths // '%' and 'c' behave similar to 's' regarding flags and field widths

View File

@@ -121,6 +121,12 @@ func Test_option_value()
set cpo&vim set cpo&vim
endfunc endfunc
function Test_printf_64bit()
if has('num64')
call assert_equal("123456789012345", printf('%d', 123456789012345))
endif
endfunc
func Test_setmatches() func Test_setmatches()
hi def link 1 Comment hi def link 1 Comment
hi def link 2 PreProc hi def link 2 PreProc

View File

@@ -415,7 +415,7 @@ static const int included_patches[] = {
// 2032 NA // 2032 NA
2031, 2031,
// 2030 NA // 2030 NA
// 2029, 2029,
2028, 2028,
// 2027 NA // 2027 NA
// 2026 NA // 2026 NA