* buffer overflow checking in ptccrt.KeyBufAdd

git-svn-id: trunk@16141 -
This commit is contained in:
nickysn 2010-10-12 14:17:35 +00:00
parent ba6a4760e9
commit e7c4990780

View File

@ -79,7 +79,10 @@ end;
procedure KeyBufAdd(Ch: Char); procedure KeyBufAdd(Ch: Char);
begin begin
{todo: overflow checking} { do nothing, if the buffer is full }
if ((KeyBufTail + 1) = KeyBufHead) or
((KeyBufTail = High(KeyBuffer)) and (KeyBufHead = Low(KeyBuffer))) then
exit;
KeyBuffer[KeyBufTail] := Ch; KeyBuffer[KeyBufTail] := Ch;
Inc(KeyBufTail); Inc(KeyBufTail);
if KeyBufTail > High(KeyBuffer) then if KeyBufTail > High(KeyBuffer) then