aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlonerover <pathfinder1644@yahoo.com>2017-01-03 15:28:38 +0800
committerlonerover <pathfinder1644@yahoo.com>2017-01-04 08:53:38 +0800
commit1984e784fbba3757872eb396928ad919921ac6b1 (patch)
tree2c94be90d2008dd59d19569ad7ef586442df3662 /src
parenta5f36e24bb294870516d89288968344c2d78f6b5 (diff)
downloadrneovim-1984e784fbba3757872eb396928ad919921ac6b1.tar.gz
rneovim-1984e784fbba3757872eb396928ad919921ac6b1.tar.bz2
rneovim-1984e784fbba3757872eb396928ad919921ac6b1.zip
fix lint error
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c12
-rw-r--r--src/nvim/buffer_defs.h5
2 files changed, 8 insertions, 9 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 7b9876aa39..967c59ff8c 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -284,7 +284,7 @@ static hashtab_T buf_hashtab;
static void buf_hashtab_add(buf_T *buf)
{
- sprintf((char *)buf->b_key, "%x", buf->b_fnum);
+ snprintf((char *)buf->b_key, sizeof(buf->b_key), "%x", buf->b_fnum);
if (hash_add(&buf_hashtab, buf->b_key) == FAIL) {
EMSG(_("E931: Buffer cannot be registered"));
}
@@ -1388,7 +1388,7 @@ buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags)
if (top_file_num == 1) {
hash_init(&buf_hashtab);
}
- fname_expand(curbuf, &ffname, &sfname); /* will allocate ffname */
+ fname_expand(curbuf, &ffname, &sfname); // will allocate ffname
/*
* If file name already exists in the list, update the entry.
@@ -2025,19 +2025,19 @@ static char_u *fname_match(regmatch_T *rmp, char_u *name, bool ignore_case)
/// Find a file in the buffer list by buffer number.
buf_T *buflist_findnr(int nr)
{
- char_u key[SIZEOF_INT * 2 + 1];
+ char_u key[sizeof(handle_T) * 2 + 1];
hashitem_T *hi;
if (nr == 0) {
nr = curwin->w_alt_fnum;
}
- sprintf((char *)key, "%x", nr);
+ snprintf((char *)key, sizeof(key), "%x", nr);
hi = hash_find(&buf_hashtab, key);
if (!HASHITEM_EMPTY(hi)) {
- return (buf_T *)(hi->hi_key
- - ((unsigned)(curbuf->b_key - (char_u *)curbuf)));
+ return (buf_T *)(hi->hi_key -
+ ((unsigned)(curbuf->b_key - (char_u *)curbuf)));
}
return NULL;
}
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index f9d21b549a..353a2e0128 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -490,9 +490,8 @@ struct file_buffer {
bool file_id_valid;
FileID file_id;
- char_u b_key[SIZEOF_INT * 2 + 1]; // key used for buf_hashtab, holds
- // b_fnum as hex string
-
+ char_u b_key[sizeof(handle_T) * 2 + 1]; // key used for buf_hashtab, holds
+ // b_fnum as hex string
int b_changed; // 'modified': Set to true if something in the
// file has been changed and not written out.
int b_changedtick; // incremented for each change, also for undo