Karsten Hopp 8af7c2
To: vim-dev@vim.org
Karsten Hopp 8af7c2
Subject: Patch 7.1.304
Karsten Hopp 8af7c2
Fcc: outbox
Karsten Hopp 8af7c2
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 8af7c2
Mime-Version: 1.0
Karsten Hopp 8af7c2
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 8af7c2
Content-Transfer-Encoding: 8bit
Karsten Hopp 8af7c2
------------
Karsten Hopp 8af7c2
Karsten Hopp 8af7c2
Patch 7.1.304
Karsten Hopp 8af7c2
Problem:    Shortpath_for_invalid_fname() does not work correctly and is
Karsten Hopp 8af7c2
	    unnecessary complex.
Karsten Hopp 8af7c2
Solution:   Clean up shortpath_for_invalid_fname(). (mostly by Yegappan
Karsten Hopp 8af7c2
	    Lakshmanan)
Karsten Hopp 8af7c2
Files:	    src/eval.c
Karsten Hopp 8af7c2
Karsten Hopp 8af7c2
Karsten Hopp 8af7c2
*** ../vim-7.1.303/src/eval.c	Wed May 28 16:48:01 2008
Karsten Hopp 8af7c2
--- src/eval.c	Wed May 28 16:35:51 2008
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21068,21075 ****
Karsten Hopp 8af7c2
  static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen));
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  /*
Karsten Hopp 8af7c2
!  * Get the short pathname of a file.
Karsten Hopp 8af7c2
!  * Returns 1 on success. *fnamelen is 0 for nonexistent path.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      static int
Karsten Hopp 8af7c2
  get_short_pathname(fnamep, bufp, fnamelen)
Karsten Hopp 8af7c2
--- 21476,21487 ----
Karsten Hopp 8af7c2
  static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen));
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  /*
Karsten Hopp 8af7c2
!  * Get the short path (8.3) for the filename in "fnamep".
Karsten Hopp 8af7c2
!  * Only works for a valid file name.
Karsten Hopp 8af7c2
!  * When the path gets longer "fnamep" is changed and the allocated buffer
Karsten Hopp 8af7c2
!  * is put in "bufp".
Karsten Hopp 8af7c2
!  * *fnamelen is the length of "fnamep" and set to 0 for a nonexistent path.
Karsten Hopp 8af7c2
!  * Returns OK on success, FAIL on failure.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      static int
Karsten Hopp 8af7c2
  get_short_pathname(fnamep, bufp, fnamelen)
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21077,21112 ****
Karsten Hopp 8af7c2
      char_u	**bufp;
Karsten Hopp 8af7c2
      int		*fnamelen;
Karsten Hopp 8af7c2
  {
Karsten Hopp 8af7c2
!     int		l,len;
Karsten Hopp 8af7c2
      char_u	*newbuf;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      len = *fnamelen;
Karsten Hopp 8af7c2
- 
Karsten Hopp 8af7c2
      l = GetShortPathName(*fnamep, *fnamep, len);
Karsten Hopp 8af7c2
      if (l > len - 1)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
  	/* If that doesn't work (not enough space), then save the string
Karsten Hopp 8af7c2
! 	 * and try again with a new buffer big enough
Karsten Hopp 8af7c2
! 	 */
Karsten Hopp 8af7c2
  	newbuf = vim_strnsave(*fnamep, l);
Karsten Hopp 8af7c2
  	if (newbuf == NULL)
Karsten Hopp 8af7c2
! 	    return 0;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  	vim_free(*bufp);
Karsten Hopp 8af7c2
  	*fnamep = *bufp = newbuf;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
