Commit 3208ff3c authored by Robert Sprowson's avatar Robert Sprowson

Fix parsing of Edit option 'A'

The change of MIN() to a macro in RISC_OSLib-6_02 tripped up as it called the argument number parse function twice, which advances the parsing offset as a sideeffect. Read it once, then evaluate MIN().
Mark the string argument to txtar__readoptnum() as const.
Ref: https://www.riscosopen.org/forum/forums/11/topics/14632
parent 14d0a6d6
......@@ -2284,7 +2284,7 @@ static void txtar__dodrag(txt t)
};
}
static int txtar__readoptnum(char *buf, int *i)
static int txtar__readoptnum(const char *buf, int *i)
{
/* read a number from the option string. */
int result = buf[*i] - '0';
......@@ -2376,7 +2376,8 @@ static void txtar__defaultoptions(txtar_options *opt) {
case 'a':
case 'A':
opt->big_windows = TRUE;
opt->big_window_size = txt1_MIN(txtar__readoptnum(buf, &i), BIG_WINDOW_SIZE_LIMIT);
opt->big_window_size = txtar__readoptnum(buf, &i);
opt->big_window_size = txt1_MIN(opt->big_window_size, BIG_WINDOW_SIZE_LIMIT);
break;
case 'n':
case 'N':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment