Karsten Hopp 686763
To: vim_dev@googlegroups.com
Karsten Hopp 686763
Subject: Patch 7.3.614
Karsten Hopp 686763
Fcc: outbox
Karsten Hopp 686763
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 686763
Mime-Version: 1.0
Karsten Hopp 686763
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 686763
Content-Transfer-Encoding: 8bit
Karsten Hopp 686763
------------
Karsten Hopp 686763
Karsten Hopp 686763
Patch 7.3.614
Karsten Hopp 686763
Problem:    Number argument gets turned into a number while it should be a
Karsten Hopp 686763
	    string.
Karsten Hopp 686763
Solution:   Add flag to the call_vim_function() call. (Yasuhiro Matsumoto)
Karsten Hopp 686763
Files:	    src/edit.c, src/eval.c, src/proto/eval.pro
Karsten Hopp 686763
Karsten Hopp 686763
Karsten Hopp 686763
*** ../vim-7.3.613/src/edit.c	2012-07-10 17:14:50.000000000 +0200
Karsten Hopp 686763
--- src/edit.c	2012-07-25 16:40:07.000000000 +0200
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 3959,3965 ****
Karsten Hopp 686763
      curbuf_save = curbuf;
Karsten Hopp 686763
  
Karsten Hopp 686763
      /* Call a function, which returns a list or dict. */
Karsten Hopp 686763
!     if (call_vim_function(funcname, 2, args, FALSE, &rettv) == OK)
Karsten Hopp 686763
      {
Karsten Hopp 686763
  	switch (rettv.v_type)
Karsten Hopp 686763
  	{
Karsten Hopp 686763
--- 3959,3965 ----
Karsten Hopp 686763
      curbuf_save = curbuf;
Karsten Hopp 686763
  
Karsten Hopp 686763
      /* Call a function, which returns a list or dict. */
Karsten Hopp 686763
!     if (call_vim_function(funcname, 2, args, FALSE, FALSE, &rettv) == OK)
Karsten Hopp 686763
      {
Karsten Hopp 686763
  	switch (rettv.v_type)
Karsten Hopp 686763
  	{
Karsten Hopp 686763
*** ../vim-7.3.613/src/eval.c	2012-07-19 18:05:40.000000000 +0200
Karsten Hopp 686763
--- src/eval.c	2012-07-25 16:42:41.000000000 +0200
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 1564,1574 ****
Karsten Hopp 686763
   * Returns OK or FAIL.
Karsten Hopp 686763
   */
Karsten Hopp 686763
      int
Karsten Hopp 686763
! call_vim_function(func, argc, argv, safe, rettv)
Karsten Hopp 686763
      char_u      *func;
Karsten Hopp 686763
      int		argc;
Karsten Hopp 686763
      char_u      **argv;
Karsten Hopp 686763
      int		safe;		/* use the sandbox */
Karsten Hopp 686763
      typval_T	*rettv;
Karsten Hopp 686763
  {
Karsten Hopp 686763
      typval_T	*argvars;
Karsten Hopp 686763
--- 1564,1575 ----
Karsten Hopp 686763
   * Returns OK or FAIL.
Karsten Hopp 686763
   */
Karsten Hopp 686763
      int
Karsten Hopp 686763
! call_vim_function(func, argc, argv, safe, str_arg_only, rettv)
Karsten Hopp 686763
      char_u      *func;
Karsten Hopp 686763
      int		argc;
Karsten Hopp 686763
      char_u      **argv;
Karsten Hopp 686763
      int		safe;		/* use the sandbox */
Karsten Hopp 686763
+     int		str_arg_only;	/* all arguments are strings */
Karsten Hopp 686763
      typval_T	*rettv;
Karsten Hopp 686763
  {
Karsten Hopp 686763
      typval_T	*argvars;
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 1593,1600 ****
Karsten Hopp 686763
  	    continue;
Karsten Hopp 686763
  	}
Karsten Hopp 686763
  
Karsten Hopp 686763
! 	/* Recognize a number argument, the others must be strings. */
Karsten Hopp 686763
! 	vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL);
Karsten Hopp 686763
  	if (len != 0 && len == (int)STRLEN(argv[i]))
Karsten Hopp 686763
  	{
Karsten Hopp 686763
  	    argvars[i].v_type = VAR_NUMBER;
Karsten Hopp 686763
--- 1594,1604 ----
Karsten Hopp 686763
  	    continue;
Karsten Hopp 686763
  	}
Karsten Hopp 686763
  
Karsten Hopp 686763
! 	if (str_arg_only)
Karsten Hopp 686763
! 	    len = 0;
Karsten Hopp 686763
! 	else
Karsten Hopp 686763
! 	    /* Recognize a number argument, the others must be strings. */
Karsten Hopp 686763
! 	    vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL);
Karsten Hopp 686763
  	if (len != 0 && len == (int)STRLEN(argv[i]))
Karsten Hopp 686763
  	{
Karsten Hopp 686763
  	    argvars[i].v_type = VAR_NUMBER;
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 1646,1652 ****
Karsten Hopp 686763
      typval_T	rettv;
Karsten Hopp 686763
      char_u	*retval;
Karsten Hopp 686763
  
Karsten Hopp 686763
!     if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
Karsten Hopp 686763
  	return NULL;
Karsten Hopp 686763
  
Karsten Hopp 686763
      retval = vim_strsave(get_tv_string(&rettv));
Karsten Hopp 686763
--- 1650,1657 ----
Karsten Hopp 686763
      typval_T	rettv;
Karsten Hopp 686763
      char_u	*retval;
Karsten Hopp 686763
  
Karsten Hopp 686763
!     /* All arguments are passed as strings, no conversion to number. */
Karsten Hopp 686763
!     if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
Karsten Hopp 686763
  	return NULL;
Karsten Hopp 686763
  
Karsten Hopp 686763
      retval = vim_strsave(get_tv_string(&rettv));
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 1671,1677 ****
Karsten Hopp 686763
      typval_T	rettv;
Karsten Hopp 686763
      long	retval;
Karsten Hopp 686763
  
Karsten Hopp 686763
!     if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
Karsten Hopp 686763
  	return -1;
Karsten Hopp 686763
  
Karsten Hopp 686763
      retval = get_tv_number_chk(&rettv, NULL);
Karsten Hopp 686763
--- 1676,1683 ----
Karsten Hopp 686763
      typval_T	rettv;
Karsten Hopp 686763
      long	retval;
Karsten Hopp 686763
  
Karsten Hopp 686763
!     /* All arguments are passed as strings, no conversion to number. */
Karsten Hopp 686763
!     if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
Karsten Hopp 686763
  	return -1;
Karsten Hopp 686763
  
Karsten Hopp 686763
      retval = get_tv_number_chk(&rettv, NULL);
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 1694,1700 ****
Karsten Hopp 686763
  {
Karsten Hopp 686763
      typval_T	rettv;
Karsten Hopp 686763
  
Karsten Hopp 686763
!     if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL)
Karsten Hopp 686763
  	return NULL;
Karsten Hopp 686763
  
Karsten Hopp 686763
      if (rettv.v_type != VAR_LIST)
Karsten Hopp 686763
--- 1700,1707 ----
Karsten Hopp 686763
  {
Karsten Hopp 686763
      typval_T	rettv;
Karsten Hopp 686763
  
Karsten Hopp 686763
!     /* All arguments are passed as strings, no conversion to number. */
Karsten Hopp 686763
!     if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
Karsten Hopp 686763
  	return NULL;
Karsten Hopp 686763
  
Karsten Hopp 686763
      if (rettv.v_type != VAR_LIST)
Karsten Hopp 686763
*** ../vim-7.3.613/src/proto/eval.pro	2012-07-16 17:31:48.000000000 +0200
Karsten Hopp 686763
--- src/proto/eval.pro	2012-07-25 16:42:59.000000000 +0200
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 23,29 ****
Karsten Hopp 686763
  list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
Karsten Hopp 686763
  int get_spellword __ARGS((list_T *list, char_u **pp));
Karsten Hopp 686763
  typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd));
Karsten Hopp 686763
! int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, typval_T *rettv));
Karsten Hopp 686763
  void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
Karsten Hopp 686763
  long call_func_retnr __ARGS((char_u *func, int argc, char_u **argv, int safe));
Karsten Hopp 686763
  void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe));
