From e17a15d96e46939d2ec4403ee5241baafdd562c0 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 17 Apr 2004 09:57:15 +0000 Subject: Introduce ReadStream and WriteStream (as explained in my File class design mails on scummvm-devel) svn-id: r13595 --- common/file.cpp | 72 --------------------------------------------------------- 1 file changed, 72 deletions(-) (limited to 'common/file.cpp') diff --git a/common/file.cpp b/common/file.cpp index cbb2b58189..b9f097c986 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -273,45 +273,6 @@ uint32 File::read(void *ptr, uint32 len) { return real_len; } -byte File::readByte() { - byte b; - - if (_handle == NULL) { - error("File is not open!"); - return 0; - } - - if (fread(&b, 1, 1, _handle) != 1) { - clearerr(_handle); - _ioFailed = true; - } - return b ^ _encbyte; -} - -uint16 File::readUint16LE() { - uint16 a = readByte(); - uint16 b = readByte(); - return a | (b << 8); -} - -uint32 File::readUint32LE() { - uint32 a = readUint16LE(); - uint32 b = readUint16LE(); - return (b << 16) | a; -} - -uint16 File::readUint16BE() { - uint16 b = readByte(); - uint16 a = readByte(); - return a | (b << 8); -} - -uint32 File::readUint32BE() { - uint32 b = readUint16BE(); - uint32 a = readUint16BE(); - return (b << 16) | a; -} - uint32 File::write(const void *ptr, uint32 len) { byte *tmp = 0; @@ -345,36 +306,3 @@ uint32 File::write(const void *ptr, uint32 len) { return len; } - -void File::writeByte(byte value) { - value ^= _encbyte; - - if (_handle == NULL) { - error("File is not open!"); - } - - if (fwrite(&value, 1, 1, _handle) != 1) { - clearerr(_handle); - _ioFailed = true; - } -} - -void File::writeUint16LE(uint16 value) { - writeByte((byte)(value & 0xff)); - writeByte((byte)(value >> 8)); -} - -void File::writeUint32LE(uint32 value) { - writeUint16LE((uint16)(value & 0xffff)); - writeUint16LE((uint16)(value >> 16)); -} - -void File::writeUint16BE(uint16 value) { - writeByte((byte)(value >> 8)); - writeByte((byte)(value & 0xff)); -} - -void File::writeUint32BE(uint32 value) { - writeUint16BE((uint16)(value >> 16)); - writeUint16BE((uint16)(value & 0xffff)); -} -- cgit v1.2.3