! 	l = GetShortPathName(*fnamep,*fnamep,l+1);
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! 	/* Really should always succeed, as the buffer is big enough */
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      *fnamelen = l;
Karsten Hopp 8af7c2
!     return 1;
Karsten Hopp 8af7c2
  }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  /*
Karsten Hopp 8af7c2
!  * Create a short path name.  Returns the length of the buffer it needs.
Karsten Hopp 8af7c2
!  * Doesn't copy over the end of the buffer passed in.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      static int
Karsten Hopp 8af7c2
  shortpath_for_invalid_fname(fname, bufp, fnamelen)
Karsten Hopp 8af7c2
--- 21489,21532 ----
Karsten Hopp 8af7c2
      char_u	**bufp;
Karsten Hopp 8af7c2
      int		*fnamelen;
Karsten Hopp 8af7c2
  {
Karsten Hopp 8af7c2
!     int		l, len;
Karsten Hopp 8af7c2
      char_u	*newbuf;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      len = *fnamelen;
Karsten Hopp 8af7c2
      l = GetShortPathName(*fnamep, *fnamep, len);
Karsten Hopp 8af7c2
      if (l > len - 1)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
  	/* If that doesn't work (not enough space), then save the string
Karsten Hopp 8af7c2
! 	 * and try again with a new buffer big enough. */
Karsten Hopp 8af7c2
  	newbuf = vim_strnsave(*fnamep, l);
Karsten Hopp 8af7c2
  	if (newbuf == NULL)
Karsten Hopp 8af7c2
! 	    return FAIL;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  	vim_free(*bufp);
Karsten Hopp 8af7c2
  	*fnamep = *bufp = newbuf;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
! 	/* Really should always succeed, as the buffer is big enough. */
Karsten Hopp 8af7c2
! 	l = GetShortPathName(*fnamep, *fnamep, l+1);
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      *fnamelen = l;
Karsten Hopp 8af7c2
!     return OK;
Karsten Hopp 8af7c2
  }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  /*
Karsten Hopp 8af7c2
!  * Get the short path (8.3) for the filename in "fname". The converted
Karsten Hopp 8af7c2
!  * path is returned in "bufp".
Karsten Hopp 8af7c2
!  *
Karsten Hopp 8af7c2
!  * Some of the directories specified in "fname" may not exist. This function
Karsten Hopp 8af7c2
!  * will shorten the existing directories at the beginning of the path and then
Karsten Hopp 8af7c2
!  * append the remaining non-existing path.
Karsten Hopp 8af7c2
!  *
Karsten Hopp 8af7c2
!  * fname - Pointer to the filename to shorten.  On return, contains the
Karsten Hopp 8af7c2
!  *         pointer to the shortened pathname
Karsten Hopp 8af7c2
!  * bufp -  Pointer to an allocated buffer for the filename.
Karsten Hopp 8af7c2
!  * fnamelen - Length of the filename pointed to by fname
Karsten Hopp 8af7c2
!  *
Karsten Hopp 8af7c2
!  * Returns OK on success (or nothing done) and FAIL on failure (out of memory).
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      static int
Karsten Hopp 8af7c2
  shortpath_for_invalid_fname(fname, bufp, fnamelen)
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21114,21198 ****
Karsten Hopp 8af7c2
      char_u	**bufp;
Karsten Hopp 8af7c2
      int		*fnamelen;
Karsten Hopp 8af7c2
  {
Karsten Hopp 8af7c2
!     char_u	*s, *p, *pbuf2, *pbuf3;
Karsten Hopp 8af7c2
      char_u	ch;
Karsten Hopp 8af7c2
!     int		len, len2, plen, slen;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      /* Make a copy */
Karsten Hopp 8af7c2
!     len2 = *fnamelen;
Karsten Hopp 8af7c2
!     pbuf2 = vim_strnsave(*fname, len2);
Karsten Hopp 8af7c2
!     pbuf3 = NULL;
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
!     s = pbuf2 + len2 - 1; /* Find the end */
Karsten Hopp 8af7c2
!     slen = 1;
Karsten Hopp 8af7c2
!     plen = len2;
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
!     if (after_pathsep(pbuf2, s + 1))
Karsten Hopp 8af7c2
!     {
Karsten Hopp 8af7c2
! 	--s;
Karsten Hopp 8af7c2
! 	++slen;
Karsten Hopp 8af7c2
! 	--plen;
Karsten Hopp 8af7c2
!     }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     do
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
! 	/* Go back one path-separator */
Karsten Hopp 8af7c2
! 	while (s > pbuf2 && !after_pathsep(pbuf2, s + 1))
Karsten Hopp 8af7c2
! 	{
Karsten Hopp 8af7c2
! 	    --s;
Karsten Hopp 8af7c2
! 	    ++slen;
Karsten Hopp 8af7c2
! 	    --plen;
Karsten Hopp 8af7c2
! 	}
Karsten Hopp 8af7c2
! 	if (s <= pbuf2)
Karsten Hopp 8af7c2
! 	    break;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
! 	/* Remember the character that is about to be splatted */
Karsten Hopp 8af7c2
! 	ch = *s;
Karsten Hopp 8af7c2
! 	*s = 0; /* get_short_pathname requires a null-terminated string */
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! 	/* Try it in situ */
Karsten Hopp 8af7c2
! 	p = pbuf2;
Karsten Hopp 8af7c2
! 	if (!get_short_pathname(&p, &pbuf3, &plen))
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    vim_free(pbuf2);
Karsten Hopp 8af7c2
! 	    return -1;
Karsten Hopp 8af7c2
  	}
