Commit 57282c86 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

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

Version 6.03. Tagged as 'RISC_OSLib-6_03'
parent 14d0a6d6
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "6.02" Module_MajorVersion SETS "6.03"
Module_Version SETA 602 Module_Version SETA 603
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "08 Jul 2019" Module_Date SETS "27 Jul 2019"
Module_ApplicationDate SETS "08-Jul-19" Module_ApplicationDate SETS "27-Jul-19"
Module_ComponentName SETS "RISC_OSLib" Module_ComponentName SETS "RISC_OSLib"
Module_FullVersion SETS "6.02" Module_FullVersion SETS "6.03"
Module_HelpVersion SETS "6.02 (08 Jul 2019)" Module_HelpVersion SETS "6.03 (27 Jul 2019)"
END END
/* (6.02) /* (6.03)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 6.02 #define Module_MajorVersion_CMHG 6.03
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Jul 2019 #define Module_Date_CMHG 27 Jul 2019
#define Module_MajorVersion "6.02" #define Module_MajorVersion "6.03"
#define Module_Version 602 #define Module_Version 603
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "08 Jul 2019" #define Module_Date "27 Jul 2019"
#define Module_ApplicationDate "08-Jul-19" #define Module_ApplicationDate "27-Jul-19"
#define Module_ComponentName "RISC_OSLib" #define Module_ComponentName "RISC_OSLib"
#define Module_FullVersion "6.02" #define Module_FullVersion "6.03"
#define Module_HelpVersion "6.02 (08 Jul 2019)" #define Module_HelpVersion "6.03 (27 Jul 2019)"
#define Module_LibraryVersionInfo "6:2" #define Module_LibraryVersionInfo "6:3"
...@@ -2284,7 +2284,7 @@ static void txtar__dodrag(txt t) ...@@ -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. */ /* read a number from the option string. */
int result = buf[*i] - '0'; int result = buf[*i] - '0';
...@@ -2376,7 +2376,8 @@ static void txtar__defaultoptions(txtar_options *opt) { ...@@ -2376,7 +2376,8 @@ static void txtar__defaultoptions(txtar_options *opt) {
case 'a': case 'a':
case 'A': case 'A':
opt->big_windows = TRUE; 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; break;
case 'n': case 'n':
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