Re: [Oberon] Bug in AosUnzip or AosInflate?

Yaroslav Romanchenko tobject at bk.ru
Sat Jan 20 08:05:35 MET 2007


AosIO.RawInt at reading of data from Inflate stream does not make warranty, that INTEGER will be made exactly from the two CHARs, even if these CHARs are in stream.

For example, such variant of RawInt works:
	(** Read a INTEGER. *)
		PROCEDURE RawInt (in: AosIO.Reader; VAR x: INTEGER);  
		VAR ignore: LONGINT;
			c1, c2: ARRAY 3 OF CHAR;
			p: LONGINT;
		BEGIN
			p := SYSTEM.ADR (x);
			in.Bytes(c1, 0, 2, ignore);
			IF (ignore = 1) & (in.Available () > 0) THEN
				in.Bytes(c2, 0, 1, ignore);
				SYSTEM.PUT (p, c1[0]);
				SYSTEM.PUT (p + 1, c2[0]);
			ELSE
				SYSTEM.PUT (p, c1[0]);
				SYSTEM.PUT (p + 1, c1[1]);
			END;
		END RawInt;

Because after:
	in.Bytes(c1, 0, 2, ignore);
such situation is possible:
	(ignore = 1) & (in.Available () > 0)


---
Cheers, SAGE
http://sage.h15.ru/


More information about the Oberon mailing list