Karsten Hopp 8af7c2
! 	*s = ch;    /* Preserve the string */
Karsten Hopp 8af7c2
!     } while (plen == 0);
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     if (plen > 0)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
! 	/* Remember the length of the new string.  */
Karsten Hopp 8af7c2
! 	*fnamelen = len = plen + slen;
Karsten Hopp 8af7c2
  	vim_free(*bufp);
Karsten Hopp 8af7c2
! 	if (len > len2)
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    /* If there's not enough space in the currently allocated string,
Karsten Hopp 8af7c2
! 	     * then copy it to a buffer big enough.
Karsten Hopp 8af7c2
! 	     */
Karsten Hopp 8af7c2
! 	    *fname= *bufp = vim_strnsave(p, len);
Karsten Hopp 8af7c2
  	    if (*fname == NULL)
Karsten Hopp 8af7c2
! 		return -1;
Karsten Hopp 8af7c2
  	}
Karsten Hopp 8af7c2
  	else
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    /* Transfer pbuf2 to being the main buffer  (it's big enough) */
Karsten Hopp 8af7c2
! 	    *fname = *bufp = pbuf2;
Karsten Hopp 8af7c2
! 	    if (p != pbuf2)
Karsten Hopp 8af7c2
! 		strncpy(*fname, p, plen);
Karsten Hopp 8af7c2
! 	    pbuf2 = NULL;
Karsten Hopp 8af7c2
! 	}
Karsten Hopp 8af7c2
! 	/* Concat the next bit */
Karsten Hopp 8af7c2
! 	strncpy(*fname + plen, s, slen);
Karsten Hopp 8af7c2
! 	(*fname)[len] = '\0';
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
!     vim_free(pbuf3);
Karsten Hopp 8af7c2
!     vim_free(pbuf2);
Karsten Hopp 8af7c2
!     return 0;
Karsten Hopp 8af7c2
  }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  /*
Karsten Hopp 8af7c2
   * Get a pathname for a partial path.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      static int
Karsten Hopp 8af7c2
  shortpath_for_partial(fnamep, bufp, fnamelen)
Karsten Hopp 8af7c2
--- 21534,21639 ----
Karsten Hopp 8af7c2
      char_u	**bufp;
Karsten Hopp 8af7c2
      int		*fnamelen;
Karsten Hopp 8af7c2
  {
Karsten Hopp 8af7c2
!     char_u	*short_fname, *save_fname, *pbuf_unused;
Karsten Hopp 8af7c2
!     char_u	*endp, *save_endp;
Karsten Hopp 8af7c2
      char_u	ch;
Karsten Hopp 8af7c2
!     int		old_len, len;
Karsten Hopp 8af7c2
!     int		new_len, sfx_len;
Karsten Hopp 8af7c2
!     int		retval = OK;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      /* Make a copy */
Karsten Hopp 8af7c2
!     old_len = *fnamelen;
Karsten Hopp 8af7c2
!     save_fname = vim_strnsave(*fname, old_len);
Karsten Hopp 8af7c2
!     pbuf_unused = NULL;
Karsten Hopp 8af7c2
!     short_fname = NULL;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     endp = save_fname + old_len - 1; /* Find the end of the copy */
Karsten Hopp 8af7c2
!     save_endp = endp;
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
!     /*
Karsten Hopp 8af7c2
!      * Try shortening the supplied path till it succeeds by removing one
Karsten Hopp 8af7c2
!      * directory at a time from the tail of the path.
Karsten Hopp 8af7c2
!      */
Karsten Hopp 8af7c2
!     len = 0;
Karsten Hopp 8af7c2
!     for (;;)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
! 	/* go back one path-separator */
Karsten Hopp 8af7c2
! 	while (endp > save_fname && !after_pathsep(save_fname, endp + 1))
Karsten Hopp 8af7c2
! 	    --endp;
Karsten Hopp 8af7c2
! 	if (endp <= save_fname)
Karsten Hopp 8af7c2
! 	    break;		/* processed the complete path */
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
! 	/*
Karsten Hopp 8af7c2
! 	 * Replace the path separator with a NUL and try to shorten the
Karsten Hopp 8af7c2
! 	 * resulting path.
Karsten Hopp 8af7c2
! 	 */
Karsten Hopp 8af7c2
! 	ch = *endp;
Karsten Hopp 8af7c2
! 	*endp = 0;
Karsten Hopp 8af7c2
! 	short_fname = save_fname;
Karsten Hopp 8af7c2
! 	len = STRLEN(short_fname) + 1;
Karsten Hopp 8af7c2
! 	if (get_short_pathname(&short_fname, &pbuf_unused, &len) == FAIL)
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    retval = FAIL;
Karsten Hopp 8af7c2
! 	    goto theend;
Karsten Hopp 8af7c2
  	}
