Karsten Hopp 87b952
To: vim_dev@googlegroups.com
Karsten Hopp 87b952
Subject: Patch 7.4.822
Karsten Hopp 87b952
Fcc: outbox
Karsten Hopp 87b952
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 87b952
Mime-Version: 1.0
Karsten Hopp 87b952
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 87b952
Content-Transfer-Encoding: 8bit
Karsten Hopp 87b952
------------
Karsten Hopp 87b952
Karsten Hopp 87b952
Patch 7.4.822
Karsten Hopp 87b952
Problem:    More problems reported by coverity.
Karsten Hopp 87b952
Solution:   Avoid the warnings. (Christian Brabandt)
Karsten Hopp 87b952
Files:      src/os_unix.c, src/eval.c, src/ex_cmds.c, src/ex_cmds2.c,
Karsten Hopp 87b952
            src/ex_getln.c, src/fold.c, src/gui.c, src/gui_w16.c,
Karsten Hopp 87b952
            src/gui_w32.c, src/if_cscope.c, src/if_xcmdsrv.c, src/move.c,
Karsten Hopp 87b952
            src/normal.c, src/regexp.c, src/syntax.c, src/ui.c, src/window.c
Karsten Hopp 87b952
Karsten Hopp 87b952
Karsten Hopp 87b952
*** ../vim-7.4.821/src/os_unix.c	2015-07-17 14:16:49.850596721 +0200
Karsten Hopp 87b952
--- src/os_unix.c	2015-08-11 18:55:47.479102692 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 7001,7007 ****
Karsten Hopp 87b952
  	/* Rely on the same mouse code for the duration of this */
Karsten Hopp 87b952
  	mouse_code = find_termcode(mouse_name);
Karsten Hopp 87b952
  	prev_row = mouse_row;
Karsten Hopp 87b952
! 	prev_row = mouse_col;
Karsten Hopp 87b952
  	xterm_trace = 2;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  	/* Find the offset of the chars, there might be a scrollbar on the
Karsten Hopp 87b952
--- 7001,7007 ----
Karsten Hopp 87b952
  	/* Rely on the same mouse code for the duration of this */
Karsten Hopp 87b952
  	mouse_code = find_termcode(mouse_name);
Karsten Hopp 87b952
  	prev_row = mouse_row;
Karsten Hopp 87b952
! 	prev_col = mouse_col;
Karsten Hopp 87b952
  	xterm_trace = 2;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  	/* Find the offset of the chars, there might be a scrollbar on the
Karsten Hopp 87b952
*** ../vim-7.4.821/src/eval.c	2015-08-11 15:54:46.582211899 +0200
Karsten Hopp 87b952
--- src/eval.c	2015-08-11 18:56:47.834383757 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 6736,6742 ****
Karsten Hopp 87b952
  	len = (int)STRLEN(s);
Karsten Hopp 87b952
  	sumlen += len;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
! 	ga_grow(join_gap, 1);
Karsten Hopp 87b952
  	p = ((join_T *)join_gap->ga_data) + (join_gap->ga_len++);
Karsten Hopp 87b952
  	if (tofree != NULL || s != numbuf)
Karsten Hopp 87b952
  	{
Karsten Hopp 87b952
--- 6736,6742 ----
Karsten Hopp 87b952
  	len = (int)STRLEN(s);
Karsten Hopp 87b952
  	sumlen += len;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
! 	(void)ga_grow(join_gap, 1);
Karsten Hopp 87b952
  	p = ((join_T *)join_gap->ga_data) + (join_gap->ga_len++);
Karsten Hopp 87b952
  	if (tofree != NULL || s != numbuf)
Karsten Hopp 87b952
  	{
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 19590,19596 ****
Karsten Hopp 87b952
  		    goto error;
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
! 	    ga_grow(&ga, cplen);
Karsten Hopp 87b952
  	    mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen);
Karsten Hopp 87b952
  	    ga.ga_len += cplen;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
--- 19590,19596 ----
Karsten Hopp 87b952
  		    goto error;
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
! 	    (void)ga_grow(&ga, cplen);
Karsten Hopp 87b952
  	    mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen);
Karsten Hopp 87b952
  	    ga.ga_len += cplen;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 19610,19616 ****
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      /* add a terminating NUL */
Karsten Hopp 87b952
!     ga_grow(&ga, 1);
Karsten Hopp 87b952
      ga_append(&ga, NUL);
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      rettv->vval.v_string = ga.ga_data;
Karsten Hopp 87b952
--- 19610,19616 ----
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      /* add a terminating NUL */
Karsten Hopp 87b952
!     (void)ga_grow(&ga, 1);
Karsten Hopp 87b952
      ga_append(&ga, NUL);
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      rettv->vval.v_string = ga.ga_data;
Karsten Hopp 87b952
*** ../vim-7.4.821/src/ex_cmds.c	2015-07-17 13:03:42.100357542 +0200
Karsten Hopp 87b952
--- src/ex_cmds.c	2015-08-11 18:56:47.826383852 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 6856,6862 ****
Karsten Hopp 87b952
  	/*
Karsten Hopp 87b952
  	 * Sort the tags.
Karsten Hopp 87b952
  	 */
Karsten Hopp 87b952
! 	sort_strings((char_u **)ga.ga_data, ga.ga_len);
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  	/*
Karsten Hopp 87b952
  	 * Check for duplicates.
Karsten Hopp 87b952
--- 6856,6863 ----
Karsten Hopp 87b952
  	/*
Karsten Hopp 87b952
  	 * Sort the tags.
Karsten Hopp 87b952
  	 */
Karsten Hopp 87b952
! 	if (ga.ga_data != NULL)
Karsten Hopp 87b952
! 	    sort_strings((char_u **)ga.ga_data, ga.ga_len);
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  	/*
Karsten Hopp 87b952
  	 * Check for duplicates.
Karsten Hopp 87b952
*** ../vim-7.4.821/src/ex_cmds2.c	2015-04-13 15:37:48.342074267 +0200
Karsten Hopp 87b952
--- src/ex_cmds2.c	2015-08-11 18:56:47.834383757 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 3051,3057 ****
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	int fdflags = fcntl(fd_tmp, F_GETFD);
Karsten Hopp 87b952
  	if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
Karsten Hopp 87b952
! 	    fcntl(fd_tmp, F_SETFD, fdflags | FD_CLOEXEC);
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  # endif
Karsten Hopp 87b952
  
Karsten Hopp 87b952
--- 3051,3057 ----
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	int fdflags = fcntl(fd_tmp, F_GETFD);
Karsten Hopp 87b952
  	if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
Karsten Hopp 87b952
! 	    (void)fcntl(fd_tmp, F_SETFD, fdflags | FD_CLOEXEC);
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  # endif
Karsten Hopp 87b952
  
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 3841,3847 ****
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	/* Grow the array before starting the timer, so that the time spent
Karsten Hopp 87b952
  	 * here isn't counted. */
Karsten Hopp 87b952
! 	ga_grow(&si->sn_prl_ga, (int)(sourcing_lnum - si->sn_prl_ga.ga_len));
Karsten Hopp 87b952
  	si->sn_prl_idx = sourcing_lnum - 1;
Karsten Hopp 87b952
  	while (si->sn_prl_ga.ga_len <= si->sn_prl_idx
Karsten Hopp 87b952
  		&& si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen)
Karsten Hopp 87b952
--- 3841,3847 ----
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	/* Grow the array before starting the timer, so that the time spent
Karsten Hopp 87b952
  	 * here isn't counted. */
Karsten Hopp 87b952
! 	(void)ga_grow(&si->sn_prl_ga, (int)(sourcing_lnum - si->sn_prl_ga.ga_len));
Karsten Hopp 87b952
  	si->sn_prl_idx = sourcing_lnum - 1;
Karsten Hopp 87b952
  	while (si->sn_prl_ga.ga_len <= si->sn_prl_idx
Karsten Hopp 87b952
  		&& si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen)
Karsten Hopp 87b952
*** ../vim-7.4.821/src/ex_getln.c	2015-07-21 17:53:11.577527989 +0200
Karsten Hopp 87b952
--- src/ex_getln.c	2015-08-11 18:56:47.834383757 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2312,2318 ****
Karsten Hopp 87b952
  add_indent:
Karsten Hopp 87b952
  		while (get_indent_str(p, 8, FALSE) < indent)
Karsten Hopp 87b952
  		{
Karsten Hopp 87b952
! 		    ga_grow(&line_ga, 2);  /* one more for the NUL */
Karsten Hopp 87b952
  		    p = (char_u *)line_ga.ga_data;
Karsten Hopp 87b952
  		    s = skipwhite(p);
Karsten Hopp 87b952
  		    mch_memmove(s + 1, s, line_ga.ga_len - (s - p) + 1);
Karsten Hopp 87b952
--- 2312,2318 ----
Karsten Hopp 87b952
  add_indent:
Karsten Hopp 87b952
  		while (get_indent_str(p, 8, FALSE) < indent)
Karsten Hopp 87b952
  		{
Karsten Hopp 87b952
! 		    (void)ga_grow(&line_ga, 2);  /* one more for the NUL */
Karsten Hopp 87b952
  		    p = (char_u *)line_ga.ga_data;
Karsten Hopp 87b952
  		    s = skipwhite(p);
Karsten Hopp 87b952
  		    mch_memmove(s + 1, s, line_ga.ga_len - (s - p) + 1);
Karsten Hopp 87b952
*** ../vim-7.4.821/src/fold.c	2015-04-15 12:43:37.997444487 +0200
Karsten Hopp 87b952
--- src/fold.c	2015-08-11 18:56:47.838383710 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2446,2452 ****
Karsten Hopp 87b952
      if (getlevel == foldlevelMarker && flp->start <= flp->lvl - level
Karsten Hopp 87b952
  							      && flp->lvl > 0)
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
! 	foldFind(gap, startlnum - 1, &fp);
Karsten Hopp 87b952
  	if (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
Karsten Hopp 87b952
  						   || fp->fd_top >= startlnum)
Karsten Hopp 87b952
  	    fp = NULL;
Karsten Hopp 87b952
--- 2446,2452 ----
Karsten Hopp 87b952
      if (getlevel == foldlevelMarker && flp->start <= flp->lvl - level
Karsten Hopp 87b952
  							      && flp->lvl > 0)
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
! 	(void)foldFind(gap, startlnum - 1, &fp);
Karsten Hopp 87b952
  	if (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
Karsten Hopp 87b952
  						   || fp->fd_top >= startlnum)
Karsten Hopp 87b952
  	    fp = NULL;
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2508,2514 ****
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
  	    if (lvl < level + i)
Karsten Hopp 87b952
  	    {
Karsten Hopp 87b952
! 		foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2;;
Karsten Hopp 87b952
  		if (fp2 != NULL)
Karsten Hopp 87b952
  		    bot = fp2->fd_top + fp2->fd_len - 1 + fp->fd_top;
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
--- 2508,2514 ----
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
  	    if (lvl < level + i)
Karsten Hopp 87b952
  	    {
Karsten Hopp 87b952
! 		(void)foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2;;
Karsten Hopp 87b952
  		if (fp2 != NULL)
Karsten Hopp 87b952
  		    bot = fp2->fd_top + fp2->fd_len - 1 + fp->fd_top;
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
*** ../vim-7.4.821/src/gui.c	2014-03-23 15:12:29.923264336 +0100
Karsten Hopp 87b952
--- src/gui.c	2015-08-11 18:56:47.838383710 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1575,1581 ****
Karsten Hopp 87b952
      base_height = gui_get_base_height();
Karsten Hopp 87b952
      if (fit_to_display)
Karsten Hopp 87b952
  	/* Remember the original window position. */
Karsten Hopp 87b952
! 	gui_mch_get_winpos(&x, &y);
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  #ifdef USE_SUN_WORKSHOP
Karsten Hopp 87b952
      if (!mustset && usingSunWorkShop
Karsten Hopp 87b952
--- 1575,1581 ----
Karsten Hopp 87b952
      base_height = gui_get_base_height();
Karsten Hopp 87b952
      if (fit_to_display)
Karsten Hopp 87b952
  	/* Remember the original window position. */
Karsten Hopp 87b952
! 	(void)gui_mch_get_winpos(&x, &y);
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  #ifdef USE_SUN_WORKSHOP
Karsten Hopp 87b952
      if (!mustset && usingSunWorkShop
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 5366,5372 ****
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	/* Search for the next match. */
Karsten Hopp 87b952
  	i = msg_scroll;
Karsten Hopp 87b952
! 	do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
Karsten Hopp 87b952
  					      SEARCH_MSG + SEARCH_MARK, NULL);
Karsten Hopp 87b952
  	msg_scroll = i;	    /* don't let an error message set msg_scroll */
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
--- 5366,5372 ----
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	/* Search for the next match. */
Karsten Hopp 87b952
  	i = msg_scroll;
Karsten Hopp 87b952
! 	(void)do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
Karsten Hopp 87b952
  					      SEARCH_MSG + SEARCH_MARK, NULL);
Karsten Hopp 87b952
  	msg_scroll = i;	    /* don't let an error message set msg_scroll */
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
*** ../vim-7.4.821/src/gui_w16.c	2013-05-06 04:06:04.000000000 +0200
Karsten Hopp 87b952
--- src/gui_w16.c	2015-08-11 18:56:47.830383805 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 282,288 ****
Karsten Hopp 87b952
  	    result = MyWindowProc(hwnd, uMsg, wParam, lParam);
Karsten Hopp 87b952
  	    if (result == HTCLIENT)
Karsten Hopp 87b952
  	    {
Karsten Hopp 87b952
! 		gui_mch_get_winpos(&x, &y);
Karsten Hopp 87b952
  		xPos -= x;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  		if (xPos < 48) /*<VN> TODO should use system metric?*/
Karsten Hopp 87b952
--- 282,288 ----
Karsten Hopp 87b952
  	    result = MyWindowProc(hwnd, uMsg, wParam, lParam);
Karsten Hopp 87b952
  	    if (result == HTCLIENT)
Karsten Hopp 87b952
  	    {
Karsten Hopp 87b952
! 		(void)gui_mch_get_winpos(&x, &y);
Karsten Hopp 87b952
  		xPos -= x;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  		if (xPos < 48) /*<VN> TODO should use system metric?*/
Karsten Hopp 87b952
*** ../vim-7.4.821/src/gui_w32.c	2015-03-24 17:57:06.210846471 +0100
Karsten Hopp 87b952
--- src/gui_w32.c	2015-08-11 18:56:47.830383805 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 17,23 ****
Karsten Hopp 87b952
   * scrollbars, etc.
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
   * Note: Clipboard stuff, for cutting and pasting text to other windows, is in
Karsten Hopp 87b952
!  * os_win32.c.	(It can also be done from the terminal version).
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
   * TODO: Some of the function signatures ought to be updated for Win64;
Karsten Hopp 87b952
   * e.g., replace LONG with LONG_PTR, etc.
Karsten Hopp 87b952
--- 17,23 ----
Karsten Hopp 87b952
   * scrollbars, etc.
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
   * Note: Clipboard stuff, for cutting and pasting text to other windows, is in
Karsten Hopp 87b952
!  * winclip.c.	(It can also be done from the terminal version).
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
   * TODO: Some of the function signatures ought to be updated for Win64;
Karsten Hopp 87b952
   * e.g., replace LONG with LONG_PTR, etc.
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 76,82 ****
Karsten Hopp 87b952
  	char_u  name[128];
Karsten Hopp 87b952
  	char_u  value[128];
Karsten Hopp 87b952
  
Karsten Hopp 87b952
! 	copy_option_part(&p, item, sizeof(item), ","); 
Karsten Hopp 87b952
  	if (p == NULL)
Karsten Hopp 87b952
  	    break;
Karsten Hopp 87b952
  	q = &item[0];
Karsten Hopp 87b952
--- 76,82 ----
Karsten Hopp 87b952
  	char_u  name[128];
Karsten Hopp 87b952
  	char_u  value[128];
Karsten Hopp 87b952
  
Karsten Hopp 87b952
! 	copy_option_part(&p, item, sizeof(item), ",");
Karsten Hopp 87b952
  	if (p == NULL)
Karsten Hopp 87b952
  	    break;
Karsten Hopp 87b952
  	q = &item[0];
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1227,1233 ****
Karsten Hopp 87b952
  			return result;
Karsten Hopp 87b952
  		}
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
! 		gui_mch_get_winpos(&x, &y);
Karsten Hopp 87b952
  		xPos -= x;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  		if (xPos < 48) /* <VN> TODO should use system metric? */
Karsten Hopp 87b952
--- 1227,1233 ----
Karsten Hopp 87b952
  			return result;
Karsten Hopp 87b952
  		}
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
! 		(void)gui_mch_get_winpos(&x, &y);
Karsten Hopp 87b952
  		xPos -= x;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  		if (xPos < 48) /* <VN> TODO should use system metric? */
Karsten Hopp 87b952
*** ../vim-7.4.821/src/if_cscope.c	2015-03-31 13:33:00.797524914 +0200
Karsten Hopp 87b952
--- src/if_cscope.c	2015-08-11 19:10:00.516961303 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1076,1083 ****
Karsten Hopp 87b952
  /*
Karsten Hopp 87b952
   * PRIVATE: cs_find
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
!  * query cscope using command line interface.  parse the output and use tselect
Karsten Hopp 87b952
!  * to allow choices.  like Nvi, creates a pipe to send to/from query/cscope.
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
   * returns TRUE if we jump to a tag or abort, FALSE if not.
Karsten Hopp 87b952
   */
Karsten Hopp 87b952
--- 1076,1083 ----
Karsten Hopp 87b952
  /*
Karsten Hopp 87b952
   * PRIVATE: cs_find
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
!  * Query cscope using command line interface.  Parse the output and use tselect
Karsten Hopp 87b952
!  * to allow choices.  Like Nvi, creates a pipe to send to/from query/cscope.
Karsten Hopp 87b952
   *
Karsten Hopp 87b952
   * returns TRUE if we jump to a tag or abort, FALSE if not.
Karsten Hopp 87b952
   */
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1214,1220 ****
Karsten Hopp 87b952
--- 1214,1223 ----
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      nummatches = (int *)alloc(sizeof(int)*csinfo_size);
Karsten Hopp 87b952
      if (nummatches == NULL)
Karsten Hopp 87b952
+     {
Karsten Hopp 87b952
+ 	vim_free(cmd);
Karsten Hopp 87b952
  	return FALSE;
Karsten Hopp 87b952
+     }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      /* Send query to all open connections, then count the total number
Karsten Hopp 87b952
       * of matches so we can alloc all in one swell foop. */
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1289,1295 ****
Karsten Hopp 87b952
  # ifdef FEAT_WINDOWS
Karsten Hopp 87b952
  		if (postponed_split != 0)
Karsten Hopp 87b952
  		{
Karsten Hopp 87b952
! 		    win_split(postponed_split > 0 ? postponed_split : 0,
Karsten Hopp 87b952
  						       postponed_split_flags);
Karsten Hopp 87b952
  		    RESET_BINDING(curwin);
Karsten Hopp 87b952
  		    postponed_split = 0;
Karsten Hopp 87b952
--- 1292,1298 ----
Karsten Hopp 87b952
  # ifdef FEAT_WINDOWS
Karsten Hopp 87b952
  		if (postponed_split != 0)
Karsten Hopp 87b952
  		{
Karsten Hopp 87b952
! 		    (void)win_split(postponed_split > 0 ? postponed_split : 0,
Karsten Hopp 87b952
  						       postponed_split_flags);
Karsten Hopp 87b952
  		    RESET_BINDING(curwin);
Karsten Hopp 87b952
  		    postponed_split = 0;
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2085,2090 ****
Karsten Hopp 87b952
--- 2088,2095 ----
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      strcpy(tbuf, matches[0]);
Karsten Hopp 87b952
      ptag = strtok(tbuf, "\t");
Karsten Hopp 87b952
+     if (ptag == NULL)
Karsten Hopp 87b952
+ 	return;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      newsize = (int)(strlen(cstag_msg) + strlen(ptag));
Karsten Hopp 87b952
      buf = (char *)alloc(newsize);
Karsten Hopp 87b952
*** ../vim-7.4.821/src/if_xcmdsrv.c	2012-07-10 14:44:13.000000000 +0200
Karsten Hopp 87b952
--- src/if_xcmdsrv.c	2015-08-11 18:56:47.834383757 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1265,1276 ****
Karsten Hopp 87b952
  			/* Initialize the result property. */
Karsten Hopp 87b952
  			ga_init2(&reply, 1, 100);
Karsten Hopp 87b952
  #ifdef FEAT_MBYTE
Karsten Hopp 87b952
! 			ga_grow(&reply, 50 + STRLEN(p_enc));
Karsten Hopp 87b952
  			sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
Karsten Hopp 87b952
  						   0, 0, p_enc, 0, serial, 0);
Karsten Hopp 87b952
  			reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
Karsten Hopp 87b952
  #else
Karsten Hopp 87b952
! 			ga_grow(&reply, 50);
Karsten Hopp 87b952
  			sprintf(reply.ga_data, "%cr%c-s %s%c-r ",
Karsten Hopp 87b952
  							     0, 0, serial, 0);
Karsten Hopp 87b952
  			reply.ga_len = 10 + STRLEN(serial);
Karsten Hopp 87b952
--- 1265,1276 ----
Karsten Hopp 87b952
  			/* Initialize the result property. */
Karsten Hopp 87b952
  			ga_init2(&reply, 1, 100);
Karsten Hopp 87b952
  #ifdef FEAT_MBYTE
Karsten Hopp 87b952
! 			(void)ga_grow(&reply, 50 + STRLEN(p_enc));
Karsten Hopp 87b952
  			sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
Karsten Hopp 87b952
  						   0, 0, p_enc, 0, serial, 0);
Karsten Hopp 87b952
  			reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
Karsten Hopp 87b952
  #else
Karsten Hopp 87b952
! 			(void)ga_grow(&reply, 50);
Karsten Hopp 87b952
  			sprintf(reply.ga_data, "%cr%c-s %s%c-r ",
Karsten Hopp 87b952
  							     0, 0, serial, 0);
Karsten Hopp 87b952
  			reply.ga_len = 10 + STRLEN(serial);
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1351,1365 ****
Karsten Hopp 87b952
  		    continue;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  		pcPtr->code = code;
Karsten Hopp 87b952
! 		if (res != NULL)
Karsten Hopp 87b952
! 		{
Karsten Hopp 87b952
! 		    res = serverConvert(enc, res, &tofree);
Karsten Hopp 87b952
! 		    if (tofree == NULL)
Karsten Hopp 87b952
! 			res = vim_strsave(res);
Karsten Hopp 87b952
! 		    pcPtr->result = res;
Karsten Hopp 87b952
! 		}
Karsten Hopp 87b952
! 		else
Karsten Hopp 87b952
! 		    pcPtr->result = vim_strsave((char_u *)"");
Karsten Hopp 87b952
  		break;
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
  	}
Karsten Hopp 87b952
--- 1351,1360 ----
Karsten Hopp 87b952
  		    continue;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  		pcPtr->code = code;
Karsten Hopp 87b952
! 		res = serverConvert(enc, res, &tofree);
Karsten Hopp 87b952
! 		if (tofree == NULL)
Karsten Hopp 87b952
! 		    res = vim_strsave(res);
Karsten Hopp 87b952
! 		pcPtr->result = res;
Karsten Hopp 87b952
  		break;
Karsten Hopp 87b952
  	    }
Karsten Hopp 87b952
  	}
Karsten Hopp 87b952
*** ../vim-7.4.821/src/move.c	2015-03-20 18:11:44.967196356 +0100
Karsten Hopp 87b952
--- src/move.c	2015-08-11 18:56:47.826383852 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 1512,1518 ****
Karsten Hopp 87b952
  	--curwin->w_topline;
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  #ifdef FEAT_FOLDING
Karsten Hopp 87b952
! 	hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  	--curwin->w_botline;	    /* approximate w_botline */
Karsten Hopp 87b952
  	curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE);
