aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-02-04 05:57:15 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-02-04 11:07:50 +0100
commitea449b16b95df59b09862961694e28d1d5c8144d (patch)
tree0cdbe82a9dbcbaae159f7095ae78c6a51f6a3837
parent67fbbdb1b5eb6e48c7c533042abba9e409833ca6 (diff)
downloadrneovim-ea449b16b95df59b09862961694e28d1d5c8144d.tar.gz
rneovim-ea449b16b95df59b09862961694e28d1d5c8144d.tar.bz2
rneovim-ea449b16b95df59b09862961694e28d1d5c8144d.zip
refactor: fix warnings
-rw-r--r--src/nvim/buffer.c4
-rw-r--r--src/nvim/eval.c6
-rw-r--r--src/nvim/mbyte.c2
-rw-r--r--src/nvim/os/fs.c7
4 files changed, 8 insertions, 11 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 26dbbe8bb5..868e842ecd 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -4086,10 +4086,8 @@ void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
#ifdef WIN32
if (!buf->b_p_bin) {
- char_u *rfname;
-
// If the file name is a shortcut file, use the file it links to.
- rfname = os_resolve_shortcut(*ffname);
+ char_u *rfname = (char_u *)os_resolve_shortcut(*ffname);
if (rfname != NULL) {
xfree(*ffname);
*ffname = rfname;
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9c041ca790..1b4539ddd3 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -14137,11 +14137,9 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
p = get_tv_string(&argvars[0]);
#ifdef WIN32
{
- char_u *v = NULL;
-
- v = os_resolve_shortcut(p);
+ char *v = os_resolve_shortcut(p);
if (v != NULL) {
- rettv->vval.v_string = v;
+ rettv->vval.v_string = (char_u *)v;
} else {
rettv->vval.v_string = vim_strsave(p);
}
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index c855d68605..6a87a63b8c 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1517,7 +1517,7 @@ int utf16_to_utf8(const WCHAR *strw, char **str)
0,
strw,
-1,
- (LPSTR *)pos,
+ pos,
utf8_len,
NULL,
NULL);
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 7266e54b58..097c672887 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -424,11 +424,11 @@ ptrdiff_t os_read(const int fd, bool *ret_eof, char *const ret_buf,
size_t read_bytes = 0;
bool did_try_to_free = false;
while (read_bytes != size) {
+ assert(size >= read_bytes);
const ptrdiff_t cur_read_bytes = read(fd, ret_buf + read_bytes,
size - read_bytes);
if (cur_read_bytes > 0) {
read_bytes += (size_t)cur_read_bytes;
- assert(read_bytes <= size);
}
if (cur_read_bytes < 0) {
const int error = os_translate_sys_error(errno);
@@ -527,6 +527,7 @@ ptrdiff_t os_write(const int fd, const char *const buf, const size_t size)
}
size_t written_bytes = 0;
while (written_bytes != size) {
+ assert(size >= written_bytes);
const ptrdiff_t cur_written_bytes = write(fd, buf + written_bytes,
size - written_bytes);
if (cur_written_bytes > 0) {
@@ -949,12 +950,12 @@ bool os_fileid_equal_fileinfo(const FileID *file_id,
/// When "fname" is the name of a shortcut (*.lnk) resolve the file it points
/// to and return that name in allocated memory.
/// Otherwise NULL is returned.
-char_u * os_resolve_shortcut(char_u *fname)
+char *os_resolve_shortcut(char_u *fname)
{
HRESULT hr;
IPersistFile *ppf = NULL;
OLECHAR wsz[MAX_PATH];
- char_u *rfname = NULL;
+ char *rfname = NULL;
int len;
IShellLinkW *pslw = NULL;
WIN32_FIND_DATAW ffdw;