Karsten Hopp 8af7c2
! 	*endp = ch;	/* preserve the string */
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! 	if (len > 0)
Karsten Hopp 8af7c2
! 	    break;	/* successfully shortened the path */
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
! 	/* failed to shorten the path. Skip the path separator */
Karsten Hopp 8af7c2
! 	--endp;
Karsten Hopp 8af7c2
!     }
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
!     if (len > 0)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
! 	/*
Karsten Hopp 8af7c2
! 	 * Succeeded in shortening the path. Now concatenate the shortened
Karsten Hopp 8af7c2
! 	 * path with the remaining path at the tail.
Karsten Hopp 8af7c2
! 	 */
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! 	/* Compute the length of the new path. */
Karsten Hopp 8af7c2
! 	sfx_len = (int)(save_endp - endp) + 1;
Karsten Hopp 8af7c2
! 	new_len = len + sfx_len;
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! 	*fnamelen = new_len;
Karsten Hopp 8af7c2
  	vim_free(*bufp);
Karsten Hopp 8af7c2
! 	if (new_len > old_len)
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    /* There is not enough space in the currently allocated string,
Karsten Hopp 8af7c2
! 	     * copy it to a buffer big enough. */
Karsten Hopp 8af7c2
! 	    *fname = *bufp = vim_strnsave(short_fname, new_len);
Karsten Hopp 8af7c2
  	    if (*fname == NULL)
Karsten Hopp 8af7c2
! 	    {
Karsten Hopp 8af7c2
! 		retval = FAIL;
Karsten Hopp 8af7c2
! 		goto theend;
Karsten Hopp 8af7c2
! 	    }
Karsten Hopp 8af7c2
  	}
Karsten Hopp 8af7c2
  	else
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    /* Transfer short_fname to the main buffer (it's big enough),
Karsten Hopp 8af7c2
! 	     * unless get_short_pathname() did its work in-place. */
Karsten Hopp 8af7c2
! 	    *fname = *bufp = save_fname;
Karsten Hopp 8af7c2
! 	    if (short_fname != save_fname)
Karsten Hopp 8af7c2
! 		vim_strncpy(save_fname, short_fname, len);
Karsten Hopp 8af7c2
! 	    save_fname = NULL;
Karsten Hopp 8af7c2
! 	}
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! 	/* concat the not-shortened part of the path */
Karsten Hopp 8af7c2
! 	vim_strncpy(*fname + len, endp, sfx_len);
Karsten Hopp 8af7c2
! 	(*fname)[new_len] = NUL;
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
! theend:
Karsten Hopp 8af7c2
!     vim_free(pbuf_unused);
Karsten Hopp 8af7c2
!     vim_free(save_fname);
Karsten Hopp 8af7c2
! 
Karsten Hopp 8af7c2
!     return retval;
Karsten Hopp 8af7c2
  }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  /*
Karsten Hopp 8af7c2
   * Get a pathname for a partial path.
Karsten Hopp 8af7c2
+  * Returns OK for success, FAIL for failure.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      static int
Karsten Hopp 8af7c2
  shortpath_for_partial(fnamep, bufp, fnamelen)
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21222,21229 ****
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      len = tflen = (int)STRLEN(tfname);
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     if (!get_short_pathname(&tfname, &pbuf, &len))
Karsten Hopp 8af7c2
! 	return -1;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      if (len == 0)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
--- 21663,21670 ----
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      len = tflen = (int)STRLEN(tfname);
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     if (get_short_pathname(&tfname, &pbuf, &len) == FAIL)
Karsten Hopp 8af7c2
! 	return FAIL;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      if (len == 0)
Karsten Hopp 8af7c2
      {
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21232,21239 ****
Karsten Hopp 8af7c2
  	 * there's not a lot of point in guessing what it might be.
Karsten Hopp 8af7c2
  	 */
