Selaa lähdekoodia

* Small safety precaution

Michaël Van Canneyt 3 vuotta sitten
vanhempi
commit
042eb7e8c1
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      rtl/objpas/classes/streams.inc

+ 2 - 2
rtl/objpas/classes/streams.inc

@@ -414,7 +414,7 @@ begin
     if r>High(Longint) then r:=High(Longint);
     r:=Read(PByte(@Buffer)[t],r);
     inc(t,r);
-  until (t=Count) or (r<=0);
+  until (t>=Count) or (r<=0);
   if (t<Count) then
     raise EReadError.Create(SReadError);
 end;
@@ -591,7 +591,7 @@ begin
     if w>High(Longint) then w:=High(Longint);
     w:=Write(PByte(@Buffer)[t],w);
     inc(t,w);
-  until (t=count) or (w<=0);
+  until (t>=count) or (w<=0);
   if (t<Count) then
     raise EWriteError.Create(SWriteError);
 end;