Ver código fonte

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 8 anos atrás
pai
commit
52a89c89f4
1 arquivos alterados com 1 adições e 0 exclusões
  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;