Karsten Hopp 87b952
--- 1512,1518 ----
Karsten Hopp 87b952
  	--curwin->w_topline;
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  #ifdef FEAT_FOLDING
Karsten Hopp 87b952
! 	(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  	--curwin->w_botline;	    /* approximate w_botline */
Karsten Hopp 87b952
  	curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE);
Karsten Hopp 87b952
*** ../vim-7.4.821/src/normal.c	2015-08-11 17:46:31.212481064 +0200
Karsten Hopp 87b952
--- src/normal.c	2015-08-11 18:56:47.842383661 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2865,2874 ****
Karsten Hopp 87b952
  		end_visual.col = leftcol;
Karsten Hopp 87b952
  	    else
Karsten Hopp 87b952
  		end_visual.col = rightcol;
Karsten Hopp 87b952
! 	    if (curwin->w_cursor.lnum <
Karsten Hopp 87b952
  				    (start_visual.lnum + end_visual.lnum) / 2)
Karsten Hopp 87b952
- 		end_visual.lnum = end_visual.lnum;
Karsten Hopp 87b952
- 	    else
Karsten Hopp 87b952
  		end_visual.lnum = start_visual.lnum;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  	    /* move VIsual to the right column */
Karsten Hopp 87b952
--- 2865,2872 ----
Karsten Hopp 87b952
  		end_visual.col = leftcol;
