diff options
author | Max Horn | 2008-09-13 20:04:19 +0000 |
---|---|---|
committer | Max Horn | 2008-09-13 20:04:19 +0000 |
commit | 71a204d63cbbea985099d1909423e9e4b0a12e43 (patch) | |
tree | cea3d003c07c92f13a53feb6c77f9323f208f7dc /engines/scumm/smush/chunk.cpp | |
parent | eefefa0afa77bb5547744a00bf95c04ac7df0b41 (diff) | |
download | scummvm-rg350-71a204d63cbbea985099d1909423e9e4b0a12e43.tar.gz scummvm-rg350-71a204d63cbbea985099d1909423e9e4b0a12e43.tar.bz2 scummvm-rg350-71a204d63cbbea985099d1909423e9e4b0a12e43.zip |
SCUMM: Merged class BaseChunk & Chunk; got rid of MemoryChunk
svn-id: r34516
Diffstat (limited to 'engines/scumm/smush/chunk.cpp')
-rw-r--r-- | engines/scumm/smush/chunk.cpp | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/engines/scumm/smush/chunk.cpp b/engines/scumm/smush/chunk.cpp index 855f0a3985..2a797d459b 100644 --- a/engines/scumm/smush/chunk.cpp +++ b/engines/scumm/smush/chunk.cpp @@ -34,30 +34,7 @@ namespace Scumm { -BaseChunk::BaseChunk() : - _type(0), - _size(0), - _curPos(0), - _name("") { -} - -bool BaseChunk::eos() const { - return _curPos >= _size; -} - -int32 BaseChunk::pos() const { - return _curPos; -} - -Chunk::type BaseChunk::getType() const { - return _type; -} - -int32 BaseChunk::size() const { - return _size; -} - -bool BaseChunk::seek(int32 delta, int dir) { +bool Chunk::seek(int32 delta, int dir) { switch (dir) { case SEEK_CUR: _curPos += delta; @@ -139,32 +116,4 @@ uint32 FileChunk::read(void *buffer, uint32 dataSize) { return dataSize; } -MemoryChunk::MemoryChunk(byte *data) { - if (data == 0) - error("Chunk() called with NULL pointer"); - - _type = (Chunk::type)READ_BE_UINT32(data); - _size = READ_BE_UINT32(data + 4); - _data = data + sizeof(Chunk::type) + sizeof(uint32); - _curPos = 0; -} - -Chunk *MemoryChunk::subBlock() { - MemoryChunk *ptr = new MemoryChunk(_data + _curPos); - skip(sizeof(Chunk::type) + sizeof(uint32) + ptr->size()); - return ptr; -} - -void MemoryChunk::reseek() { -} - -uint32 MemoryChunk::read(void *buffer, uint32 dataSize) { - if (dataSize <= 0 || (_curPos + dataSize) > _size) - error("invalid buffer read request"); - - memcpy(buffer, _data + _curPos, dataSize); - _curPos += dataSize; - return dataSize; -} - } // End of namespace Scumm |