SCP: Fix regression which disabled limit check when parsing unsigned integers

This affected unit and tmxr line checks when there was only one unit or line.
This commit is contained in:
Mark Pizzolato 2017-12-05 12:23:31 -08:00
parent 133cf727d5
commit a4a6a1d409
3 changed files with 7 additions and 2 deletions

5
scp.c
View file

@ -1180,6 +1180,9 @@ static const char simh_help[] =
"+set clock nocatchup disable catchup clock ticks\n"
"+set clock catchup enable catchup clock ticks\n"
"+set clock calib=n%% specify idle calibration skip %%\n"
"+set clock stop=n stop execution after n instructions\n\n"
" The set clock stop command allows execution to have a bound when\n"
" execution starts with a BOOT, NEXT or CONTINUE command.\n"
#define HLP_SET_ASYNCH "*Commands SET Asynch"
"3Asynch\n"
"+set asynch enable asynchronous I/O\n"
@ -8383,7 +8386,7 @@ CONST char *tptr;
*status = SCPE_OK;
val = strtotv ((CONST char *)cptr, &tptr, radix);
if ((cptr == tptr) || ((max > 0) && (val > max)))
if ((cptr == tptr) || (val > max))
*status = SCPE_ARG;
else {
while (sim_isspace (*tptr)) tptr++;

View file

@ -231,9 +231,11 @@ typedef unsigned long t_uint64;
#if defined (USE_INT64) /* 64b data */
typedef t_int64 t_svalue; /* signed value */
typedef t_uint64 t_value; /* value */
#define T_VALUE_MAX 0xffffffffffffffffuLL
#else /* 32b data */
typedef int32 t_svalue;
typedef uint32 t_value;
#define T_VALUE_MAX 0xffffffffUL
#endif /* end 64b data */
#if defined (USE_INT64) && defined (USE_ADDR64) /* 64b address */

View file

@ -1313,7 +1313,7 @@ t_value stop_time;
if (cptr == NULL)
return SCPE_ARG;
stop_time = get_uint (cptr, 10, 0, &r);
stop_time = get_uint (cptr, 10, T_VALUE_MAX, &r);
if (r != SCPE_OK)
return r;
if (stop_time <= (t_value)sim_gtime())