e2a814a
To: vim-dev@vim.org
e2a814a
Subject: Patch 7.2.333
e2a814a
Fcc: outbox
e2a814a
From: Bram Moolenaar <Bram@moolenaar.net>
e2a814a
Mime-Version: 1.0
e2a814a
Content-Type: text/plain; charset=UTF-8
e2a814a
Content-Transfer-Encoding: 8bit
e2a814a
------------
e2a814a
e2a814a
Patch 7.2.333
e2a814a
Problem:    Warnings from static code analysis.
e2a814a
Solution:   Small changes to various lines. (Dominique Pelle)
e2a814a
Files:	    src/buffer.c, src/edit.c, src/ex_getln.c, src/fileio.c,
e2a814a
	    src/if_cscope.c, src/netbeans.c, src/ops.c, src/quickfix.c,
e2a814a
	    src/syntax.c, src/ui.c
e2a814a
e2a814a
e2a814a
*** ../vim-7.2.332/src/buffer.c	2009-05-17 13:30:58.000000000 +0200
e2a814a
--- src/buffer.c	2010-01-19 12:50:24.000000000 +0100
e2a814a
***************
e2a814a
*** 315,321 ****
e2a814a
  {
e2a814a
  #ifdef FEAT_AUTOCMD
e2a814a
      int		is_curbuf;
e2a814a
!     int		nwindows = buf->b_nwindows;
e2a814a
  #endif
e2a814a
      int		unload_buf = (action != 0);
e2a814a
      int		del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
e2a814a
--- 315,321 ----
e2a814a
  {
e2a814a
  #ifdef FEAT_AUTOCMD
e2a814a
      int		is_curbuf;
e2a814a
!     int		nwindows;
e2a814a
  #endif
e2a814a
      int		unload_buf = (action != 0);
e2a814a
      int		del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
e2a814a
*** ../vim-7.2.332/src/edit.c	2009-12-24 15:45:53.000000000 +0100
e2a814a
--- src/edit.c	2010-01-19 12:53:18.000000000 +0100
e2a814a
***************
e2a814a
*** 4048,4054 ****
e2a814a
  	    save_p_ic = p_ic;
e2a814a
  	    p_ic = ignorecase(compl_pattern);
e2a814a
  
e2a814a
! 	    /* Find up to TAG_MANY matches.  Avoids that an enourmous number
e2a814a
  	     * of matches is found when compl_pattern is empty */
e2a814a
  	    if (find_tags(compl_pattern, &num_matches, &matches,
e2a814a
  		    TAG_REGEXP | TAG_NAMES | TAG_NOIC |
e2a814a
--- 4048,4054 ----
e2a814a
  	    save_p_ic = p_ic;
e2a814a
  	    p_ic = ignorecase(compl_pattern);
e2a814a
  
e2a814a
! 	    /* Find up to TAG_MANY matches.  Avoids that an enormous number
e2a814a
  	     * of matches is found when compl_pattern is empty */
e2a814a
  	    if (find_tags(compl_pattern, &num_matches, &matches,
e2a814a
  		    TAG_REGEXP | TAG_NAMES | TAG_NOIC |
e2a814a
***************
e2a814a
*** 4219,4225 ****
e2a814a
  						 || IObuff[len - 2] == '!'))))
e2a814a
  					IObuff[len++] = ' ';
e2a814a
  				}
e2a814a
! 				/* copy as much as posible of the new word */
e2a814a
  				if (tmp_ptr - ptr >= IOSIZE - len)
e2a814a
  				    tmp_ptr = ptr + IOSIZE - len - 1;
e2a814a
  				STRNCPY(IObuff + len, ptr, tmp_ptr - ptr);
e2a814a
--- 4219,4225 ----
e2a814a
  						 || IObuff[len - 2] == '!'))))
e2a814a
  					IObuff[len++] = ' ';
e2a814a
  				}
e2a814a
! 				/* copy as much as possible of the new word */
e2a814a
  				if (tmp_ptr - ptr >= IOSIZE - len)
e2a814a
  				    tmp_ptr = ptr + IOSIZE - len - 1;
e2a814a
  				STRNCPY(IObuff + len, ptr, tmp_ptr - ptr);
e2a814a
***************
e2a814a
*** 5827,5836 ****
e2a814a
  #endif
e2a814a
  		&& !has_format_option(FO_WRAP))
e2a814a
  
