* avoid a range check error

git-svn-id: trunk@6064 -
This commit is contained in:
pierre 2007-01-19 02:53:46 +00:00
parent 67fd7833cd
commit 2c09c499ab

View File

@ -151,7 +151,7 @@ var
bufptr := @buf[0]; bufptr := @buf[0];
fpread(f, buf, bufsize); fpread(f, buf, bufsize);
end; end;
function readbufbyte: byte; function readbufbyte: byte;
begin begin
if bufptr > @buf[bufsize-1] then if bufptr > @buf[bufsize-1] then
@ -159,14 +159,14 @@ var
readbufbyte := bufptr^; readbufbyte := bufptr^;
inc(bufptr); inc(bufptr);
end; end;
function readbuf(var dest; count: integer): integer; function readbuf(var dest; count: integer): integer;
var var
numbytes: integer; numbytes: integer;
begin begin
readbuf := 0; readbuf := 0;
repeat repeat
numbytes := @buf[bufsize-1] - bufptr + 1; numbytes := (@buf[bufsize-1] + 1) - bufptr;
if numbytes > count then if numbytes > count then
numbytes := count; numbytes := count;
if numbytes > 0 then if numbytes > 0 then
@ -178,7 +178,7 @@ var
end; end;
if count > 0 then if count > 0 then
readfilebuf readfilebuf
else else
break; break;
until false; until false;
end; end;