aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spellfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/spellfile.c')
-rw-r--r--src/nvim/spellfile.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index f2c335c69a..d01acd6300 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -2348,7 +2348,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
&& aff_todo == 0
&& itemcnt >= 4) {
int lasti = 4;
- char_u key[AH_KEY_LEN];
+ char key[AH_KEY_LEN];
if (*items[0] == 'P') {
tp = &aff->af_pref;
@@ -2360,7 +2360,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// times. The affix files that do this have an undocumented
// "S" flag on all but the last block, thus we check for that
// and store it in ah_follows.
- STRLCPY(key, items[1], AH_KEY_LEN);
+ xstrlcpy(key, items[1], AH_KEY_LEN);
hi = hash_find(tp, (char *)key);
if (!HASHITEM_EMPTY(hi)) {
cur_aff = HI2AH(hi);
@@ -2533,7 +2533,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// upper-case letter.
if (aff_entry->ae_cond != NULL) {
char_u buf[MAXLINELEN];
- onecap_copy((char_u *)items[4], buf, true);
+ onecap_copy((char_u *)items[4], (char *)buf, true);
aff_entry->ae_cond = (char_u *)getroom_save(spin, (char *)buf);
if (aff_entry->ae_cond != NULL) {
sprintf((char *)buf, "^%s", aff_entry->ae_cond); // NOLINT(runtime/printf)
@@ -2902,13 +2902,13 @@ static unsigned get_affitem(int flagtype, char_u **pp)
static void process_compflags(spellinfo_T *spin, afffile_T *aff, char *compflags)
{
char *p;
- char_u *prevp;
+ char *prevp;
unsigned flag;
compitem_T *ci;
int id;
int len;
char_u *tp;
- char_u key[AH_KEY_LEN];
+ char key[AH_KEY_LEN];
hashitem_T *hi;
// Make room for the old and the new compflags, concatenated with a / in
@@ -2932,12 +2932,12 @@ static void process_compflags(spellinfo_T *spin, afffile_T *aff, char *compflags
*tp++ = (char_u)(*p++);
} else {
// First get the flag number, also checks validity.
- prevp = (char_u *)p;
+ prevp = p;
flag = get_affitem(aff->af_flagtype, (char_u **)&p);
if (flag != 0) {
// Find the flag in the hashtable. If it was used before, use
// the existing ID. Otherwise add a new entry.
- STRLCPY(key, prevp, (char_u *)p - prevp + 1);
+ xstrlcpy(key, prevp, (size_t)(p - prevp) + 1);
hi = hash_find(&aff->af_comp, (char *)key);
if (!HASHITEM_EMPTY(hi)) {
id = HI2CI(hi)->ci_newID;
@@ -3281,14 +3281,14 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
// Additionally do matching prefixes that combine.
if (store_aff_word(spin, dw, afflist, affile,
&affile->af_suff, &affile->af_pref,
- CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL) {
+ CONDIT_SUF, flags, (char *)store_afflist, pfxlen) == FAIL) {
retval = FAIL;
}
// Find all matching prefixes and add the resulting words.
if (store_aff_word(spin, dw, afflist, affile,
&affile->af_pref, NULL,
- CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL) {
+ CONDIT_SUF, flags, (char *)store_afflist, pfxlen) == FAIL) {
retval = FAIL;
}
}
@@ -3353,18 +3353,18 @@ static int get_affix_flags(afffile_T *affile, char_u *afflist)
static int get_pfxlist(afffile_T *affile, char_u *afflist, char_u *store_afflist)
{
char_u *p;
- char_u *prevp;
+ char *prevp;
int cnt = 0;
int id;
- char_u key[AH_KEY_LEN];
+ char key[AH_KEY_LEN];
hashitem_T *hi;
for (p = afflist; *p != NUL;) {
- prevp = p;
+ prevp = (char *)p;
if (get_affitem(affile->af_flagtype, &p) != 0) {
// A flag is a postponed prefix flag if it appears in "af_pref"
// and its ID is not zero.
- STRLCPY(key, prevp, p - prevp + 1);
+ xstrlcpy(key, prevp, (size_t)(p - (char_u *)prevp) + 1);
hi = hash_find(&affile->af_pref, (char *)key);
if (!HASHITEM_EMPTY(hi)) {
id = HI2AH(hi)->ah_newID;
@@ -3388,16 +3388,16 @@ static int get_pfxlist(afffile_T *affile, char_u *afflist, char_u *store_afflist
static void get_compflags(afffile_T *affile, char_u *afflist, char_u *store_afflist)
{
char_u *p;
- char_u *prevp;
+ char *prevp;
int cnt = 0;
- char_u key[AH_KEY_LEN];
+ char key[AH_KEY_LEN];
hashitem_T *hi;
for (p = afflist; *p != NUL;) {
- prevp = p;
+ prevp = (char *)p;
if (get_affitem(affile->af_flagtype, &p) != 0) {
// A flag is a compound flag if it appears in "af_comp".
- STRLCPY(key, prevp, p - prevp + 1);
+ xstrlcpy(key, prevp, (size_t)(p - (char_u *)prevp) + 1);
hi = hash_find(&affile->af_comp, (char *)key);
if (!HASHITEM_EMPTY(hi)) {
store_afflist[cnt++] = (char_u)HI2CI(hi)->ci_newID;
@@ -3427,7 +3427,7 @@ static void get_compflags(afffile_T *affile, char_u *afflist, char_u *store_affl
///
/// @return FAIL when out of memory.
static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffile_T *affile,
- hashtab_T *ht, hashtab_T *xht, int condit, int flags, char_u *pfxlist,
+ hashtab_T *ht, hashtab_T *xht, int condit, int flags, char *pfxlist,
int pfxlen)
{
int todo;
@@ -3439,11 +3439,11 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
int i, j;
char_u *p;
int use_flags;
- char_u *use_pfxlist;
+ char *use_pfxlist;
int use_pfxlen;
bool need_affix;
char_u store_afflist[MAXWLEN];
- char_u pfx_pfxlist[MAXWLEN];
+ char pfx_pfxlist[MAXWLEN];
size_t wordlen = strlen(word);
int use_condit;
@@ -3488,7 +3488,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
if (ae->ae_add == NULL) {
*newword = NUL;
} else {
- STRLCPY(newword, ae->ae_add, MAXWLEN);
+ xstrlcpy(newword, ae->ae_add, MAXWLEN);
}
p = (char_u *)word;
if (ae->ae_chop != NULL) {
@@ -3501,7 +3501,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
STRCAT(newword, p);
} else {
// suffix: chop/add at the end of the word
- STRLCPY(newword, word, MAXWLEN);
+ xstrlcpy(newword, word, MAXWLEN);
if (ae->ae_chop != NULL) {
// Remove chop string.
p = (char_u *)newword + strlen(newword);
@@ -3550,7 +3550,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
} else {
use_pfxlen = 0;
}
- use_pfxlist = store_afflist;
+ use_pfxlist = (char *)store_afflist;
// Combine the prefix IDs. Avoid adding the
// same ID twice.
@@ -3568,7 +3568,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
if (spin->si_compflags != NULL) {
// Get compound IDS from the affix list.
get_compflags(affile, ae->ae_flags,
- use_pfxlist + use_pfxlen);
+ (char_u *)use_pfxlist + use_pfxlen);
} else {
use_pfxlist[use_pfxlen] = NUL;
}
@@ -3593,7 +3593,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
// Obey a "COMPOUNDFORBIDFLAG" of the affix: don't
// use the compound flags.
if (use_pfxlist != NULL && ae->ae_compforbid) {
- STRLCPY(pfx_pfxlist, use_pfxlist, use_pfxlen + 1);
+ xstrlcpy(pfx_pfxlist, use_pfxlist, (size_t)use_pfxlen + 1);
use_pfxlist = pfx_pfxlist;
}
@@ -3624,7 +3624,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char_u *afflist, afffil
// Store the modified word.
if (store_word(spin, newword, use_flags,
- spin->si_region, use_pfxlist,
+ spin->si_region, (char_u *)use_pfxlist,
need_affix) == FAIL) {
retval = FAIL;
}
@@ -4970,7 +4970,7 @@ static void spell_make_sugfile(spellinfo_T *spin, char *wfname)
// Write the .sug file.
// Make the file name by changing ".spl" to ".sug".
fname = xmalloc(MAXPATHL);
- STRLCPY(fname, wfname, MAXPATHL);
+ xstrlcpy(fname, wfname, MAXPATHL);
len = (int)strlen(fname);
fname[len - 2] = 'u';
fname[len - 1] = 'g';
@@ -5328,7 +5328,7 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
} else if (len > 4 && strcmp(fnames[0] + len - 4, ".spl") == 0) {
// Name ends in ".spl", use as the file name.
- STRLCPY(wfname, fnames[0], MAXPATHL);
+ xstrlcpy(wfname, fnames[0], MAXPATHL);
} else {
// Name should be language, make the file name from it.
vim_snprintf(wfname, MAXPATHL, SPL_FNAME_TMPL,
@@ -5716,7 +5716,7 @@ static void init_spellfile(void)
if (aspath) {
// Use directory of an entry with path, e.g., for
// "/dir/lg.utf-8.spl" use "/dir".
- STRLCPY(buf, curbuf->b_s.b_p_spl, lstart - (char_u *)curbuf->b_s.b_p_spl);
+ xstrlcpy(buf, curbuf->b_s.b_p_spl, (size_t)(lstart - (char_u *)curbuf->b_s.b_p_spl));
} else {
// Copy the path from 'runtimepath' to buf[].
copy_option_part((char **)&rtp, buf, MAXPATHL, ",");
@@ -5725,7 +5725,7 @@ static void init_spellfile(void)
// Use the first language name from 'spelllang' and the
// encoding used in the first loaded .spl file.
if (aspath) {
- STRLCPY(buf, curbuf->b_s.b_p_spl, lend - (char_u *)curbuf->b_s.b_p_spl + 1);
+ xstrlcpy(buf, curbuf->b_s.b_p_spl, (size_t)(lend - (char_u *)curbuf->b_s.b_p_spl + 1));
} else {
// Create the "spell" directory if it doesn't exist yet.
l = (int)strlen(buf);