e2a814a
- 	{
e2a814a
- 	    textwidth = 0;
e2a814a
  	    break;
e2a814a
- 	}
e2a814a
  	if ((startcol = curwin->w_cursor.col) == 0)
e2a814a
  	    break;
e2a814a
  
e2a814a
--- 5827,5833 ----
e2a814a
*** ../vim-7.2.332/src/ex_getln.c	2009-12-02 17:15:04.000000000 +0100
e2a814a
--- src/ex_getln.c	2010-01-19 12:54:47.000000000 +0100
e2a814a
***************
e2a814a
*** 2193,2199 ****
e2a814a
      {
e2a814a
  	if (ga_grow(&line_ga, 40) == FAIL)
e2a814a
  	    break;
e2a814a
- 	pend = (char_u *)line_ga.ga_data + line_ga.ga_len;
e2a814a
  
e2a814a
  	/* Get one character at a time.  Don't use inchar(), it can't handle
e2a814a
  	 * special characters. */
e2a814a
--- 2193,2198 ----
e2a814a
***************
e2a814a
*** 3314,3320 ****
e2a814a
  		    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
e2a814a
  							      |options, type);
e2a814a
  	    vim_free(p1);
e2a814a
! 	    /* longest match: make sure it is not shorter (happens with :help */
e2a814a
  	    if (p2 != NULL && type == WILD_LONGEST)
e2a814a
  	    {
e2a814a
  		for (j = 0; j < xp->xp_pattern_len; ++j)
e2a814a
--- 3313,3319 ----
e2a814a
  		    WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
e2a814a
  							      |options, type);
e2a814a
  	    vim_free(p1);
e2a814a
! 	    /* longest match: make sure it is not shorter, happens with :help */
e2a814a
  	    if (p2 != NULL && type == WILD_LONGEST)
e2a814a
  	    {
e2a814a
  		for (j = 0; j < xp->xp_pattern_len; ++j)
e2a814a
*** ../vim-7.2.332/src/fileio.c	2009-12-31 14:52:48.000000000 +0100
e2a814a
--- src/fileio.c	2010-01-19 12:56:59.000000000 +0100
e2a814a
***************
e2a814a
*** 7072,7079 ****
e2a814a
  	 */
e2a814a
  	for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i)
e2a814a
  	{
e2a814a
- 	    size_t	itmplen;
e2a814a
  # ifndef HAVE_MKDTEMP
e2a814a
  	    long	nr;
e2a814a
  	    long	off;
e2a814a
  # endif
e2a814a
--- 7072,7079 ----
e2a814a
  	 */
e2a814a
  	for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i)
e2a814a
  	{
e2a814a
  # ifndef HAVE_MKDTEMP
e2a814a
+ 	    size_t	itmplen;
e2a814a
  	    long	nr;
e2a814a
  	    long	off;
e2a814a
  # endif
e2a814a
***************
e2a814a
*** 7091,7097 ****
e2a814a
  		else
e2a814a
  # endif
e2a814a
  		    add_pathsep(itmp);
e2a814a
- 		itmplen = STRLEN(itmp);
e2a814a
  
e2a814a
  # ifdef HAVE_MKDTEMP
e2a814a
  		/* Leave room for filename */
e2a814a
--- 7091,7096 ----
e2a814a
***************
e2a814a
*** 7104,7109 ****
e2a814a
--- 7103,7109 ----
e2a814a
  		 * otherwise it doesn't matter.  The use of mkdir() avoids any
e2a814a
  		 * security problems because of the predictable number. */
e2a814a
  		nr = (mch_get_pid() + (long)time(NULL)) % 1000000L;
e2a814a
+ 		itmplen = STRLEN(itmp);
e2a814a
  
e2a814a
  		/* Try up to 10000 different values until we find a name that
e2a814a
  		 * doesn't exist. */
e2a814a
*** ../vim-7.2.332/src/if_cscope.c	2009-07-09 21:22:36.000000000 +0200
e2a814a
--- src/if_cscope.c	2010-01-19 12:57:58.000000000 +0100
e2a814a
***************
e2a814a
*** 2069,2075 ****
e2a814a
  	    continue;
e2a814a
  	(void)strcpy(tbuf, matches[idx]);
e2a814a
  
e2a814a
! 	if ((fname = strtok(tbuf, (const char *)"\t")) == NULL)
e2a814a
  	    continue;
e2a814a
  	if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
e2a814a
  	    continue;
e2a814a
--- 2069,2075 ----
e2a814a
  	    continue;
e2a814a
  	(void)strcpy(tbuf, matches[idx]);
e2a814a
  
e2a814a
! 	if (strtok(tbuf, (const char *)"\t") == NULL)
e2a814a
  	    continue;
e2a814a
  	if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
e2a814a
  	    continue;
e2a814a
*** ../vim-7.2.332/src/netbeans.c	2009-09-11 14:19:41.000000000 +0200
e2a814a
--- src/netbeans.c	2010-01-19 13:57:11.000000000 +0100
e2a814a
***************
e2a814a
*** 873,879 ****
e2a814a
      {
e2a814a
  #ifdef NBDEBUG
e2a814a
  	/*
e2a814a
! 	 * This happens because the ExtEd can send a cammand or 2 after
e2a814a
  	 * doing a stopDocumentListen command. It doesn't harm anything
e2a814a
  	 * so I'm disabling it except for debugging.
e2a814a
  	 */
e2a814a
--- 883,889 ----
e2a814a
      {
e2a814a
  #ifdef NBDEBUG
e2a814a
  	/*
e2a814a
! 	 * This happens because the ExtEd can send a command or 2 after
e2a814a
  	 * doing a stopDocumentListen command. It doesn't harm anything
e2a814a
  	 * so I'm disabling it except for debugging.
e2a814a
  	 */
e2a814a
***************
e2a814a
*** 1174,1180 ****
e2a814a
  		break;
e2a814a
  	}
e2a814a
      }
e2a814a
!     *q++ = '\0';
e2a814a
  
e2a814a
      return buf;
e2a814a
  }