Karsten Hopp 87b952
  	    else
Karsten Hopp 87b952
  		end_visual.col = rightcol;
Karsten Hopp 87b952
! 	    if (curwin->w_cursor.lnum >=
Karsten Hopp 87b952
  				    (start_visual.lnum + end_visual.lnum) / 2)
Karsten Hopp 87b952
  		end_visual.lnum = start_visual.lnum;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  	    /* move VIsual to the right column */
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 3807,3814 ****
Karsten Hopp 87b952
  	}
Karsten Hopp 87b952
  # ifdef FEAT_FOLDING
Karsten Hopp 87b952
  	/* Include closed folds as a whole. */
Karsten Hopp 87b952
! 	hasFolding(top, &top, NULL);
Karsten Hopp 87b952
! 	hasFolding(bot, NULL, &bot);
Karsten Hopp 87b952
  # endif
Karsten Hopp 87b952
  	lines = bot - top + 1;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
--- 3805,3812 ----
Karsten Hopp 87b952
  	}
Karsten Hopp 87b952
  # ifdef FEAT_FOLDING
Karsten Hopp 87b952
  	/* Include closed folds as a whole. */
Karsten Hopp 87b952
! 	(void)hasFolding(top, &top, NULL);
Karsten Hopp 87b952
! 	(void)hasFolding(bot, NULL, &bot);
Karsten Hopp 87b952
  # endif
