get_unsigned_int(
const char *pstart,
const char **p,
- unsigned int *uj)
+ unsigned int *uj,
+ int overflow_err)
{
*uj = **p - '0';
++*p;
if (*uj > MAX_ALLOWED_STRING_WIDTH)
{
- format_overflow_error(pstart);
- return FAIL;
+ if (overflow_err)
+ {
+ format_overflow_error(pstart);
+ return FAIL;
+ }
+ else
+ *uj = MAX_ALLOWED_STRING_WIDTH;
}
return OK;
// Positional argument
unsigned int uj;
- if (get_unsigned_int(pstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(pstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
pos_arg = uj;
// Positional argument field width
unsigned int uj;
- if (get_unsigned_int(arg + 1, &p, &uj) == FAIL)
+ if (get_unsigned_int(arg + 1, &p, &uj, tvs != NULL) == FAIL)
goto error;
if (*p != '$')
const char *digstart = p;
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
if (*p == '$')
// Parse precision
unsigned int uj;
- if (get_unsigned_int(arg + 1, &p, &uj) == FAIL)
+ if (get_unsigned_int(arg + 1, &p, &uj, tvs != NULL) == FAIL)
goto error;
if (*p == '$')
const char *digstart = p;
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
if (*p == '$')
const char *digstart = p;
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
pos_arg = uj;
// Positional argument field width
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
arg_idx = uj;
if (j > MAX_ALLOWED_STRING_WIDTH)
{
- format_overflow_error(digstart);
- goto error;
+ if (tvs != NULL)
+ {
+ format_overflow_error(digstart);
+ goto error;
+ }
+ else
+ j = MAX_ALLOWED_STRING_WIDTH;
}
if (j >= 0)
const char *digstart = p;
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
- goto error;
-
- if (uj > MAX_ALLOWED_STRING_WIDTH)
- {
- format_overflow_error(digstart);
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
- }
min_field_width = uj;
}
const char *digstart = p;
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
- if (uj > MAX_ALLOWED_STRING_WIDTH)
- {
- format_overflow_error(digstart);
- goto error;
- }
-
precision = uj;
}
else if (*p == '*')
// positional argument
unsigned int uj;
- if (get_unsigned_int(digstart, &p, &uj) == FAIL)
+ if (get_unsigned_int(digstart, &p, &uj, tvs != NULL) == FAIL)
goto error;
arg_idx = uj;
if (j > MAX_ALLOWED_STRING_WIDTH)
{
- format_overflow_error(digstart);
- goto error;
+ if (tvs != NULL)
+ {
+ format_overflow_error(digstart);
+ goto error;
+ }
+ else
+ j = MAX_ALLOWED_STRING_WIDTH;
}
if (j >= 0)
%bw!
endfunc
+func Test_spell_add_long_word()
+ set spell spellfile=./Xspellfile.add spelllang=en
+
+ let word = repeat('a', 9000)
+ let v:errmsg = ''
+ " Spell checking doesn't really work for such a long word,
+ " but this should not cause an E1510 error.
+ exe 'spellgood ' .. word
+ call assert_equal('', v:errmsg)
+ call assert_equal([word], readfile('./Xspellfile.add'))
+
+ set spell& spellfile= spelllang& encoding=utf-8
+ call delete('./Xspellfile.add')
+ call delete('./Xspellfile.add.spl')
+endfunc
+
func Test_spellfile_verbose()
call writefile(['1', 'one'], 'XtestVerbose.dic', 'D')
call writefile([], 'XtestVerbose.aff', 'D')