e2a814a
--- 1184,1190 ----
e2a814a
  		break;
e2a814a
  	}
e2a814a
      }
e2a814a
!     *q = '\0';
e2a814a
  
e2a814a
      return buf;
e2a814a
  }
e2a814a
***************
e2a814a
*** 3070,3076 ****
e2a814a
  }
e2a814a
  
e2a814a
  /*
e2a814a
!  * Send netbeans an unmodufied command.
e2a814a
   */
e2a814a
      void
e2a814a
  netbeans_unmodified(buf_T *bufp UNUSED)
e2a814a
--- 3080,3086 ----
e2a814a
  }
e2a814a
  
e2a814a
  /*
e2a814a
!  * Send netbeans an unmodified command.
e2a814a
   */
e2a814a
      void
e2a814a
  netbeans_unmodified(buf_T *bufp UNUSED)
e2a814a
***************
e2a814a
*** 3366,3372 ****
e2a814a
  
e2a814a
  
e2a814a
  /*
e2a814a
!  * Add a sign of the reqested type at the requested location.
e2a814a
   *
e2a814a
   * Reverse engineering:
e2a814a
   * Apparently an annotation is defined the first time it is used in a buffer.
e2a814a
--- 3380,3386 ----
e2a814a
  
e2a814a
  
e2a814a
  /*
e2a814a
!  * Add a sign of the requested type at the requested location.
e2a814a
   *
e2a814a
   * Reverse engineering:
e2a814a
   * Apparently an annotation is defined the first time it is used in a buffer.
e2a814a
*** ../vim-7.2.332/src/ops.c	2009-11-25 12:38:49.000000000 +0100
e2a814a
--- src/ops.c	2010-01-19 13:04:46.000000000 +0100
e2a814a
***************
e2a814a
*** 5591,5603 ****
e2a814a
  	 */
e2a814a
  	if (has_mbyte)
e2a814a
  	{
e2a814a
- 	    char_u	*conv_str = str;
e2a814a
  	    vimconv_T	vc;
e2a814a
  
e2a814a
  	    vc.vc_type = CONV_NONE;
e2a814a
  	    if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK)