Karsten Hopp 686763
--- 23,29 ----
Karsten Hopp 686763
  list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
Karsten Hopp 686763
  int get_spellword __ARGS((list_T *list, char_u **pp));
Karsten Hopp 686763
  typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd));
Karsten Hopp 686763
! int call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe, int str_arg_only, typval_T *rettv));
Karsten Hopp 686763
  void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe));
Karsten Hopp 686763
  long call_func_retnr __ARGS((char_u *func, int argc, char_u **argv, int safe));
Karsten Hopp 686763
  void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe));
Karsten Hopp 686763
*** ../vim-7.3.613/src/version.c	2012-07-25 16:32:03.000000000 +0200
Karsten Hopp 686763
--- src/version.c	2012-07-25 16:46:11.000000000 +0200
Karsten Hopp 686763
***************
Karsten Hopp 686763
*** 716,717 ****
Karsten Hopp 686763
--- 716,719 ----
Karsten Hopp 686763
  {   /* Add new patch number below this line */
Karsten Hopp 686763
+ /**/
Karsten Hopp 686763
+     614,
Karsten Hopp 686763
  /**/
Karsten Hopp 686763
Karsten Hopp 686763
-- 
Karsten Hopp 686763
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 686763
171. You invent another person and chat with yourself in empty chat rooms.
Karsten Hopp 686763
Karsten Hopp 686763
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 686763
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 686763
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 686763
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///