Explorar o código

ReaderMonitor: receive at least "min" number of bytes specified by the user

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7104 8c9fc860-2736-0410-a75d-ab315db34111
eth.morozova %!s(int64=8) %!d(string=hai) anos
pai
achega
52a89c89f4
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      source/StreamUtilities.Mod

+ 1 - 0
source/StreamUtilities.Mod

@@ -254,6 +254,7 @@ TYPE
 		PROCEDURE Receiver(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len, res: LONGINT);
 		BEGIN
 			ASSERT((size > 0) & (min <= size) & (min >= 0));
+			size := MAX(min,MIN(in.Available(),size));
 			in.Bytes(buf, ofs, size, len);
 			INC(received,len);
 			res:=in.res;