Karsten Hopp 8af7c2
  	len = tflen;
Karsten Hopp 8af7c2
! 	if (shortpath_for_invalid_fname(&tfname, &pbuf, &len) == -1)
Karsten Hopp 8af7c2
! 	    return -1;
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      /* Count the paths backward to find the beginning of the desired string. */
Karsten Hopp 8af7c2
--- 21673,21680 ----
Karsten Hopp 8af7c2
  	 * there's not a lot of point in guessing what it might be.
Karsten Hopp 8af7c2
  	 */
Karsten Hopp 8af7c2
  	len = tflen;
Karsten Hopp 8af7c2
! 	if (shortpath_for_invalid_fname(&tfname, &pbuf, &len) == FAIL)
Karsten Hopp 8af7c2
! 	    return FAIL;
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
      /* Count the paths backward to find the beginning of the desired string. */
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21257,21263 ****
Karsten Hopp 8af7c2
  	if (p >= tfname)
Karsten Hopp 8af7c2
  	    *p = '~';
Karsten Hopp 8af7c2
  	else
Karsten Hopp 8af7c2
! 	    return -1;
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
      else
Karsten Hopp 8af7c2
  	++p;
Karsten Hopp 8af7c2
--- 21698,21704 ----
Karsten Hopp 8af7c2
  	if (p >= tfname)
Karsten Hopp 8af7c2
  	    *p = '~';
Karsten Hopp 8af7c2
  	else
Karsten Hopp 8af7c2
! 	    return FAIL;
Karsten Hopp 8af7c2
      }
Karsten Hopp 8af7c2
      else
Karsten Hopp 8af7c2
  	++p;
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21268,21274 ****
Karsten Hopp 8af7c2
      *bufp = pbuf;
Karsten Hopp 8af7c2
      *fnamep = p;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     return 0;
Karsten Hopp 8af7c2
  }
Karsten Hopp 8af7c2
  #endif /* WIN3264 */
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
--- 21709,21715 ----
Karsten Hopp 8af7c2
      *bufp = pbuf;
Karsten Hopp 8af7c2
      *fnamep = p;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
!     return OK;
Karsten Hopp 8af7c2
  }
Karsten Hopp 8af7c2
  #endif /* WIN3264 */
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21276,21282 ****
Karsten Hopp 8af7c2
   * Adjust a filename, according to a string of modifiers.
Karsten Hopp 8af7c2
   * *fnamep must be NUL terminated when called.  When returning, the length is
Karsten Hopp 8af7c2
   * determined by *fnamelen.
Karsten Hopp 8af7c2
!  * Returns valid flags.
Karsten Hopp 8af7c2
   * When there is an error, *fnamep is set to NULL.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      int
Karsten Hopp 8af7c2
--- 21717,21723 ----
Karsten Hopp 8af7c2
   * Adjust a filename, according to a string of modifiers.
Karsten Hopp 8af7c2
   * *fnamep must be NUL terminated when called.  When returning, the length is
Karsten Hopp 8af7c2
   * determined by *fnamelen.
Karsten Hopp 8af7c2
!  * Returns VALID_ flags or -1 for failure.
Karsten Hopp 8af7c2
   * When there is an error, *fnamep is set to NULL.
