aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/hardcopy.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-06-13 18:09:08 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-06-13 18:09:08 -0400
commit8bbeb4b480a72d0099a18c4d8200313600045231 (patch)
treecf153eceb121aef15e50631282e9171a24b74406 /src/nvim/hardcopy.c
parent5b3b3fd3ed4372866730ae857e8c09d6e5d1167d (diff)
parentd430f039d1255eaab55470b5613d83c24d030a64 (diff)
downloadrneovim-8bbeb4b480a72d0099a18c4d8200313600045231.tar.gz
rneovim-8bbeb4b480a72d0099a18c4d8200313600045231.tar.bz2
rneovim-8bbeb4b480a72d0099a18c4d8200313600045231.zip
Merge #743 'Replace vim_strncpy with strlcpy'
Diffstat (limited to 'src/nvim/hardcopy.c')
-rw-r--r--src/nvim/hardcopy.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 35cce64735..be6d8ee0ee 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -1539,7 +1539,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
buffer = xmallocz(MAXPATHL);
- vim_strncpy(resource->name, (char_u *)name, 63);
+ STRLCPY(resource->name, name, 64);
/* Look for named resource file in runtimepath */
STRCPY(buffer, "print");
add_pathsep(buffer);
@@ -1748,14 +1748,14 @@ static int prt_open_resource(struct prt_ps_resource_S *resource)
while (!seen_all && prt_next_dsc(&dsc_line)) {
switch (dsc_line.type) {
case PRT_DSC_TITLE_TYPE:
- vim_strncpy(resource->title, dsc_line.string, dsc_line.len);
+ STRLCPY(resource->title, dsc_line.string, dsc_line.len + 1);
seen_title = TRUE;
if (seen_version)
seen_all = TRUE;
break;
case PRT_DSC_VERSION_TYPE:
- vim_strncpy(resource->version, dsc_line.string, dsc_line.len);
+ STRLCPY(resource->version, dsc_line.string, dsc_line.len + 1);
seen_version = TRUE;
if (seen_title)
seen_all = TRUE;
@@ -2160,8 +2160,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
/* Add charset name if not empty */
if (p_mbchar->cmap_charset != NULL) {
- vim_strncpy((char_u *)prt_cmap,
- (char_u *)p_mbchar->cmap_charset, sizeof(prt_cmap) - 3);
+ STRLCPY(prt_cmap, p_mbchar->cmap_charset, sizeof(prt_cmap) - 2);
STRCAT(prt_cmap, "-");
}
} else {
@@ -2170,7 +2169,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
EMSG(_("E674: printmbcharset cannot be empty with multi-byte encoding."));
return FALSE;
}
- vim_strncpy((char_u *)prt_cmap, p_pmcs, sizeof(prt_cmap) - 3);
+ STRLCPY(prt_cmap, p_pmcs, sizeof(prt_cmap) - 2);
STRCAT(prt_cmap, "-");
}