Karsten Hopp 87b952
  	lines = bot - top + 1;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 5954,5960 ****
Karsten Hopp 87b952
  		lnum = curwin->w_topline;
Karsten Hopp 87b952
  		while (n-- > 0 && lnum < curwin->w_botline - 1)
Karsten Hopp 87b952
  		{
Karsten Hopp 87b952
! 		    hasFolding(lnum, NULL, &lnum);
Karsten Hopp 87b952
  		    ++lnum;
Karsten Hopp 87b952
  		}
Karsten Hopp 87b952
  		n = lnum - curwin->w_topline;
Karsten Hopp 87b952
--- 5952,5958 ----
Karsten Hopp 87b952
  		lnum = curwin->w_topline;
Karsten Hopp 87b952
  		while (n-- > 0 && lnum < curwin->w_botline - 1)
Karsten Hopp 87b952
  		{
Karsten Hopp 87b952
! 		    (void)hasFolding(lnum, NULL, &lnum);
Karsten Hopp 87b952
  		    ++lnum;
Karsten Hopp 87b952
  		}
Karsten Hopp 87b952
  		n = lnum - curwin->w_topline;
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 6254,6260 ****
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	/* do autowrite if necessary */
Karsten Hopp 87b952
  	if (curbufIsChanged() && curbuf->b_nwindows <= 1 && !P_HID(curbuf))
Karsten Hopp 87b952
! 	    autowrite(curbuf, FALSE);
Karsten Hopp 87b952
  	setpcmark();
Karsten Hopp 87b952
  	(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
Karsten Hopp 87b952
  				       P_HID(curbuf) ? ECMD_HIDE : 0, curwin);
Karsten Hopp 87b952
--- 6252,6258 ----
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	/* do autowrite if necessary */
Karsten Hopp 87b952
  	if (curbufIsChanged() && curbuf->b_nwindows <= 1 && !P_HID(curbuf))
Karsten Hopp 87b952
! 	    (void)autowrite(curbuf, FALSE);
Karsten Hopp 87b952
  	setpcmark();
Karsten Hopp 87b952
  	(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
Karsten Hopp 87b952
  				       P_HID(curbuf) ? ECMD_HIDE : 0, curwin);
Karsten Hopp 87b952
*** ../vim-7.4.821/src/regexp.c	2015-07-10 19:16:27.302493581 +0200
Karsten Hopp 87b952
--- src/regexp.c	2015-08-11 18:56:47.834383757 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 3824,3837 ****
Karsten Hopp 87b952
  	/* Use an item size of 1 byte, since we push different things
Karsten Hopp 87b952
  	 * onto the regstack. */
Karsten Hopp 87b952
  	ga_init2(&regstack, 1, REGSTACK_INITIAL);
Karsten Hopp 87b952
! 	ga_grow(&regstack, REGSTACK_INITIAL);
Karsten Hopp 87b952
  	regstack.ga_growsize = REGSTACK_INITIAL * 8;
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      if (backpos.ga_data == NULL)
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	ga_init2(&backpos, sizeof(backpos_T), BACKPOS_INITIAL);
Karsten Hopp 87b952
! 	ga_grow(&backpos, BACKPOS_INITIAL);
Karsten Hopp 87b952
  	backpos.ga_growsize = BACKPOS_INITIAL * 8;
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
--- 3824,3837 ----
Karsten Hopp 87b952
  	/* Use an item size of 1 byte, since we push different things
Karsten Hopp 87b952
  	 * onto the regstack. */
Karsten Hopp 87b952
  	ga_init2(&regstack, 1, REGSTACK_INITIAL);
Karsten Hopp 87b952
! 	(void)ga_grow(&regstack, REGSTACK_INITIAL);
Karsten Hopp 87b952
  	regstack.ga_growsize = REGSTACK_INITIAL * 8;
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      if (backpos.ga_data == NULL)
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	ga_init2(&backpos, sizeof(backpos_T), BACKPOS_INITIAL);
Karsten Hopp 87b952
! 	(void)ga_grow(&backpos, BACKPOS_INITIAL);
Karsten Hopp 87b952
  	backpos.ga_growsize = BACKPOS_INITIAL * 8;
Karsten Hopp 87b952
      }
Karsten Hopp 87b952
  
Karsten Hopp 87b952
*** ../vim-7.4.821/src/syntax.c	2015-08-11 15:27:07.624943222 +0200
Karsten Hopp 87b952
--- src/syntax.c	2015-08-11 18:56:47.838383710 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 6670,6676 ****
Karsten Hopp 87b952
  	spp = &(SYN_ITEMS(curwin->w_s)[idx]);
Karsten Hopp 87b952
  	if (spp->sp_time.count > 0)