Karsten Hopp 8af7c2
   */
Karsten Hopp 8af7c2
      int
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21488,21494 ****
Karsten Hopp 8af7c2
  	 */
Karsten Hopp 8af7c2
  	if (!has_fullname && !vim_isAbsName(*fnamep))
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    if (shortpath_for_partial(fnamep, bufp, fnamelen) == -1)
Karsten Hopp 8af7c2
  		return -1;
Karsten Hopp 8af7c2
  	}
Karsten Hopp 8af7c2
  	else
Karsten Hopp 8af7c2
--- 21929,21935 ----
Karsten Hopp 8af7c2
  	 */
Karsten Hopp 8af7c2
  	if (!has_fullname && !vim_isAbsName(*fnamep))
Karsten Hopp 8af7c2
  	{
Karsten Hopp 8af7c2
! 	    if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL)
Karsten Hopp 8af7c2
  		return -1;
Karsten Hopp 8af7c2
  	}
Karsten Hopp 8af7c2
  	else
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21498,21504 ****
Karsten Hopp 8af7c2
  	    /* Simple case, already have the full-name
Karsten Hopp 8af7c2
  	     * Nearly always shorter, so try first time. */
Karsten Hopp 8af7c2
  	    l = *fnamelen;
Karsten Hopp 8af7c2
! 	    if (!get_short_pathname(fnamep, bufp, &l))
Karsten Hopp 8af7c2
  		return -1;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  	    if (l == 0)
Karsten Hopp 8af7c2
--- 21939,21945 ----
Karsten Hopp 8af7c2
  	    /* Simple case, already have the full-name
Karsten Hopp 8af7c2
  	     * Nearly always shorter, so try first time. */
Karsten Hopp 8af7c2
  	    l = *fnamelen;
Karsten Hopp 8af7c2
! 	    if (get_short_pathname(fnamep, bufp, &l) == FAIL)
Karsten Hopp 8af7c2
  		return -1;
Karsten Hopp 8af7c2
  
Karsten Hopp 8af7c2
  	    if (l == 0)
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 21506,21512 ****
Karsten Hopp 8af7c2
  		/* Couldn't find the filename.. search the paths.
Karsten Hopp 8af7c2
  		 */
Karsten Hopp 8af7c2
  		l = *fnamelen;
Karsten Hopp 8af7c2
! 		if (shortpath_for_invalid_fname(fnamep, bufp, &l ) == -1)
Karsten Hopp 8af7c2
  		    return -1;
Karsten Hopp 8af7c2
  	    }
Karsten Hopp 8af7c2
  	    *fnamelen = l;
Karsten Hopp 8af7c2
--- 21947,21953 ----
Karsten Hopp 8af7c2
  		/* Couldn't find the filename.. search the paths.
Karsten Hopp 8af7c2
  		 */
Karsten Hopp 8af7c2
  		l = *fnamelen;
Karsten Hopp 8af7c2
! 		if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL)
Karsten Hopp 8af7c2
  		    return -1;
Karsten Hopp 8af7c2
  	    }
Karsten Hopp 8af7c2
  	    *fnamelen = l;
Karsten Hopp 8af7c2
*** ../vim-7.1.303/src/version.c	Thu May 29 15:33:13 2008
Karsten Hopp 8af7c2
--- src/version.c	Thu May 29 21:41:55 2008
Karsten Hopp 8af7c2
***************
Karsten Hopp 8af7c2
*** 668,669 ****
Karsten Hopp 8af7c2
--- 673,676 ----
Karsten Hopp 8af7c2
  {   /* Add new patch number below this line */
Karsten Hopp 8af7c2
+ /**/
Karsten Hopp 8af7c2
+     304,
Karsten Hopp 8af7c2
  /**/
Karsten Hopp 8af7c2
Karsten Hopp 8af7c2
-- 
Karsten Hopp 8af7c2
"The future's already arrived - it's just not evenly distributed yet."
Karsten Hopp 8af7c2
		-- William Gibson
Karsten Hopp 8af7c2
Karsten Hopp 8af7c2
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 8af7c2
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 8af7c2
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 8af7c2
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///