diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/nvim/memline.c | 6 | ||||
-rw-r--r-- | src/nvim/path.c | 36 | ||||
-rw-r--r-- | src/nvim/tempfile.c | 2 |
5 files changed, 24 insertions, 26 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 953105513b..6f60b1189a 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3305,7 +3305,7 @@ static void script_host_execute(char *name, exarg_T *eap) static void script_host_execute_file(char *name, exarg_T *eap) { uint8_t buffer[MAXPATHL]; - vim_FullName(eap->arg, buffer, sizeof(buffer), false); + vim_FullName((char *)eap->arg, (char *)buffer, sizeof(buffer), false); list_T *args = list_alloc(); // filename diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index bb71201959..5fe45154dc 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7544,7 +7544,7 @@ static void ex_mkrc(exarg_T *eap) char_u *tbuf; tbuf = xmalloc(MAXPATHL); - if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK) + if (vim_FullName((char *)fname, (char *)tbuf, MAXPATHL, FALSE) == OK) set_vim_var_string(VV_THIS_SESSION, tbuf, -1); xfree(tbuf); } @@ -8975,7 +8975,7 @@ ses_arglist ( if (s != NULL) { if (fullname) { buf = xmalloc(MAXPATHL); - (void)vim_FullName(s, buf, MAXPATHL, FALSE); + (void)vim_FullName((char *)s, (char *)buf, MAXPATHL, FALSE); s = buf; } if (fputs("argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 0a65e8a0e9..3b4ee502cf 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -3049,7 +3049,7 @@ int resolve_symlink(char_u *fname, char_u *buf) * be consistent even when opening a relative symlink from different * working directories. */ - return vim_FullName(tmp, buf, MAXPATHL, TRUE); + return vim_FullName((char *)tmp, (char *)buf, MAXPATHL, TRUE); } #endif @@ -3554,8 +3554,8 @@ fnamecmp_ino ( * One of the inode numbers is unknown, try a forced vim_FullName() and * compare the file names. */ - retval_c = vim_FullName(fname_c, buf_c, MAXPATHL, TRUE); - retval_s = vim_FullName(fname_s, buf_s, MAXPATHL, TRUE); + retval_c = vim_FullName((char *)fname_c, (char *)buf_c, MAXPATHL, TRUE); + retval_s = vim_FullName((char *)fname_s, (char *)buf_s, MAXPATHL, TRUE); if (retval_c == OK && retval_s == OK) return STRCMP(buf_c, buf_s) != 0; diff --git a/src/nvim/path.c b/src/nvim/path.c index 93e3a50488..e3aaa30ac8 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -66,8 +66,8 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname) if (!id_ok_1 && !id_ok_2) { // If os_fileid() doesn't work, may compare the names. if (checkname) { - vim_FullName(exp1, full1, MAXPATHL, FALSE); - vim_FullName(s2, full2, MAXPATHL, FALSE); + vim_FullName((char *)exp1, (char *)full1, MAXPATHL, FALSE); + vim_FullName((char *)s2, (char *)full2, MAXPATHL, FALSE); if (fnamecmp(full1, full2) == 0) { return kEqualFileNames; } @@ -376,7 +376,7 @@ FullName_save ( char_u *buf = xmalloc(MAXPATHL); - if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) { + if (vim_FullName((char *)fname, (char *)buf, MAXPATHL, force) != FAIL) { new_fname = vim_strsave(buf); } else { new_fname = vim_strsave(fname); @@ -1552,18 +1552,16 @@ int vim_isAbsName(char_u *name) return path_with_url((char *)name) != 0 || path_is_absolute_path(name); } -/* - * Get absolute file name into buffer "buf[len]". - * - * return FAIL for failure, OK otherwise - */ -int -vim_FullName ( - char_u *fname, - char_u *buf, - int len, - int force /* force expansion even when already absolute */ -) +/// Save absolute file name to "buf[len]". +/// +/// @param fname is the filename to evaluate +/// @param[out] buf is the buffer for returning the absolute path for `fname` +/// @param len is the length of `buf` +/// @param force is a flag to force expanding even if the path is absolute +/// +/// @return FAIL for failure, OK otherwise +int vim_FullName(char *fname, char *buf, int len, bool force) + FUNC_ATTR_NONNULL_ARG(1) { int retval = OK; int url; @@ -1572,12 +1570,12 @@ vim_FullName ( if (fname == NULL) return FAIL; - url = path_with_url((char *)fname); + url = path_with_url(fname); if (!url) - retval = path_get_absolute_path(fname, buf, len, force); + retval = path_get_absolute_path((char_u *)fname, (char_u *)buf, len, force); if (url || retval == FAIL) { /* something failed; use the file name (truncate when too long) */ - STRLCPY(buf, fname, len); + xstrlcpy(buf, fname, len); } return retval; } @@ -1698,7 +1696,7 @@ int same_directory(char_u *f1, char_u *f2) if (f1 == NULL || f2 == NULL) return FALSE; - (void)vim_FullName(f1, ffname, MAXPATHL, FALSE); + (void)vim_FullName((char *)f1, (char *)ffname, MAXPATHL, FALSE); t1 = path_tail_with_sep(ffname); t2 = path_tail_with_sep(f2); return t1 - ffname == t2 - f2 diff --git a/src/nvim/tempfile.c b/src/nvim/tempfile.c index 952f68054d..56f47cfa38 100644 --- a/src/nvim/tempfile.c +++ b/src/nvim/tempfile.c @@ -106,7 +106,7 @@ static bool vim_settempdir(char_u *tempdir) if (!buf) { return false; } - vim_FullName(tempdir, buf, MAXPATHL, false); + vim_FullName((char *)tempdir, (char *)buf, MAXPATHL, false); add_pathsep((char *)buf); vim_tempdir = vim_strsave(buf); xfree(buf); |