aboutsummaryrefslogtreecommitdiff
path: root/common/file.cpp
diff options
context:
space:
mode:
authorMax Horn2004-04-17 09:57:15 +0000
committerMax Horn2004-04-17 09:57:15 +0000
commite17a15d96e46939d2ec4403ee5241baafdd562c0 (patch)
tree4e51f687eb2c57d5eba1604ad2f0d412416f64a5 /common/file.cpp
parent9b904682b18c4a4a7540fb1dca721544a8d448a3 (diff)
downloadscummvm-rg350-e17a15d96e46939d2ec4403ee5241baafdd562c0.tar.gz
scummvm-rg350-e17a15d96e46939d2ec4403ee5241baafdd562c0.tar.bz2
scummvm-rg350-e17a15d96e46939d2ec4403ee5241baafdd562c0.zip
Introduce ReadStream and WriteStream (as explained in my File class design mails on scummvm-devel)
svn-id: r13595
Diffstat (limited to 'common/file.cpp')
-rw-r--r--common/file.cpp72
1 files changed, 0 insertions, 72 deletions
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));
-}