From 34330cf69798a2a8667bdc0aa76f732fe715de84 Mon Sep 17 00:00:00 2001 From: Pavel Platto Date: Wed, 25 Jun 2014 21:27:01 +0300 Subject: tempfile.c: add to clint-files and fix warnings --- clint-files.txt | 2 ++ src/nvim/tempfile.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/clint-files.txt b/clint-files.txt index da0643e834..29fb0908af 100644 --- a/clint-files.txt +++ b/clint-files.txt @@ -48,3 +48,5 @@ src/nvim/os/server.c src/nvim/os/server.h src/nvim/os/channel.c src/nvim/os/channel.h +src/nvim/tempfile.c +src/nvim/tempfile.h diff --git a/src/nvim/tempfile.c b/src/nvim/tempfile.c index a9472bc66a..7b45a25cd7 100644 --- a/src/nvim/tempfile.c +++ b/src/nvim/tempfile.c @@ -1,4 +1,5 @@ #include +#include #include #include @@ -59,7 +60,7 @@ void vim_deltempdir(void) int i; if (vim_tempdir != NULL) { - sprintf((char *)NameBuff, "%s*", vim_tempdir); + snprintf((char *)NameBuff, MAXPATHL, "%s*", vim_tempdir); if (gen_expand_wildcards(1, &NameBuff, &file_count, &files, EW_DIR|EW_FILE|EW_SILENT) == OK) { for (i = 0; i < file_count; ++i) @@ -92,7 +93,7 @@ static void vim_settempdir(char_u *tempdir) { char_u *buf = verbose_try_malloc((size_t)MAXPATHL + 2); if (buf) { - if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL) + if (vim_FullName(tempdir, buf, MAXPATHL, false) == FAIL) STRCPY(buf, tempdir); add_pathsep(buf); vim_tempdir = vim_strsave(buf); @@ -116,7 +117,8 @@ char_u *vim_tempname(void) if (tempdir != NULL) { /* There is no need to check if the file exists, because we own the * directory and nobody else creates a file in it. */ - sprintf((char *)itmp, "%s%" PRIu32, tempdir, temp_count++); + snprintf((char *)itmp, TEMP_FILE_PATH_MAXLEN, + "%s%" PRIu32, tempdir, temp_count++); return vim_strsave(itmp); } -- cgit