Correct a bug whereby allocations to the dictionary would not be allowed

unless four times the space requested was available.
This commit is contained in:
Daniel C. Sobral 2000-05-04 23:23:13 +00:00
parent 4eb5b7979d
commit 20689aa3d4

View File

@ -265,14 +265,14 @@ int dictCellsUsed(FICL_DICT *pDict)
** Checks the dictionary for corruption and throws appropriate
** errors
**************************************************************************/
void dictCheck(FICL_DICT *pDict, FICL_VM *pVM, int nCells)
void dictCheck(FICL_DICT *pDict, FICL_VM *pVM, int n)
{
if ((nCells >= 0) && (dictCellsAvail(pDict) < nCells))
if ((n >= 0) && (dictCellsAvail(pDict) * sizeof (CELL) < n))
{
vmThrowErr(pVM, "Error: dictionary full");
}
if ((nCells <= 0) && (dictCellsUsed(pDict) < -nCells))
if ((n <= 0) && (dictCellsUsed(pDict) * sizeof (CELL) < -n))
{
vmThrowErr(pVM, "Error: dictionary underflow");
}