e2a814a
  	    {
e2a814a
! 	        int intlen = len;
e2a814a
  
e2a814a
  		conv_str = string_convert(&vc, str, &intlen);
e2a814a
  		len = intlen;
e2a814a
--- 5598,5610 ----
e2a814a
  	 */
e2a814a
  	if (has_mbyte)
e2a814a
  	{
e2a814a
  	    vimconv_T	vc;
e2a814a
  
e2a814a
  	    vc.vc_type = CONV_NONE;
e2a814a
  	    if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK)
e2a814a
  	    {
e2a814a
! 		int	intlen = len;
e2a814a
! 		char_u	*conv_str;
e2a814a
  
e2a814a
  		conv_str = string_convert(&vc, str, &intlen);
e2a814a
  		len = intlen;
e2a814a
*** ../vim-7.2.332/src/quickfix.c	2009-06-24 17:31:27.000000000 +0200
e2a814a
--- src/quickfix.c	2010-01-19 13:12:29.000000000 +0100
e2a814a
***************
e2a814a
*** 1899,1905 ****
e2a814a
      int		i;
e2a814a
      int		idx1 = 1;
e2a814a
      int		idx2 = -1;
e2a814a
-     int		need_return = TRUE;
e2a814a
      char_u	*arg = eap->arg;
e2a814a
      int		all = eap->forceit;	/* if not :cl!, only show
e2a814a
  						   recognised errors */
e2a814a
--- 1899,1904 ----
e2a814a
***************
e2a814a
*** 1939,1951 ****
e2a814a
      {
e2a814a
  	if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
e2a814a
  	{
e2a814a
! 	    if (need_return)
e2a814a
! 	    {
e2a814a
! 		msg_putchar('\n');
e2a814a
! 		if (got_int)
e2a814a
! 		    break;
e2a814a
! 		need_return = FALSE;
e2a814a
! 	    }
e2a814a
  
e2a814a
  	    fname = NULL;
e2a814a
  	    if (qfp->qf_fnum != 0
e2a814a
--- 1938,1946 ----
e2a814a
      {
e2a814a
  	if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2)
e2a814a
  	{
e2a814a
! 	    msg_putchar('\n');
e2a814a
! 	    if (got_int)
e2a814a
! 		break;
e2a814a
  
e2a814a
  	    fname = NULL;
e2a814a
  	    if (qfp->qf_fnum != 0
e2a814a
***************
e2a814a
*** 1988,1994 ****
e2a814a
  							      IObuff, IOSIZE);
e2a814a
  	    msg_prt_line(IObuff, FALSE);
e2a814a
  	    out_flush();		/* show one line at a time */
e2a814a
- 	    need_return = TRUE;
e2a814a
  	}
e2a814a
  
e2a814a
  	qfp = qfp->qf_next;
e2a814a
--- 1983,1988 ----
e2a814a
*** ../vim-7.2.332/src/syntax.c	2009-12-16 18:13:04.000000000 +0100
e2a814a
--- src/syntax.c	2010-01-19 13:12:56.000000000 +0100
e2a814a
***************
e2a814a
*** 4167,4173 ****
e2a814a
  	if (!HASHITEM_EMPTY(hi))
e2a814a
  	{
e2a814a
  	    --todo;
e2a814a
- 	    kp = HI2KE(hi);
e2a814a
  	    for (kp = HI2KE(hi); kp != NULL; kp = kp_next)
e2a814a
  	    {
e2a814a
  		kp_next = kp->ke_next;
e2a814a
--- 4167,4172 ----
e2a814a
*** ../vim-7.2.332/src/ui.c	2009-09-11 16:48:06.000000000 +0200
e2a814a
--- src/ui.c	2010-01-19 13:14:04.000000000 +0100
e2a814a
***************
e2a814a
*** 2383,2389 ****
e2a814a
  	 * 'enc' anyway. */
e2a814a
  	if (has_mbyte)
e2a814a
  	{
e2a814a
! 	    char_u	*conv_buf = buffer;
e2a814a
  	    vimconv_T	vc;
e2a814a
  
e2a814a
  	    vc.vc_type = CONV_NONE;
e2a814a
--- 2383,2389 ----
e2a814a
  	 * 'enc' anyway. */
e2a814a
  	if (has_mbyte)
e2a814a
  	{
e2a814a
! 	    char_u	*conv_buf;
e2a814a
  	    vimconv_T	vc;
e2a814a
  
e2a814a
  	    vc.vc_type = CONV_NONE;
e2a814a
*** ../vim-7.2.332/src/version.c	2010-01-19 13:06:42.000000000 +0100
e2a814a
--- src/version.c	2010-01-19 14:55:50.000000000 +0100
e2a814a
***************
e2a814a
*** 683,684 ****
e2a814a
--- 683,686 ----
e2a814a
  {   /* Add new patch number below this line */
e2a814a
+ /**/
e2a814a
+     333,
e2a814a
  /**/
e2a814a
e2a814a
-- 
e2a814a
An actual excerpt from a classified section of a city newspaper:
e2a814a
"Illiterate?  Write today for free help!"
e2a814a
e2a814a
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
e2a814a
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
e2a814a
\\\        download, build and distribute -- http://www.A-A-P.org        ///
e2a814a
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///