aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2011-08-21 01:28:07 +0200
committerStrangerke2011-08-21 01:28:07 +0200
commit62035d06bb0f7be05074921c901aa2cd61a53a39 (patch)
treef05d91156801122e5271f217cabc668535e055b5 /engines
parent81ae309d5f8617615305ef1c6ce280e7cc380d2a (diff)
downloadscummvm-rg350-62035d06bb0f7be05074921c901aa2cd61a53a39.tar.gz
scummvm-rg350-62035d06bb0f7be05074921c901aa2cd61a53a39.tar.bz2
scummvm-rg350-62035d06bb0f7be05074921c901aa2cd61a53a39.zip
CGE: Remove a useless pragma, and any code related to writing data
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/bitmap.cpp1
-rw-r--r--engines/cge/btfile.cpp42
-rw-r--r--engines/cge/btfile.h2
-rw-r--r--engines/cge/cfile.cpp100
-rw-r--r--engines/cge/cfile.h6
-rw-r--r--engines/cge/general.cpp17
-rw-r--r--engines/cge/general.h2
-rw-r--r--engines/cge/vol.h4
8 files changed, 14 insertions, 160 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index f9eae101ce..50bec4ed57 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -47,7 +47,6 @@ void Bitmap::init() {
void Bitmap::deinit() {
}
-#pragma argsused
Bitmap::Bitmap(const char *fname) : _m(NULL), _v(NULL), _map(0) {
debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%s)", fname);
diff --git a/engines/cge/btfile.cpp b/engines/cge/btfile.cpp
index a4d16010e5..449bd6aaad 100644
--- a/engines/cge/btfile.cpp
+++ b/engines/cge/btfile.cpp
@@ -43,27 +43,14 @@ BtFile::BtFile(const char *name, IOMode mode, Crypt *crpt)
_buff[i]._page = new BtPage;
_buff[i]._pgNo = kBtValNone;
_buff[i]._indx = -1;
- _buff[i]._updt = false;
assert(_buff[i]._page != NULL);
}
}
BtFile::~BtFile() {
debugC(1, kCGEDebugFile, "BtFile::~BtFile()");
- for (int i = 0; i < kBtLevel; i++) {
- putPage(i, false);
+ for (int i = 0; i < kBtLevel; i++)
delete _buff[i]._page;
- }
-}
-
-void BtFile::putPage(int lev, bool hard) {
- debugC(1, kCGEDebugFile, "BtFile::putPage(%d, %s)", lev, hard ? "true" : "false");
-
- if (hard || _buff[lev]._updt) {
- seek(_buff[lev]._pgNo * kBtSize);
- write((uint8 *) _buff[lev]._page, kBtSize);
- _buff[lev]._updt = false;
- }
}
BtPage *BtFile::getPage(int lev, uint16 pgn) {
@@ -71,26 +58,21 @@ BtPage *BtFile::getPage(int lev, uint16 pgn) {
if (_buff[lev]._pgNo != pgn) {
int32 pos = pgn * kBtSize;
- putPage(lev, false);
_buff[lev]._pgNo = pgn;
- if (size() > pos) {
- seek((uint32) pgn * kBtSize);
+ assert(size() > pos);
+ // In the original, there was a check verifying if the
+ // purpose was to write a new file. This should only be
+ // to create a new file, thus it was removed.
+ seek((uint32) pgn * kBtSize);
- // Read in the page
- byte buffer[kBtSize];
- int bytesRead = read(buffer, kBtSize);
+ // Read in the page
+ byte buffer[kBtSize];
+ int bytesRead = read(buffer, kBtSize);
- // Unpack it into the page structure
- Common::MemoryReadStream stream(buffer, bytesRead, DisposeAfterUse::NO);
- _buff[lev]._page->read(stream);
+ // Unpack it into the page structure
+ Common::MemoryReadStream stream(buffer, bytesRead, DisposeAfterUse::NO);
+ _buff[lev]._page->read(stream);
- _buff[lev]._updt = false;
- } else {
- memset(&_buff[lev]._page, 0, kBtSize);
- _buff[lev]._page->_hea._count = 0;
- _buff[lev]._page->_hea._down = kBtValNone;
- _buff[lev]._updt = true;
- }
_buff[lev]._indx = -1;
}
return _buff[lev]._page;
diff --git a/engines/cge/btfile.h b/engines/cge/btfile.h
index 7cfdc263e7..1095324116 100644
--- a/engines/cge/btfile.h
+++ b/engines/cge/btfile.h
@@ -77,10 +77,8 @@ class BtFile : public IoHand {
BtPage *_page;
uint16 _pgNo;
int _indx;
- bool _updt;
} _buff[kBtLevel];
- void putPage(int lev, bool hard);
BtPage *getPage(int lev, uint16 pgn);
public:
BtFile(const char *name, IOMode mode, Crypt *crpt);
diff --git a/engines/cge/cfile.cpp b/engines/cge/cfile.cpp
index c5c2c2c19c..f20ab16353 100644
--- a/engines/cge/cfile.cpp
+++ b/engines/cge/cfile.cpp
@@ -57,9 +57,6 @@ IoBuf::IoBuf(const char *name, IOMode mode, Crypt *crypt)
IoBuf::~IoBuf() {
debugC(6, kCGEDebugFile, "IoBuf::~IoBuf()");
-
- if (_mode != kModeRead)
- writeBuf();
free(_buff);
}
@@ -71,16 +68,6 @@ void IoBuf::readBuf() {
_ptr = 0;
}
-void IoBuf::writeBuf() {
- debugC(4, kCGEDebugFile, "IoBuf::writeBuf()");
-
- if (_lim) {
- IoHand::write(_buff, _lim);
- _bufMark = IoHand::mark();
- _lim = 0;
- }
-}
-
uint16 IoBuf::read(void *buf, uint16 len) {
debugC(4, kCGEDebugFile, "IoBuf::read(buf, %d)", len);
@@ -149,45 +136,6 @@ uint16 IoBuf::read(uint8 *buf) {
return total;
}
-uint16 IoBuf::write(void *buf, uint16 len) {
- debugC(1, kCGEDebugFile, "IoBuf::write(buf, %d)", len);
-
- uint16 tot = 0;
- while (len) {
- uint16 n = kBufferSize - _lim;
- if (n > len)
- n = len;
- if (n) {
- memcpy(_buff + _lim, buf, n);
- _lim += n;
- len -= n;
- buf = (uint8 *)buf + n;
- tot += n;
- } else
- writeBuf();
- }
- return tot;
-}
-
-uint16 IoBuf::write(uint8 *buf) {
- debugC(1, kCGEDebugFile, "IoBuf::write(buf)");
-
- uint16 len = 0;
- if (buf) {
- len = strlen((const char *) buf);
- if (len)
- if (buf[len - 1] == '\n')
- --len;
- len = write(buf, len);
- if (len) {
- static char EOL[] = "\r\n";
- uint16 n = write(EOL, sizeof(EOL) - 1);
- len += n;
- }
- }
- return len;
-}
-
int IoBuf::read() {
debugC(1, kCGEDebugFile, "IoBuf::read()");
@@ -199,14 +147,6 @@ int IoBuf::read() {
return _buff[_ptr++];
}
-void IoBuf::write(uint8 b) {
- debugC(1, kCGEDebugFile, "IoBuf::write(%d)", b);
-
- if (_lim >= kBufferSize)
- writeBuf();
- _buff[_lim++] = b;
-}
-
uint16 CFile::_maxLineLen = kLineMaxSize;
CFile::CFile(const char *name, IOMode mode, Crypt *crypt)
@@ -217,22 +157,6 @@ CFile::CFile(const char *name, IOMode mode, Crypt *crypt)
CFile::~CFile() {
}
-void CFile::flush() {
- debugC(1, kCGEDebugFile, "CFile::flush()");
-
- if (_mode != kModeRead)
- writeBuf();
- else
- _lim = 0;
-
- /*
- _BX = Handle;
- _AH = 0x68; // Flush buffer
- asm int 0x21
- */
- warning("FIXME: CFILE::Flush");
-}
-
long CFile::mark() {
debugC(5, kCGEDebugFile, "CFile::mark()");
@@ -243,33 +167,13 @@ long CFile::seek(long pos) {
debugC(1, kCGEDebugFile, "CFile::seek(%ld)", pos);
if (pos >= _bufMark && pos < _bufMark + _lim) {
- ((_mode == kModeRead) ? _ptr : _lim) = (uint16)(pos - _bufMark);
+ _ptr = (uint16)(pos - _bufMark);
return pos;
} else {
- if (_mode != kModeRead)
- writeBuf();
- else
- _lim = 0;
-
+ _lim = 0;
_ptr = 0;
return _bufMark = IoHand::seek(pos);
}
}
-void CFile::append(CFile &f) {
- debugC(1, kCGEDebugFile, "CFile::append(f)");
-
- seek(size());
- if (f._error == 0) {
- while (true) {
- if ((_lim = f.IoHand::read(_buff, kBufferSize)) == kBufferSize)
- writeBuf();
- else
- break;
- if ((_error = f._error) != 0)
- break;
- }
- }
-}
-
} // End of namespace CGE
diff --git a/engines/cge/cfile.h b/engines/cge/cfile.h
index f5d784073b..39260d2673 100644
--- a/engines/cge/cfile.h
+++ b/engines/cge/cfile.h
@@ -42,7 +42,6 @@ protected:
uint16 _lim;
long _bufMark;
virtual void readBuf();
- virtual void writeBuf();
public:
IoBuf(IOMode mode, Crypt *crpt);
IoBuf(const char *name, IOMode mode, Crypt *crpt);
@@ -50,9 +49,6 @@ public:
uint16 read(void *buf, uint16 len);
uint16 read(uint8 *buf);
int read();
- uint16 write(void *buf, uint16 len);
- uint16 write(uint8 *buf);
- void write(uint8 b);
};
@@ -61,10 +57,8 @@ public:
static uint16 _maxLineLen;
CFile(const char *name, IOMode mode, Crypt *crpt);
virtual ~CFile();
- void flush();
long mark();
long seek(long pos);
- void append(CFile &f);
};
} // End of namespace CGE
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 25ed7d6ff2..798749c2bf 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -233,23 +233,6 @@ uint16 IoHand::read(void *buf, uint16 len) {
return bytesRead;
}
-uint16 IoHand::write(void *buf, uint16 len) {
- warning("IOHAND::Write not supported");
- return 0;
-/*
- if (len) {
- if (Mode == kModeRead || Handle < 0)
- return 0;
- if (Crypt)
- Seed = Crypt(buf, len, Seed);
- Error = _dos_write(Handle, buf, len, &len);
- if (Crypt)
- Seed = Crypt(buf, len, Seed); //------$$$$$$$
- }
- return len;
-*/
-}
-
long IoHand::mark() {
return _file->pos();
}
diff --git a/engines/cge/general.h b/engines/cge/general.h
index 90cba269cd..75a3f3da93 100644
--- a/engines/cge/general.h
+++ b/engines/cge/general.h
@@ -75,7 +75,6 @@ public:
XFile(IOMode mode) : _mode(mode), _error(0) { }
virtual ~XFile() { }
virtual uint16 read(void *buf, uint16 len) = 0;
- virtual uint16 write(void *buf, uint16 len) = 0;
virtual long mark() = 0;
virtual long size() = 0;
virtual long seek(long pos) = 0;
@@ -99,7 +98,6 @@ public:
virtual ~IoHand();
static bool exist(const char *name);
uint16 read(void *buf, uint16 len);
- uint16 write(void *buf, uint16 len);
long mark();
long size();
long seek(long pos);
diff --git a/engines/cge/vol.h b/engines/cge/vol.h
index f9d9382eac..d85faa4f4a 100644
--- a/engines/cge/vol.h
+++ b/engines/cge/vol.h
@@ -45,9 +45,6 @@ class Dat {
VOLBASE _file;
public:
Dat();
-
- bool append(uint8 *buf, uint16 len);
- bool write(CFile &f);
bool read(long org, uint16 len, uint8 *buf);
};
@@ -61,7 +58,6 @@ private:
long _endMark;
void readBuf();
- void writeBuf() { }
public:
VFile(const char *name, IOMode mode = kModeRead);
~VFile();