summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0297
blob: c91b19222cea39df4db5c337f6ab1c0a534501bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0297
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0297 (after 8.1.0294)
Problem:    MS-Windows: tests fail, Vim crashes.
Solution:   Fix long file name handling.
Files:	    src/os_win32.c


*** ../vim-8.1.0296/src/os_win32.c	2018-08-18 20:20:23.335417254 +0200
--- src/os_win32.c	2018-08-19 14:36:25.032599518 +0200
***************
*** 3109,3114 ****
--- 3109,3115 ----
      int		len)
  {
      char_u  abuf[_MAX_PATH + 1];
+     DWORD   lfnlen;
  
      /*
       * Originally this was:
***************
*** 3124,3134 ****
  	if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
  	{
  	    WCHAR   wcbuf[_MAX_PATH + 1];
! 	    char_u  *p;
  
  	    if (GetLongPathNameW(wbuf, wcbuf, _MAX_PATH) != 0)
  		p = utf16_to_enc(wcbuf, NULL);
! 	    else
  		p = utf16_to_enc(wbuf, NULL);
  
  	    if (p != NULL)
--- 3125,3143 ----
  	if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
  	{
  	    WCHAR   wcbuf[_MAX_PATH + 1];
! 	    char_u  *p = NULL;
  
  	    if (GetLongPathNameW(wbuf, wcbuf, _MAX_PATH) != 0)
+ 	    {
  		p = utf16_to_enc(wcbuf, NULL);
! 		if (STRLEN(p) >= (size_t)len)
! 		{
! 		    // long path name is too long, fall back to short one
! 		    vim_free(p);
! 		    p = NULL;
! 		}
! 	    }
! 	    if (p == NULL)
  		p = utf16_to_enc(wbuf, NULL);
  
  	    if (p != NULL)
***************
*** 3143,3153 ****
  #endif
      if (GetCurrentDirectory(len, (LPSTR)buf) == 0)
  	return FAIL;
!     if (GetLongPathNameA((LPSTR)buf, (LPSTR)abuf, _MAX_PATH) == 0)
! 	// return the short path name
  	return OK;
  
!     vim_strncpy(abuf, buf, len - 1);
      return OK;
  }
  
--- 3152,3164 ----
  #endif
      if (GetCurrentDirectory(len, (LPSTR)buf) == 0)
  	return FAIL;
!     lfnlen = GetLongPathNameA((LPCSTR)buf, (LPSTR)abuf, _MAX_PATH);
!     if (lfnlen == 0 || lfnlen >= (DWORD)len)
! 	// Failed to get long path name or it's too long: fall back to the
! 	// short path name.
  	return OK;
  
!     STRCPY(buf, abuf);
      return OK;
  }
  
*** ../vim-8.1.0296/src/version.c	2018-08-18 21:23:00.787474060 +0200
--- src/version.c	2018-08-19 14:33:49.277455703 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     297,
  /**/

-- 
The most powerful force in the universe is gossip.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///