changeset 9497:d18d71ae21e5 v7.4.2029

commit https://github.com/vim/vim/commit/38ee6b041e73ad31c3b6b99d56d20833b59b2b57 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 12 21:11:33 2016 +0200 patch 7.4.2029 Problem: printf() does not work with 64 bit numbers. Solution: use the "L" length modifier. (Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Tue, 12 Jul 2016 21:15:04 +0200
parents ce54298c319f
children 395b08bb8b36
files src/message.c src/testdir/test_expr.vim src/version.c
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/message.c
+++ b/src/message.c
@@ -4198,6 +4198,15 @@ vim_vsnprintf(
 		default: break;
 	    }
 
+# if defined(FEAT_EVAL) && defined(FEAT_NUM64)
+	    switch (fmt_spec)
+	    {
+		case 'd': case 'u': case 'o': case 'x': case 'X':
+		    if (tvs != NULL && length_modifier == '\0')
+			length_modifier = 'L';
+	    }
+# endif
+
 	    /* get parameter value, do initial processing */
 	    switch (fmt_spec)
 	    {
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -129,3 +129,9 @@ func Test_option_value()
   call assert_equal("abcdefgi", &cpo)
   set cpo&vim
 endfunc
+
+function Test_printf_64bit()
+  if has('num64')
+    call assert_equal("123456789012345", printf('%d', 123456789012345))
+  endif
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2029,
+/**/
     2028,
 /**/
     2027,