mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
c1a3d289d6
commit
9a5e87ac83
@ -12417,7 +12417,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
|
|||||||
is_relative_to_current = TRUE;
|
is_relative_to_current = TRUE;
|
||||||
|
|
||||||
len = STRLEN(p);
|
len = STRLEN(p);
|
||||||
if (len > 0 && after_pathsep(p, p + len)) {
|
if (len > 0 && after_pathsep((char *)p, (char *)p + len)) {
|
||||||
has_trailing_pathsep = TRUE;
|
has_trailing_pathsep = TRUE;
|
||||||
p[len - 1] = NUL; /* the trailing slash breaks readlink() */
|
p[len - 1] = NUL; /* the trailing slash breaks readlink() */
|
||||||
}
|
}
|
||||||
@ -12531,7 +12531,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
|
|||||||
* if the argument had none. But keep "/" or "//". */
|
* if the argument had none. But keep "/" or "//". */
|
||||||
if (!has_trailing_pathsep) {
|
if (!has_trailing_pathsep) {
|
||||||
q = p + STRLEN(p);
|
q = p + STRLEN(p);
|
||||||
if (after_pathsep(p, q))
|
if (after_pathsep((char *)p, (char *)q))
|
||||||
*path_tail_with_sep(p) = NUL;
|
*path_tail_with_sep(p) = NUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19921,7 +19921,7 @@ repeat:
|
|||||||
valid |= VALID_HEAD;
|
valid |= VALID_HEAD;
|
||||||
*usedlen += 2;
|
*usedlen += 2;
|
||||||
s = get_past_head(*fnamep);
|
s = get_past_head(*fnamep);
|
||||||
while (tail > s && after_pathsep(s, tail))
|
while (tail > s && after_pathsep((char *)s, (char *)tail))
|
||||||
mb_ptr_back(*fnamep, tail);
|
mb_ptr_back(*fnamep, tail);
|
||||||
*fnamelen = (int)(tail - *fnamep);
|
*fnamelen = (int)(tail - *fnamep);
|
||||||
if (*fnamelen == 0) {
|
if (*fnamelen == 0) {
|
||||||
@ -19930,7 +19930,7 @@ repeat:
|
|||||||
*bufp = *fnamep = tail = vim_strsave((char_u *)".");
|
*bufp = *fnamep = tail = vim_strsave((char_u *)".");
|
||||||
*fnamelen = 1;
|
*fnamelen = 1;
|
||||||
} else {
|
} else {
|
||||||
while (tail > s && !after_pathsep(s, tail))
|
while (tail > s && !after_pathsep((char *)s, (char *)tail))
|
||||||
mb_ptr_back(*fnamep, tail);
|
mb_ptr_back(*fnamep, tail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ readfile (
|
|||||||
*/
|
*/
|
||||||
if (fname != NULL && *fname != NUL) {
|
if (fname != NULL && *fname != NUL) {
|
||||||
p = fname + STRLEN(fname);
|
p = fname + STRLEN(fname);
|
||||||
if (after_pathsep(fname, p) || STRLEN(fname) >= MAXPATHL) {
|
if (after_pathsep((char *)fname, (char *)p) || STRLEN(fname) >= MAXPATHL) {
|
||||||
filemess(curbuf, fname, (char_u *)_("Illegal file name"), 0);
|
filemess(curbuf, fname, (char_u *)_("Illegal file name"), 0);
|
||||||
msg_end();
|
msg_end();
|
||||||
msg_scroll = msg_save;
|
msg_scroll = msg_save;
|
||||||
@ -4369,7 +4369,7 @@ modname (
|
|||||||
xfree(retval);
|
xfree(retval);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!after_pathsep(retval, retval + fnamelen)) {
|
if (!after_pathsep((char *)retval, (char *)retval + fnamelen)) {
|
||||||
retval[fnamelen++] = PATHSEP;
|
retval[fnamelen++] = PATHSEP;
|
||||||
retval[fnamelen] = NUL;
|
retval[fnamelen] = NUL;
|
||||||
}
|
}
|
||||||
|
@ -1340,7 +1340,7 @@ recover_names (
|
|||||||
num_names = 3;
|
num_names = 3;
|
||||||
} else {
|
} else {
|
||||||
p = dir_name + STRLEN(dir_name);
|
p = dir_name + STRLEN(dir_name);
|
||||||
if (after_pathsep(dir_name, p) && p[-1] == p[-2]) {
|
if (after_pathsep((char *)dir_name, (char *)p) && p[-1] == p[-2]) {
|
||||||
/* Ends with '//', Use Full path for swap name */
|
/* Ends with '//', Use Full path for swap name */
|
||||||
tail = make_percent_swname(dir_name, fname_res);
|
tail = make_percent_swname(dir_name, fname_res);
|
||||||
} else {
|
} else {
|
||||||
@ -3066,7 +3066,7 @@ char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
s = dir_name + STRLEN(dir_name);
|
s = dir_name + STRLEN(dir_name);
|
||||||
if (after_pathsep(dir_name, s) && s[-1] == s[-2]) { /* Ends with '//', Use Full path */
|
if (after_pathsep((char *)dir_name, (char *)s) && s[-1] == s[-2]) { /* Ends with '//', Use Full path */
|
||||||
r = NULL;
|
r = NULL;
|
||||||
if ((s = make_percent_swname(dir_name, fname)) != NULL) {
|
if ((s = make_percent_swname(dir_name, fname)) != NULL) {
|
||||||
r = modname(s, (char_u *)".swp", FALSE);
|
r = modname(s, (char_u *)".swp", FALSE);
|
||||||
|
@ -343,7 +343,7 @@ void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, bool esc, bool one,
|
|||||||
c = (int)STRLEN(var);
|
c = (int)STRLEN(var);
|
||||||
/* if var[] ends in a path separator and tail[] starts
|
/* if var[] ends in a path separator and tail[] starts
|
||||||
* with it, skip a character */
|
* with it, skip a character */
|
||||||
if (*var != NUL && after_pathsep(dst, dst + c)
|
if (*var != NUL && after_pathsep((char *)dst, (char *)dst + c)
|
||||||
#if defined(BACKSLASH_IN_FILENAME)
|
#if defined(BACKSLASH_IN_FILENAME)
|
||||||
&& dst[-1] != ':'
|
&& dst[-1] != ':'
|
||||||
#endif
|
#endif
|
||||||
@ -410,7 +410,7 @@ static char *remove_tail(char *p, char *pend, char *name)
|
|||||||
|
|
||||||
if (newend >= p
|
if (newend >= p
|
||||||
&& fnamencmp((char_u *)newend, (char_u *)name, len - 1) == 0
|
&& fnamencmp((char_u *)newend, (char_u *)name, len - 1) == 0
|
||||||
&& (newend == p || after_pathsep((char_u *)p, (char_u *)newend)))
|
&& (newend == p || after_pathsep(p, newend)))
|
||||||
return newend;
|
return newend;
|
||||||
return pend;
|
return pend;
|
||||||
}
|
}
|
||||||
@ -488,7 +488,7 @@ char_u *vim_getenv(char_u *name, bool *mustfree)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* remove trailing path separator */
|
/* remove trailing path separator */
|
||||||
if (pend > p && after_pathsep(p, pend))
|
if (pend > p && after_pathsep((char *)p, (char *)pend))
|
||||||
--pend;
|
--pend;
|
||||||
|
|
||||||
// check that the result is a directory name
|
// check that the result is a directory name
|
||||||
|
@ -122,7 +122,7 @@ char_u *path_tail_with_sep(char_u *fname)
|
|||||||
// Don't remove the '/' from "c:/file".
|
// Don't remove the '/' from "c:/file".
|
||||||
char_u *past_head = get_past_head(fname);
|
char_u *past_head = get_past_head(fname);
|
||||||
char_u *tail = path_tail(fname);
|
char_u *tail = path_tail(fname);
|
||||||
while (tail > past_head && after_pathsep(fname, tail)) {
|
while (tail > past_head && after_pathsep((char *)fname, (char *)tail)) {
|
||||||
tail--;
|
tail--;
|
||||||
}
|
}
|
||||||
return tail;
|
return tail;
|
||||||
@ -353,7 +353,7 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep)
|
|||||||
*/
|
*/
|
||||||
void add_pathsep(char_u *p)
|
void add_pathsep(char_u *p)
|
||||||
{
|
{
|
||||||
if (*p != NUL && !after_pathsep(p, p + STRLEN(p)))
|
if (*p != NUL && !after_pathsep((char *)p, (char *)p + STRLEN(p)))
|
||||||
STRCAT(p, PATHSEPSTR);
|
STRCAT(p, PATHSEPSTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,7 +1356,7 @@ void simplify_filename(char_u *filename)
|
|||||||
|
|
||||||
--p;
|
--p;
|
||||||
/* Skip back to after previous '/'. */
|
/* Skip back to after previous '/'. */
|
||||||
while (p > start && !after_pathsep(start, p))
|
while (p > start && !after_pathsep((char *)start, (char *)p))
|
||||||
mb_ptr_back(start, p);
|
mb_ptr_back(start, p);
|
||||||
|
|
||||||
if (!do_strip) {
|
if (!do_strip) {
|
||||||
@ -1682,10 +1682,10 @@ void path_fix_case(char_u *name)
|
|||||||
* Takes care of multi-byte characters.
|
* Takes care of multi-byte characters.
|
||||||
* "b" must point to the start of the file name
|
* "b" must point to the start of the file name
|
||||||
*/
|
*/
|
||||||
int after_pathsep(char_u *b, char_u *p)
|
int after_pathsep(char *b, char *p)
|
||||||
{
|
{
|
||||||
return p > b && vim_ispathsep(p[-1])
|
return p > b && vim_ispathsep(p[-1])
|
||||||
&& (!has_mbyte || (*mb_head_off)(b, p - 1) == 0);
|
&& (!has_mbyte || (*mb_head_off)((char_u *)b, (char_u *)p - 1) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1761,7 +1761,7 @@ int pathcmp(const char *p, const char *q, int maxlen)
|
|||||||
/* ignore a trailing slash, but not "//" or ":/" */
|
/* ignore a trailing slash, but not "//" or ":/" */
|
||||||
if (c2 == NUL
|
if (c2 == NUL
|
||||||
&& i > 0
|
&& i > 0
|
||||||
&& !after_pathsep((char_u *)s, (char_u *)s + i)
|
&& !after_pathsep((char *)s, (char *)s + i)
|
||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
&& (c1 == '/' || c1 == '\\')
|
&& (c1 == '/' || c1 == '\\')
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user