Replace vim_strncpy calls: quickfix.c

This commit is contained in:
Douglas Schneider
2014-05-28 20:27:19 -06:00
committed by Justin M. Keyes
parent 4e81698988
commit 656408e479

View File

@@ -484,9 +484,9 @@ qf_init_ext (
len = (int)STRLEN(p_str); len = (int)STRLEN(p_str);
if (len > CMDBUFFSIZE - 2) if (len > CMDBUFFSIZE - 2)
vim_strncpy(IObuff, p_str, CMDBUFFSIZE - 2); STRLCPY(IObuff, p_str, CMDBUFFSIZE - 1);
else else
vim_strncpy(IObuff, p_str, len); STRLCPY(IObuff, p_str, len + 1);
p_str += len; p_str += len;
} else if (tv->v_type == VAR_LIST) { } else if (tv->v_type == VAR_LIST) {
@@ -501,7 +501,7 @@ qf_init_ext (
if (len > CMDBUFFSIZE - 2) if (len > CMDBUFFSIZE - 2)
len = CMDBUFFSIZE - 2; len = CMDBUFFSIZE - 2;
vim_strncpy(IObuff, p_li->li_tv.vval.v_string, len); STRLCPY(IObuff, p_li->li_tv.vval.v_string, len + 1);
p_li = p_li->li_next; /* next item */ p_li = p_li->li_next; /* next item */
} }
@@ -509,8 +509,8 @@ qf_init_ext (
/* Get the next line from the supplied buffer */ /* Get the next line from the supplied buffer */
if (buflnum > lnumlast) if (buflnum > lnumlast)
break; break;
vim_strncpy(IObuff, ml_get_buf(buf, buflnum++, FALSE), STRLCPY(IObuff, ml_get_buf(buf, buflnum++, FALSE),
CMDBUFFSIZE - 2); CMDBUFFSIZE - 1);
} }
} else if (fgets((char *)IObuff, CMDBUFFSIZE - 2, fd) == NULL) } else if (fgets((char *)IObuff, CMDBUFFSIZE - 2, fd) == NULL)
break; break;
@@ -609,7 +609,7 @@ restofline:
if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
continue; continue;
len = (int)(regmatch.endp[i] - regmatch.startp[i]); len = (int)(regmatch.endp[i] - regmatch.startp[i]);
vim_strncpy(errmsg, regmatch.startp[i], len); STRLCPY(errmsg, regmatch.startp[i], len + 1);
} }
if ((i = (int)fmt_ptr->addr[6]) > 0) { /* %r */ if ((i = (int)fmt_ptr->addr[6]) > 0) { /* %r */
if (regmatch.startp[i] == NULL) if (regmatch.startp[i] == NULL)