|
54 | 54 | * website, etc) |
55 | 55 | * |
56 | 56 | * sectionID == SN_REGION: <regionname> ... |
57 | | - * <regionname> 2 bytes Up to 8 region names: ca, au, etc. Lower case. |
58 | | - * First <regionname> is region 1. |
| 57 | + * <regionname> 2 bytes Up to MAXREGIONS region names: ca, au, etc. Lower |
| 58 | + * case. First <regionname> is region 1. |
59 | 59 | * |
60 | 60 | * sectionID == SN_CHARFLAGS: <charflagslen> <charflags> |
61 | 61 | * <folcharslen> <folchars> |
@@ -832,7 +832,7 @@ read_region_section(FILE *fd, slang_T *lp, int len) |
832 | 832 | { |
833 | 833 | int i; |
834 | 834 |
|
835 | | - if (len > 16) |
| 835 | + if (len > MAXREGIONS * 2) |
836 | 836 | return SP_FORMERROR; |
837 | 837 | for (i = 0; i < len; ++i) |
838 | 838 | lp->sl_regions[i] = getc(fd); /* <regionname> */ |
@@ -1952,8 +1952,9 @@ typedef struct spellinfo_S |
1952 | 1952 | char_u *si_info; /* info text chars or NULL */ |
1953 | 1953 | int si_region_count; /* number of regions supported (1 when there |
1954 | 1954 | are no regions) */ |
1955 | | - char_u si_region_name[17]; /* region names; used only if |
1956 | | - * si_region_count > 1) */ |
| 1955 | + char_u si_region_name[MAXREGIONS * 2 + 1]; |
| 1956 | + /* region names; used only if |
| 1957 | + * si_region_count > 1) */ |
1957 | 1958 |
|
1958 | 1959 | garray_T si_rep; /* list of fromto_T entries from REP lines */ |
1959 | 1960 | garray_T si_repsal; /* list of fromto_T entries from REPSAL lines */ |
@@ -4234,7 +4235,7 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname) |
4234 | 4235 | else |
4235 | 4236 | { |
4236 | 4237 | line += 8; |
4237 | | - if (STRLEN(line) > 16) |
| 4238 | + if (STRLEN(line) > MAXREGIONS * 2) |
4238 | 4239 | smsg((char_u *)_("Too many regions in %s line %d: %s"), |
4239 | 4240 | fname, lnum, line); |
4240 | 4241 | else |
@@ -5954,7 +5955,7 @@ mkspell( |
5954 | 5955 | char_u *wfname; |
5955 | 5956 | char_u **innames; |
5956 | 5957 | int incount; |
5957 | | - afffile_T *(afile[8]); |
| 5958 | + afffile_T *(afile[MAXREGIONS]); |
5958 | 5959 | int i; |
5959 | 5960 | int len; |
5960 | 5961 | stat_T st; |
@@ -6025,8 +6026,8 @@ mkspell( |
6025 | 6026 | EMSG(_(e_invarg)); /* need at least output and input names */ |
6026 | 6027 | else if (vim_strchr(gettail(wfname), '_') != NULL) |
6027 | 6028 | EMSG(_("E751: Output file name must not have region name")); |
6028 | | - else if (incount > 8) |
6029 | | - EMSG(_("E754: Only up to 8 regions supported")); |
| 6029 | + else if (incount > MAXREGIONS) |
| 6030 | + EMSGN(_("E754: Only up to %ld regions supported"), MAXREGIONS); |
6030 | 6031 | else |
6031 | 6032 | { |
6032 | 6033 | /* Check for overwriting before doing things that may take a lot of |
|
0 commit comments