mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.1490: number of spell regions is spread out through the code
Problem: Number of spell regions is spread out through the code. Solution: Define MAXREGIONS.
This commit is contained in:
@@ -34,6 +34,8 @@
|
|||||||
byte, thus it can't be above 255.
|
byte, thus it can't be above 255.
|
||||||
Must be >= PFD_NOTSPECIAL. */
|
Must be >= PFD_NOTSPECIAL. */
|
||||||
|
|
||||||
|
#define MAXREGIONS 8 /* Number of regions supported. */
|
||||||
|
|
||||||
/* Type used for indexes in the word tree need to be at least 4 bytes. If int
|
/* Type used for indexes in the word tree need to be at least 4 bytes. If int
|
||||||
* is 8 bytes we could use something smaller, but what? */
|
* is 8 bytes we could use something smaller, but what? */
|
||||||
#if VIM_SIZEOF_INT > 3
|
#if VIM_SIZEOF_INT > 3
|
||||||
@@ -80,7 +82,8 @@ struct slang_S
|
|||||||
|
|
||||||
char_u *sl_info; /* infotext string or NULL */
|
char_u *sl_info; /* infotext string or NULL */
|
||||||
|
|
||||||
char_u sl_regions[17]; /* table with up to 8 region names plus NUL */
|
char_u sl_regions[MAXREGIONS * 2 + 1];
|
||||||
|
/* table with up to 8 region names plus NUL */
|
||||||
|
|
||||||
char_u *sl_midword; /* MIDWORD string or NULL */
|
char_u *sl_midword; /* MIDWORD string or NULL */
|
||||||
|
|
||||||
|
@@ -54,8 +54,8 @@
|
|||||||
* website, etc)
|
* website, etc)
|
||||||
*
|
*
|
||||||
* sectionID == SN_REGION: <regionname> ...
|
* sectionID == SN_REGION: <regionname> ...
|
||||||
* <regionname> 2 bytes Up to 8 region names: ca, au, etc. Lower case.
|
* <regionname> 2 bytes Up to MAXREGIONS region names: ca, au, etc. Lower
|
||||||
* First <regionname> is region 1.
|
* case. First <regionname> is region 1.
|
||||||
*
|
*
|
||||||
* sectionID == SN_CHARFLAGS: <charflagslen> <charflags>
|
* sectionID == SN_CHARFLAGS: <charflagslen> <charflags>
|
||||||
* <folcharslen> <folchars>
|
* <folcharslen> <folchars>
|
||||||
@@ -832,7 +832,7 @@ read_region_section(FILE *fd, slang_T *lp, int len)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len > 16)
|
if (len > MAXREGIONS * 2)
|
||||||
return SP_FORMERROR;
|
return SP_FORMERROR;
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
lp->sl_regions[i] = getc(fd); /* <regionname> */
|
lp->sl_regions[i] = getc(fd); /* <regionname> */
|
||||||
@@ -1952,8 +1952,9 @@ typedef struct spellinfo_S
|
|||||||
char_u *si_info; /* info text chars or NULL */
|
char_u *si_info; /* info text chars or NULL */
|
||||||
int si_region_count; /* number of regions supported (1 when there
|
int si_region_count; /* number of regions supported (1 when there
|
||||||
are no regions) */
|
are no regions) */
|
||||||
char_u si_region_name[17]; /* region names; used only if
|
char_u si_region_name[MAXREGIONS * 2 + 1];
|
||||||
* si_region_count > 1) */
|
/* region names; used only if
|
||||||
|
* si_region_count > 1) */
|
||||||
|
|
||||||
garray_T si_rep; /* list of fromto_T entries from REP lines */
|
garray_T si_rep; /* list of fromto_T entries from REP lines */
|
||||||
garray_T si_repsal; /* list of fromto_T entries from REPSAL lines */
|
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)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
line += 8;
|
line += 8;
|
||||||
if (STRLEN(line) > 16)
|
if (STRLEN(line) > MAXREGIONS * 2)
|
||||||
smsg((char_u *)_("Too many regions in %s line %d: %s"),
|
smsg((char_u *)_("Too many regions in %s line %d: %s"),
|
||||||
fname, lnum, line);
|
fname, lnum, line);
|
||||||
else
|
else
|
||||||
@@ -5954,7 +5955,7 @@ mkspell(
|
|||||||
char_u *wfname;
|
char_u *wfname;
|
||||||
char_u **innames;
|
char_u **innames;
|
||||||
int incount;
|
int incount;
|
||||||
afffile_T *(afile[8]);
|
afffile_T *(afile[MAXREGIONS]);
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
stat_T st;
|
stat_T st;
|
||||||
@@ -6025,8 +6026,8 @@ mkspell(
|
|||||||
EMSG(_(e_invarg)); /* need at least output and input names */
|
EMSG(_(e_invarg)); /* need at least output and input names */
|
||||||
else if (vim_strchr(gettail(wfname), '_') != NULL)
|
else if (vim_strchr(gettail(wfname), '_') != NULL)
|
||||||
EMSG(_("E751: Output file name must not have region name"));
|
EMSG(_("E751: Output file name must not have region name"));
|
||||||
else if (incount > 8)
|
else if (incount > MAXREGIONS)
|
||||||
EMSG(_("E754: Only up to 8 regions supported"));
|
EMSGN(_("E754: Only up to %ld regions supported"), MAXREGIONS);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check for overwriting before doing things that may take a lot of
|
/* Check for overwriting before doing things that may take a lot of
|
||||||
|
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1490,
|
||||||
/**/
|
/**/
|
||||||
1489,
|
1489,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user