aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/file_search.c12
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/path.c23
4 files changed, 18 insertions, 21 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index bae09d8c53..f782259c0d 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -7347,7 +7347,7 @@ static buf_T *find_buffer(typval_T *avar)
* buffer, these don't use the full path. */
FOR_ALL_BUFFERS(bp) {
if (bp->b_fname != NULL
- && (path_with_url(bp->b_fname)
+ && (path_with_url((char *)bp->b_fname)
|| bt_nofile(bp)
)
&& STRCMP(bp->b_fname, avar->vval.v_string) == 0) {
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index b07973853b..32e4bb4a9e 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -749,7 +749,7 @@ char_u *vim_findfile(void *search_ctx_arg)
* Expand wildcards like "*" and "$VAR".
* If the path is a URL don't try this.
*/
- if (path_with_url(dirptrs[0])) {
+ if (path_with_url((char *)dirptrs[0])) {
stackp->ffs_filearray = (char_u **)xmalloc(sizeof(char *));
stackp->ffs_filearray[0] = vim_strsave(dirptrs[0]);
stackp->ffs_filearray_size = 1;
@@ -777,7 +777,7 @@ char_u *vim_findfile(void *search_ctx_arg)
*/
for (int i = stackp->ffs_filearray_cur;
i < stackp->ffs_filearray_size; ++i) {
- if (!path_with_url(stackp->ffs_filearray[i])
+ if (!path_with_url((char *)stackp->ffs_filearray[i])
&& !os_isdir(stackp->ffs_filearray[i]))
continue; /* not a directory */
@@ -798,7 +798,7 @@ char_u *vim_findfile(void *search_ctx_arg)
suf = curbuf->b_p_sua;
for (;; ) {
/* if file exists and we didn't already find it */
- if ((path_with_url(file_path)
+ if ((path_with_url((char *)file_path)
|| (os_file_exists(file_path)
&& (search_ctx->ffsc_find_what
== FINDFILE_BOTH
@@ -836,7 +836,7 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_filearray_cur = (char_u)(i + 1);
ff_push(search_ctx, stackp);
- if (!path_with_url(file_path))
+ if (!path_with_url((char *)file_path))
simplify_filename(file_path);
if (os_dirname(ff_expand_buffer, MAXPATHL)
== OK) {
@@ -1097,7 +1097,7 @@ static int ff_check_visited(ff_visited_T **visited_list, char_u *fname, char_u *
FileID file_id;
// For an URL we only compare the name, otherwise we compare the
// device/inode.
- if (path_with_url(fname)) {
+ if (path_with_url((char *)fname)) {
STRLCPY(ff_expand_buffer, fname, MAXPATHL);
url = true;
} else {
@@ -1404,7 +1404,7 @@ find_file_in_path_option (
* filename on the first call.
*/
if (first == TRUE) {
- if (path_with_url(ff_file_to_find)) {
+ if (path_with_url((char *)ff_file_to_find)) {
file_name = vim_strsave(ff_file_to_find);
goto theend;
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index a33863b3a9..6506bbbae8 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -4310,7 +4310,7 @@ void shorten_fnames(int force)
FOR_ALL_BUFFERS(buf) {
if (buf->b_fname != NULL
&& !bt_nofile(buf)
- && !path_with_url(buf->b_fname)
+ && !path_with_url((char *)buf->b_fname)
&& (force
|| buf->b_sfname == NULL
|| path_is_absolute_path(buf->b_sfname))) {
diff --git a/src/nvim/path.c b/src/nvim/path.c
index d15dbb33fe..93e3a50488 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -734,7 +734,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
} else if (buf[0] == NUL)
/* relative to current directory */
STRCPY(buf, curdir);
- else if (path_with_url(buf))
+ else if (path_with_url((char *)buf))
/* URL can't be used here */
continue;
else if (!path_is_absolute_path(buf)) {
@@ -1533,17 +1533,14 @@ int path_is_url(const char *p)
return 0;
}
-/*
- * Check if "fname" starts with "name://". Return URL_SLASH if it does.
- * Return URL_BACKSLASH for "name:\\".
- * Return zero otherwise.
- */
-int path_with_url(char_u *fname)
+/// Check if "fname" starts with "name://". Return URL_SLASH if it does.
+///
+/// @param fname is the filename to test
+/// @return URL_BACKSLASH for "name:\\", zero otherwise.
+int path_with_url(const char *fname)
{
- char_u *p;
-
- for (p = fname; isalpha(*p); ++p)
- ;
+ const char *p;
+ for (p = fname; isalpha(*p); p++) {}
return path_is_url(p);
}
@@ -1552,7 +1549,7 @@ int path_with_url(char_u *fname)
*/
int vim_isAbsName(char_u *name)
{
- return path_with_url(name) != 0 || path_is_absolute_path(name);
+ return path_with_url((char *)name) != 0 || path_is_absolute_path(name);
}
/*
@@ -1575,7 +1572,7 @@ vim_FullName (
if (fname == NULL)
return FAIL;
- url = path_with_url(fname);
+ url = path_with_url((char *)fname);
if (!url)
retval = path_get_absolute_path(fname, buf, len, force);
if (url || retval == FAIL) {