Karsten Hopp 87b952
  	{
Karsten Hopp 87b952
! 	    ga_grow(&ga, 1);
Karsten Hopp 87b952
  	    p = ((time_entry_T *)ga.ga_data) + ga.ga_len;
Karsten Hopp 87b952
  	    p->total = spp->sp_time.total;
Karsten Hopp 87b952
  	    profile_add(&total_total, &spp->sp_time.total);
Karsten Hopp 87b952
--- 6670,6676 ----
Karsten Hopp 87b952
  	spp = &(SYN_ITEMS(curwin->w_s)[idx]);
Karsten Hopp 87b952
  	if (spp->sp_time.count > 0)
Karsten Hopp 87b952
  	{
Karsten Hopp 87b952
! 	    (void)ga_grow(&ga, 1);
Karsten Hopp 87b952
  	    p = ((time_entry_T *)ga.ga_data) + ga.ga_len;
Karsten Hopp 87b952
  	    p->total = spp->sp_time.total;
Karsten Hopp 87b952
  	    profile_add(&total_total, &spp->sp_time.total);
Karsten Hopp 87b952
*** ../vim-7.4.821/src/ui.c	2015-01-27 21:39:01.970698049 +0100
Karsten Hopp 87b952
--- src/ui.c	2015-08-11 18:56:47.830383805 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2903,2909 ****
Karsten Hopp 87b952
  		    break;
Karsten Hopp 87b952
  		first = FALSE;
Karsten Hopp 87b952
  #ifdef FEAT_FOLDING
Karsten Hopp 87b952
! 		hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  #ifdef FEAT_DIFF
Karsten Hopp 87b952
  		if (curwin->w_topfill < diff_check(curwin, curwin->w_topline))
Karsten Hopp 87b952
--- 2903,2909 ----
Karsten Hopp 87b952
  		    break;
Karsten Hopp 87b952
  		first = FALSE;
Karsten Hopp 87b952
  #ifdef FEAT_FOLDING
Karsten Hopp 87b952
! 		(void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL);
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  #ifdef FEAT_DIFF
Karsten Hopp 87b952
  		if (curwin->w_topfill < diff_check(curwin, curwin->w_topline))
Karsten Hopp 87b952
*** ../vim-7.4.821/src/window.c	2015-07-21 15:48:13.593517912 +0200
Karsten Hopp 87b952
--- src/window.c	2015-08-11 19:08:07.094308424 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 141,147 ****
Karsten Hopp 87b952
  #ifdef FEAT_GUI
Karsten Hopp 87b952
  		need_mouse_correct = TRUE;
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
! 		win_split((int)Prenum, 0);
Karsten Hopp 87b952
  		break;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  #ifdef FEAT_VERTSPLIT
Karsten Hopp 87b952
--- 141,147 ----
Karsten Hopp 87b952
  #ifdef FEAT_GUI
Karsten Hopp 87b952
  		need_mouse_correct = TRUE;
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
! 		(void)win_split((int)Prenum, 0);
Karsten Hopp 87b952
  		break;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
  #ifdef FEAT_VERTSPLIT
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 159,165 ****
Karsten Hopp 87b952
  # ifdef FEAT_GUI
Karsten Hopp 87b952
  		need_mouse_correct = TRUE;
Karsten Hopp 87b952
  # endif
Karsten Hopp 87b952
! 		win_split((int)Prenum, WSP_VERT);
Karsten Hopp 87b952
  		break;
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  
Karsten Hopp 87b952
--- 159,165 ----
Karsten Hopp 87b952
  # ifdef FEAT_GUI
Karsten Hopp 87b952
  		need_mouse_correct = TRUE;
Karsten Hopp 87b952
  # endif
Karsten Hopp 87b952
! 		(void)win_split((int)Prenum, WSP_VERT);
Karsten Hopp 87b952
  		break;
Karsten Hopp 87b952
  #endif
Karsten Hopp 87b952
  
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 2586,2592 ****
Karsten Hopp 87b952
  	return;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      /* When closing the last window in a tab page remove the tab page. */
Karsten Hopp 87b952
!     if (tp == NULL ? firstwin == lastwin : tp->tp_firstwin == tp->tp_lastwin)
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	if (tp == first_tabpage)
Karsten Hopp 87b952
  	    first_tabpage = tp->tp_next;
Karsten Hopp 87b952
--- 2586,2592 ----
Karsten Hopp 87b952
  	return;
Karsten Hopp 87b952
  
Karsten Hopp 87b952
      /* When closing the last window in a tab page remove the tab page. */
Karsten Hopp 87b952
!     if (tp->tp_firstwin == tp->tp_lastwin)
Karsten Hopp 87b952
      {
Karsten Hopp 87b952
  	if (tp == first_tabpage)
Karsten Hopp 87b952
  	    first_tabpage = tp->tp_next;
Karsten Hopp 87b952
*** ../vim-7.4.821/src/version.c	2015-08-11 18:52:58.077121515 +0200
Karsten Hopp 87b952
--- src/version.c	2015-08-11 18:58:41.109035628 +0200
Karsten Hopp 87b952
***************
Karsten Hopp 87b952
*** 743,744 ****
Karsten Hopp 87b952
--- 743,746 ----
Karsten Hopp 87b952
  {   /* Add new patch number below this line */
Karsten Hopp 87b952
+ /**/
Karsten Hopp 87b952
+     822,
Karsten Hopp 87b952
  /**/
Karsten Hopp 87b952
Karsten Hopp 87b952
-- 
Karsten Hopp 87b952
DENNIS:  Listen -- strange women lying in ponds distributing swords is no
Karsten Hopp 87b952
         basis for a system of government.  Supreme executive power derives
Karsten Hopp 87b952
         from a mandate from the masses, not from some farcical aquatic
Karsten Hopp 87b952
         ceremony.
Karsten Hopp 87b952
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp 87b952
Karsten Hopp 87b952
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 87b952
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 87b952
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 87b952
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///