aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-05-01 17:28:59 +0000
committerNicola Mettifogo2007-05-01 17:28:59 +0000
commit727867c66f5d856a848bbb6bb67543342dd0c63b (patch)
tree283374cc399eed5e190de014af28155345356b28
parent38a5e37eaf24f7d2d7c0ce952aad5d52f503fae0 (diff)
downloadscummvm-rg350-727867c66f5d856a848bbb6bb67543342dd0c63b.tar.gz
scummvm-rg350-727867c66f5d856a848bbb6bb67543342dd0c63b.tar.bz2
scummvm-rg350-727867c66f5d856a848bbb6bb67543342dd0c63b.zip
- Fixed 32/64 bits pointer mismatch.
- Changed Surface's forward from class to struct. svn-id: r26727
-rw-r--r--graphics/iff.cpp10
-rw-r--r--graphics/iff.h4
2 files changed, 6 insertions, 8 deletions
diff --git a/graphics/iff.cpp b/graphics/iff.cpp
index d4f12e6d35..c45a9eb850 100644
--- a/graphics/iff.cpp
+++ b/graphics/iff.cpp
@@ -245,8 +245,8 @@ bool PackBitsReadStream::eos() const {
}
uint32 PackBitsReadStream::read(void *dataPtr, uint32 dataSize) {
- _outSize = (int32)dataSize;
_out = (byte*)dataPtr;
+ _outEnd = _out + dataSize;
feed();
unpack();
@@ -254,7 +254,7 @@ uint32 PackBitsReadStream::read(void *dataPtr, uint32 dataSize) {
}
void PackBitsReadStream::store(byte b) {
- if (_outSize > 0) {
+ if (_out < _outEnd) {
*_out++ = b;
_unpacked++;
_wStoragePos = _storage;
@@ -264,20 +264,18 @@ void PackBitsReadStream::store(byte b) {
}
_rStoragePos = _storage;
- _outSize--;
}
void PackBitsReadStream::feed() {
_fed = 0;
- int len = MIN(_wStoragePos - _rStoragePos, _outSize);
+ int len = MIN(_wStoragePos - _rStoragePos, _outEnd - _out);
if (len == 0) return;
for (int i = 0; i < len; i++)
*_out++ = *_rStoragePos++;
_fed = len;
- _outSize -= len;
}
void PackBitsReadStream::unpack() {
@@ -287,7 +285,7 @@ void PackBitsReadStream::unpack() {
uint32 i, j;
_unpacked = 0;
- while (_outSize > 0 && !_input->eos()) {
+ while (_out < _outEnd && !_input->eos()) {
byteRun = _input->readByte();
if (byteRun <= 127) {
i = byteRun + 1;
diff --git a/graphics/iff.h b/graphics/iff.h
index d716418f8f..740f4b6d8c 100644
--- a/graphics/iff.h
+++ b/graphics/iff.h
@@ -27,7 +27,7 @@
namespace Graphics {
-class Surface;
+struct Surface;
struct BMHD {
@@ -117,8 +117,8 @@ protected:
byte *_wStoragePos;
byte *_rStoragePos;
- int32 _outSize;
byte* _out;
+ byte* _outEnd;
int32 _fed;
int32 _unpacked;