aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/sound.cpp4
-rw-r--r--engines/agi/wagparser.h4
-rw-r--r--engines/cine/texte.cpp2
-rw-r--r--engines/cine/various.cpp2
-rw-r--r--engines/gob/dataio.cpp20
-rw-r--r--engines/gob/dataio.h6
-rw-r--r--engines/gob/saveload.cpp2
-rw-r--r--engines/kyra/resource.cpp2
-rw-r--r--engines/kyra/resource_intern.cpp26
-rw-r--r--engines/kyra/script.cpp8
-rw-r--r--engines/kyra/vqa.cpp4
-rw-r--r--engines/m4/converse.cpp4
-rw-r--r--engines/m4/midi.cpp2
-rw-r--r--engines/parallaction/disk.h6
-rw-r--r--engines/parallaction/disk_ns.cpp24
-rw-r--r--engines/saga/rscfile.cpp6
-rw-r--r--engines/scumm/file.cpp16
-rw-r--r--engines/scumm/file.h29
-rw-r--r--engines/scumm/file_nes.cpp6
-rw-r--r--engines/scumm/file_nes.h6
-rw-r--r--engines/scumm/smush/chunk.cpp8
-rw-r--r--engines/scumm/smush/chunk.h6
-rw-r--r--engines/scumm/smush/smush_player.cpp2
-rw-r--r--engines/scumm/smush/smush_player.h2
-rw-r--r--engines/sword1/music.cpp2
-rw-r--r--engines/sword2/sound.h2
-rw-r--r--engines/tinsel/sound.cpp4
-rw-r--r--engines/tinsel/sound.h2
28 files changed, 106 insertions, 101 deletions
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 1312dd414d..3b28e75c56 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -1013,7 +1013,7 @@ bool IIgsSoundMgr::loadInstrumentHeaders(const Common::String &exePath, const II
// Open the executable file and check that it has correct size
file.open(exePath);
- if (file.size() != exeInfo.exeSize) {
+ if (file.size() != (int32)exeInfo.exeSize) {
debugC(3, kDebugLevelSound, "Apple IIGS executable (%s) has wrong size (Is %d, should be %d)",
exePath.c_str(), file.size(), exeInfo.exeSize);
}
@@ -1023,7 +1023,7 @@ bool IIgsSoundMgr::loadInstrumentHeaders(const Common::String &exePath, const II
file.close();
// Check that we got enough data to be able to parse the instruments
- if (data && data->size() >= (exeInfo.instSetStart + exeInfo.instSet.byteCount)) {
+ if (data && data->size() >= (int32)(exeInfo.instSetStart + exeInfo.instSet.byteCount)) {
// Check instrument set's length (The info's saved in the executable)
data->seek(exeInfo.instSetStart - 4);
uint16 instSetByteCount = data->readUint16LE();
diff --git a/engines/agi/wagparser.h b/engines/agi/wagparser.h
index 2f4003315f..827720ac85 100644
--- a/engines/agi/wagparser.h
+++ b/engines/agi/wagparser.h
@@ -201,7 +201,9 @@ protected:
class WagFileParser {
// Constants, type definitions, enumerations etc.
public:
- static const uint WINAGI_VERSION_LENGTH = 16; ///< WinAGI's version string's length (Always 16)
+ enum {
+ WINAGI_VERSION_LENGTH = 16 ///< WinAGI's version string's length (Always 16)
+ };
typedef Common::Array<WagProperty> PropertyList; ///< A type definition for an array of *.wag file properties
public:
diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp
index c8d48d3a06..ffc36b4b1a 100644
--- a/engines/cine/texte.cpp
+++ b/engines/cine/texte.cpp
@@ -61,7 +61,7 @@ void loadTextData(const char *filename) {
const uint bytesPerChar = fontDataSize / numChars; // Observed values: 64.
static const uint bytesPerRow = FONT_WIDTH / 2; // The input font data is 4-bit so it takes only half the space
- if (headerSize + fontDataSize != fileHandle.size()) {
+ if (headerSize + fontDataSize != (uint)fileHandle.size()) {
warning("loadTextData: file '%s' (entrySize = %d, entryCount = %d) is of incorrect size %d", filename, entrySize, entryCount, fileHandle.size());
}
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 2621278c59..92fd35d865 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -497,7 +497,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle
uint animEntrySize = animEntrySizeChoices[i];
// Jump over the animDataTable entries and the screen parameters
- uint32 newPos = animDataTableStart + animEntrySize * animEntriesCount + sizeofScreenParams;
+ int32 newPos = animDataTableStart + animEntrySize * animEntriesCount + sizeofScreenParams;
// Check that there's data left after the point we're going to jump to
if (newPos >= fHandle.size()) {
continue;
diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp
index bcf566d134..0a3f317ada 100644
--- a/engines/gob/dataio.cpp
+++ b/engines/gob/dataio.cpp
@@ -62,31 +62,33 @@ DataStream::~DataStream() {
}
}
-uint32 DataStream::pos() const {
+int32 DataStream::pos() const {
if (_stream)
return _stream->pos();
- uint32 resPos = _io->getChunkPos(_handle);
- if (resPos != 0xFFFFFFFF)
+ int32 resPos = _io->getChunkPos(_handle);
+ if (resPos != -1)
return resPos;
return _io->file_getHandle(_handle)->pos();
}
-uint32 DataStream::size() const {
+int32 DataStream::size() const {
if (_stream)
return _stream->size();
return _size;
}
-void DataStream::seek(int32 offset, int whence) {
+bool DataStream::seek(int32 offset, int whence) {
if (_stream)
- _stream->seek(offset, whence);
+ return _stream->seek(offset, whence);
else if ((_handle < 50) || (_handle >= 128))
- _io->file_getHandle(_handle)->seek(offset, whence);
- else
- _io->seekChunk(_handle, offset, whence);
+ return _io->file_getHandle(_handle)->seek(offset, whence);
+ else {
+ _io->seekChunk(_handle, offset, whence);
+ return true;
+ }
}
bool DataStream::eos() const {
diff --git a/engines/gob/dataio.h b/engines/gob/dataio.h
index 4b4c79d1eb..c67dc89df8 100644
--- a/engines/gob/dataio.h
+++ b/engines/gob/dataio.h
@@ -45,10 +45,10 @@ public:
DataStream(byte *buf, uint32 dSize, bool dispose = true);
virtual ~DataStream();
- virtual uint32 pos() const;
- virtual uint32 size() const;
+ virtual int32 pos() const;
+ virtual int32 size() const;
- virtual void seek(int32 offset, int whence = SEEK_SET);
+ virtual bool seek(int32 offset, int whence = SEEK_SET);
virtual bool eos() const;
diff --git a/engines/gob/saveload.cpp b/engines/gob/saveload.cpp
index fa9f8ea7a9..e3212ac8ff 100644
--- a/engines/gob/saveload.cpp
+++ b/engines/gob/saveload.cpp
@@ -513,7 +513,7 @@ bool StagedSave::read() {
return false;
}
- uint32 saveSize = getSize();
+ int32 saveSize = getSize();
if (in->size() != saveSize) {
warning("Wrong size (%d != %d)", in->size(), saveSize);
return false;
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 531f875cc3..0f0a643017 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -262,7 +262,7 @@ bool Resource::loadFileToBuf(const char *file, void *buf, uint32 maxSize) {
return false;
memset(buf, 0, maxSize);
- stream->read(buf, (maxSize <= stream->size()) ? maxSize : stream->size());
+ stream->read(buf, ((int32)maxSize <= stream->size()) ? maxSize : stream->size());
delete stream;
return true;
}
diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp
index e6b3b14c8a..f97319a43a 100644
--- a/engines/kyra/resource_intern.cpp
+++ b/engines/kyra/resource_intern.cpp
@@ -127,8 +127,8 @@ bool ResLoaderPak::checkFilename(Common::String filename) const {
}
bool ResLoaderPak::isLoadable(const Common::String &filename, Common::SeekableReadStream &stream) const {
- uint32 filesize = stream.size();
- uint32 offset = 0;
+ int32 filesize = stream.size();
+ int32 offset = 0;
bool switchEndian = false;
bool firstFile = true;
@@ -138,7 +138,7 @@ bool ResLoaderPak::isLoadable(const Common::String &filename, Common::SeekableRe
offset = SWAP_BYTES_32(offset);
}
- Common::String file = "";
+ Common::String file;
while (!stream.eos()) {
// The start offset of a file should never be in the filelist
if (offset < stream.pos() || offset > filesize)
@@ -146,7 +146,7 @@ bool ResLoaderPak::isLoadable(const Common::String &filename, Common::SeekableRe
byte c = 0;
- file = "";
+ file.clear();
while (!stream.eos() && (c = stream.readByte()) != 0)
file += c;
@@ -196,9 +196,9 @@ struct PlainArchiveListSearch {
} // end of anonymous namespace
Common::Archive *ResLoaderPak::load(Resource *owner, const Common::String &filename, Common::SeekableReadStream &stream) const {
- uint32 filesize = stream.size();
+ int32 filesize = stream.size();
- uint32 startoffset = 0, endoffset = 0;
+ int32 startoffset = 0, endoffset = 0;
bool switchEndian = false;
bool firstFile = true;
@@ -210,7 +210,7 @@ Common::Archive *ResLoaderPak::load(Resource *owner, const Common::String &filen
PlainArchive::FileInputList files;
- Common::String file = "";
+ Common::String file;
while (!stream.eos()) {
// The start offset of a file should never be in the filelist
if (startoffset < stream.pos() || startoffset > filesize) {
@@ -218,7 +218,7 @@ Common::Archive *ResLoaderPak::load(Resource *owner, const Common::String &filen
return false;
}
- file = "";
+ file.clear();
byte c = 0;
while (!stream.eos() && (c = stream.readByte()) != 0)
@@ -301,7 +301,7 @@ bool ResLoaderInsMalcolm::checkFilename(Common::String filename) const {
bool ResLoaderInsMalcolm::isLoadable(const Common::String &filename, Common::SeekableReadStream &stream) const {
stream.seek(3, SEEK_SET);
- uint32 size = stream.readUint32LE();
+ int32 size = stream.readUint32LE();
if (size+7 > stream.size())
return false;
@@ -322,13 +322,13 @@ Common::Archive *ResLoaderInsMalcolm::load(Resource *owner, const Common::String
// first file is the index table
uint32 size = stream.readUint32LE();
- Common::String temp = "";
+ Common::String temp;
for (uint32 i = 0; i < size; ++i) {
byte c = stream.readByte();
if (c == '\\') {
- temp = "";
+ temp.clear();
} else if (c == 0x0D) {
// line endings are CRLF
c = stream.readByte();
@@ -363,12 +363,12 @@ bool ResLoaderTlk::checkFilename(Common::String filename) const {
bool ResLoaderTlk::isLoadable(const Common::String &filename, Common::SeekableReadStream &stream) const {
uint16 entries = stream.readUint16LE();
- uint32 entryTableSize = (entries * 8);
+ int32 entryTableSize = (entries * 8);
if (entryTableSize + 2 > stream.size())
return false;
- uint32 offset = 0;
+ int32 offset = 0;
for (uint i = 0; i < entries; ++i) {
stream.readUint32LE();
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index df933c3ed8..dba09f08ef 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -255,13 +255,13 @@ uint32 ScriptFileParser::getIFFBlockSize(const uint32 chunkName) {
_stream->seek(_startOffset + 0x0C);
- while (_stream->pos() < _endOffset) {
+ while ((uint)_stream->pos() < _endOffset) {
uint32 chunk = _stream->readUint32LE();
uint32 size_temp = _stream->readUint32BE();
if (chunk != chunkName) {
_stream->seek((size_temp + 1) & (~1), SEEK_CUR);
- assert(_stream->pos() <= _endOffset);
+ assert((uint)_stream->pos() <= _endOffset);
} else {
size = size_temp;
break;
@@ -274,13 +274,13 @@ uint32 ScriptFileParser::getIFFBlockSize(const uint32 chunkName) {
bool ScriptFileParser::loadIFFBlock(const uint32 chunkName, void *loadTo, uint32 ptrSize) {
_stream->seek(_startOffset + 0x0C);
- while (_stream->pos() < _endOffset) {
+ while ((uint)_stream->pos() < _endOffset) {
uint32 chunk = _stream->readUint32LE();
uint32 chunkSize = _stream->readUint32BE();
if (chunk != chunkName) {
_stream->seek((chunkSize + 1) & (~1), SEEK_CUR);
- assert(_stream->pos() <= _endOffset);
+ assert((uint)_stream->pos() <= _endOffset);
} else {
uint32 loadSize = 0;
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 9a9941e20e..0f6440fd47 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -406,7 +406,7 @@ void VQAMovie::displayFrame(uint frameNum) {
byte *inbuf, *outbuf;
uint32 insize, outsize;
- uint32 end;
+ int32 end;
switch (tag) {
case MKID_BE('SND0'): // Uncompressed sound
@@ -594,7 +594,7 @@ void VQAMovie::play() {
uint32 insize, outsize;
if (_stream) {
- while (_file->pos() < (_frameInfo[0] & 0x7FFFFFFF)) {
+ while ((uint)_file->pos() < (_frameInfo[0] & 0x7FFFFFFF)) {
uint32 tag = readTag();
uint32 size = _file->readUint32BE();
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
index 5b8bdab9d6..47d84f6a28 100644
--- a/engines/m4/converse.cpp
+++ b/engines/m4/converse.cpp
@@ -544,10 +544,10 @@ void Converse::loadConversation(const char *convName) {
curNode, _convNodes[curNode]->entries.size() - 1);
// Seek to chunk data (i.e. TEXT/MESG tag, which is usually right
// after this chunk but it can be further on in conditional reply chunks
- assert(data >= convS->pos());
+ assert((int)data >= convS->pos());
// If the entry's data is not right after the entry, remember the position
// to return to after the data is read
- if (chunk == CHUNK_CRPL && data != convS->pos())
+ if (chunk == CHUNK_CRPL && (int)data != convS->pos())
returnAddress = convS->pos();
convS->seek(data, SEEK_SET);
}
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
index 51dd8654ae..3f1da2a369 100644
--- a/engines/m4/midi.cpp
+++ b/engines/m4/midi.cpp
@@ -269,7 +269,7 @@ byte *MidiPlayer::convertHMPtoSMF(byte *data, uint32 inSize, uint32 &outSize) {
byte lastCmd = 0;
// Now we can finally convert the track
- uint32 endPos = readS.pos() + trackLength;
+ int32 endPos = readS.pos() + trackLength;
while (readS.pos() < endPos) {
// Convert the VLQ
byte vlq[4];
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index 0176260129..30d820c6d2 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -104,10 +104,10 @@ public:
Common::String name() const;
bool openArchivedFile(const char *name);
void closeArchivedFile();
- uint32 size() const;
- uint32 pos() const;
+ int32 size() const;
+ int32 pos() const;
bool eos() const;
- void seek(int32 offs, int whence = SEEK_SET);
+ bool seek(int32 offs, int whence = SEEK_SET);
uint32 read(void *dataPtr, uint32 dataSize);
};
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index 55e6fc5e77..c50373aba1 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -156,11 +156,11 @@ void Archive::closeArchivedFile() {
}
-uint32 Archive::size() const {
+int32 Archive::size() const {
return (_file == true ? _fileEndOffset - _fileOffset : 0);
}
-uint32 Archive::pos() const {
+int32 Archive::pos() const {
return (_file == true ? _fileCursor - _fileOffset : 0 );
}
@@ -168,7 +168,7 @@ bool Archive::eos() const {
return (_file == true ? _fileCursor == _fileEndOffset : true );
}
-void Archive::seek(int32 offs, int whence) {
+bool Archive::seek(int32 offs, int whence) {
assert(_file == true && _fileCursor <= _fileEndOffset);
switch (whence) {
@@ -184,7 +184,7 @@ void Archive::seek(int32 offs, int whence) {
}
assert(_fileCursor <= _fileEndOffset && _fileCursor >= _fileOffset);
- _archive.seek(_fileCursor, SEEK_SET);
+ return _archive.seek(_fileCursor, SEEK_SET);
}
uint32 Archive::read(void *dataPtr, uint32 dataSize) {
@@ -234,16 +234,16 @@ public:
return _input->read(data, dataSize);
}
- uint32 pos() const {
+ int32 pos() const {
return _input->pos();
}
- uint32 size() const {
+ int32 size() const {
return _input->size();
}
- void seek(int32 offset, int whence) {
- _input->seek(offset, whence);
+ bool seek(int32 offset, int whence) {
+ return _input->seek(offset, whence);
}
};
@@ -798,11 +798,11 @@ public:
if (_dispose) delete _stream;
}
- uint32 size() const {
+ int32 size() const {
return _stream->size();
}
- uint32 pos() const {
+ int32 pos() const {
return _stream->pos();
}
@@ -810,8 +810,8 @@ public:
return _stream->eos();
}
- void seek(int32 offs, int whence = SEEK_SET) {
- _stream->seek(offs, whence);
+ bool seek(int32 offs, int whence = SEEK_SET) {
+ return _stream->seek(offs, whence);
}
uint32 read(void *dataPtr, uint32 dataSize) {
diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp
index d1ad46a6fc..05b1162973 100644
--- a/engines/saga/rscfile.cpp
+++ b/engines/saga/rscfile.cpp
@@ -121,7 +121,7 @@ bool Resource::loadSagaContext(ResourceContext *context, uint32 contextOffset, u
resourceData->offset = contextOffset + readS1.readUint32();
resourceData->size = readS1.readUint32();
//sanity check
- if ((resourceData->offset > context->file->size()) || (resourceData->size > contextSize)) {
+ if ((resourceData->offset > (uint)context->file->size()) || (resourceData->size > contextSize)) {
result = false;
break;
}
@@ -181,8 +181,8 @@ bool Resource::loadMacContext(ResourceContext *context) {
macDataLength = context->file->readUint32BE();
macMapLength = context->file->readUint32BE();
- if (macDataOffset >= context->file->size() || macMapOffset >= context->file->size() ||
- macDataLength + macMapLength > context->file->size()) {
+ if (macDataOffset >= (uint)context->file->size() || macMapOffset >= (uint)context->file->size() ||
+ macDataLength + macMapLength > (uint)context->file->size()) {
return false;
}
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp
index 075b44d24d..22079332e4 100644
--- a/engines/scumm/file.cpp
+++ b/engines/scumm/file.cpp
@@ -42,9 +42,9 @@ void ScummFile::setEnc(byte value) {
_encbyte = value;
}
-void ScummFile::setSubfileRange(uint32 start, uint32 len) {
+void ScummFile::setSubfileRange(int32 start, int32 len) {
// TODO: Add sanity checks
- const uint32 fileSize = File::size();
+ const int32 fileSize = File::size();
assert(start <= fileSize);
assert(start + len <= fileSize);
_subFileStart = start;
@@ -129,15 +129,15 @@ bool ScummFile::eos() {
return _subFileLen ? (pos() >= _subFileLen) : File::eos();
}
-uint32 ScummFile::pos() {
+int32 ScummFile::pos() {
return File::pos() - _subFileStart;
}
-uint32 ScummFile::size() {
+int32 ScummFile::size() {
return _subFileLen ? _subFileLen : File::size();
}
-void ScummFile::seek(int32 offs, int whence) {
+bool ScummFile::seek(int32 offs, int whence) {
if (_subFileLen) {
// Constrain the seek to the subfile
switch (whence) {
@@ -154,7 +154,7 @@ void ScummFile::seek(int32 offs, int whence) {
assert((int32)_subFileStart <= offs && offs <= (int32)(_subFileStart + _subFileLen));
whence = SEEK_SET;
}
- File::seek(offs, whence);
+ return File::seek(offs, whence);
}
uint32 ScummFile::read(void *dataPtr, uint32 dataSize) {
@@ -162,9 +162,9 @@ uint32 ScummFile::read(void *dataPtr, uint32 dataSize) {
if (_subFileLen) {
// Limit the amount we read by the subfile boundaries.
- const uint32 curPos = pos();
+ const int32 curPos = pos();
assert(_subFileLen >= curPos);
- uint32 newPos = curPos + dataSize;
+ int32 newPos = curPos + dataSize;
if (newPos > _subFileLen) {
dataSize = _subFileLen - curPos;
_myIoFailed = true;
diff --git a/engines/scumm/file.h b/engines/scumm/file.h
index 3a044935a1..336f3cde12 100644
--- a/engines/scumm/file.h
+++ b/engines/scumm/file.h
@@ -40,25 +40,26 @@ public:
virtual bool openSubFile(const Common::String &filename) = 0;
virtual bool eos() = 0;
- virtual uint32 pos() = 0;
- virtual uint32 size() = 0;
- virtual void seek(int32 offs, int whence = SEEK_SET) = 0;
+ virtual int32 pos() = 0;
+ virtual int32 size() = 0;
+ virtual bool seek(int32 offs, int whence = SEEK_SET) = 0;
virtual uint32 read(void *dataPtr, uint32 dataSize) = 0;
};
class ScummFile : public BaseScummFile {
private:
byte _encbyte;
- uint32 _subFileStart;
- uint32 _subFileLen;
+ int32 _subFileStart;
+ int32 _subFileLen;
bool _myIoFailed;
+
+ void setSubfileRange(int32 start, int32 len);
+ void resetSubfile();
+
public:
ScummFile();
void setEnc(byte value);
- void setSubfileRange(uint32 start, uint32 len);
- void resetSubfile();
-
bool open(const Common::String &filename);
bool openSubFile(const Common::String &filename);
@@ -66,9 +67,9 @@ public:
void clearIOFailed() { _myIoFailed = false; BaseScummFile::clearIOFailed(); }
bool eos();
- uint32 pos();
- uint32 size();
- void seek(int32 offs, int whence = SEEK_SET);
+ int32 pos();
+ int32 size();
+ bool seek(int32 offs, int whence = SEEK_SET);
uint32 read(void *dataPtr, uint32 dataSize);
};
@@ -111,9 +112,9 @@ public:
void close();
bool eos() { return _stream->eos(); }
- uint32 pos() { return _stream->pos(); }
- uint32 size() { return _stream->size(); }
- void seek(int32 offs, int whence = SEEK_SET) { _stream->seek(offs, whence); }
+ int32 pos() { return _stream->pos(); }
+ int32 size() { return _stream->size(); }
+ bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); }
uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
};
diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp
index 8325436f87..0ddbd0b3ee 100644
--- a/engines/scumm/file_nes.cpp
+++ b/engines/scumm/file_nes.cpp
@@ -1124,8 +1124,7 @@ bool ScummNESFile::generateResource(int res) {
write_byte(&out, 0xD1);
write_byte(&out, 0xF5);
- if (_stream)
- delete _stream;
+ delete _stream;
_stream = new Common::MemoryReadStream(_buf, bufsize);
@@ -1221,8 +1220,7 @@ bool ScummNESFile::generateIndex() {
for (i = 0; i < (int)sizeof(lfl_index); i++)
write_byte(&out, ((byte *)&lfl_index)[i]);
- if (_stream)
- delete _stream;
+ delete _stream;
_stream = new Common::MemoryReadStream(_buf, bufsize);
diff --git a/engines/scumm/file_nes.h b/engines/scumm/file_nes.h
index 3d7fd64ebe..f1a07f8085 100644
--- a/engines/scumm/file_nes.h
+++ b/engines/scumm/file_nes.h
@@ -69,9 +69,9 @@ public:
void close();
bool eos() { return _stream->eos(); }
- uint32 pos() { return _stream->pos(); }
- uint32 size() { return _stream->size(); }
- void seek(int32 offs, int whence = SEEK_SET) { _stream->seek(offs, whence); }
+ int32 pos() { return _stream->pos(); }
+ int32 size() { return _stream->size(); }
+ bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); }
uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
};
diff --git a/engines/scumm/smush/chunk.cpp b/engines/scumm/smush/chunk.cpp
index 5e6f05b3e4..855f0a3985 100644
--- a/engines/scumm/smush/chunk.cpp
+++ b/engines/scumm/smush/chunk.cpp
@@ -45,7 +45,7 @@ bool BaseChunk::eos() const {
return _curPos >= _size;
}
-uint32 BaseChunk::pos() const {
+int32 BaseChunk::pos() const {
return _curPos;
}
@@ -53,11 +53,11 @@ Chunk::type BaseChunk::getType() const {
return _type;
}
-uint32 BaseChunk::size() const {
+int32 BaseChunk::size() const {
return _size;
}
-void BaseChunk::seek(int32 delta, int dir) {
+bool BaseChunk::seek(int32 delta, int dir) {
switch (dir) {
case SEEK_CUR:
_curPos += delta;
@@ -85,6 +85,8 @@ void BaseChunk::seek(int32 delta, int dir) {
warning("Looks like you compressed file %s in wrong way. It has FLU index which was not updated", _name.c_str());
error("invalid seek request : %d > %d (delta == %d)", _curPos, _size, delta);
}
+
+ return true;
}
FileChunk::FileChunk(BaseScummFile *data, int offset) {
diff --git a/engines/scumm/smush/chunk.h b/engines/scumm/smush/chunk.h
index ca4a3cdd99..08d7037d1c 100644
--- a/engines/scumm/smush/chunk.h
+++ b/engines/scumm/smush/chunk.h
@@ -55,10 +55,10 @@ protected:
public:
Chunk::type getType() const;
- uint32 size() const;
+ int32 size() const;
bool eos() const;
- uint32 pos() const;
- void seek(int32 delta, int dir);
+ int32 pos() const;
+ bool seek(int32 delta, int dir);
};
class FileChunk : public BaseChunk {
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index e4d8393dbe..9100d95e5d 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -315,7 +315,7 @@ void SmushPlayer::release() {
_codec47 = 0;
}
-void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, uint32 min_size) {
+void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, int32 min_size) {
if (type_expected != b.getType()) {
error("Chunk type is different from expected : %x != %x", b.getType(), type_expected);
}
diff --git a/engines/scumm/smush/smush_player.h b/engines/scumm/smush/smush_player.h
index 64ae167349..29a2397d58 100644
--- a/engines/scumm/smush/smush_player.h
+++ b/engines/scumm/smush/smush_player.h
@@ -121,7 +121,7 @@ private:
bool readString(const char *file);
void decodeFrameObject(int codec, const uint8 *src, int left, int top, int width, int height);
- void checkBlock(const Chunk &, Chunk::type, uint32 = 0);
+ void checkBlock(const Chunk &, Chunk::type, int32 = 0);
void handleAnimHeader(Chunk &);
void handleFrame(Chunk &);
void handleNewPalette(Chunk &);
diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp
index 6cb82bc0b0..27e7568fcc 100644
--- a/engines/sword1/music.cpp
+++ b/engines/sword1/music.cpp
@@ -80,7 +80,7 @@ BaseAudioStream::~BaseAudioStream() {
void BaseAudioStream::reinit(int size, int rate, byte flags) {
_isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0;
_rate = rate;
- assert((uint)size <= (_sourceStream->size() - _sourceStream->pos()));
+ assert(size <= (_sourceStream->size() - _sourceStream->pos()));
_bitsPerSample = ((flags & Audio::Mixer::FLAG_16BITS) != 0) ? 16 : 8;
_samplesLeft = (size * 8) / _bitsPerSample;
if ((_bitsPerSample != 16) && (_bitsPerSample != 8))
diff --git a/engines/sword2/sound.h b/engines/sword2/sound.h
index b89ef8f12b..684be3dacd 100644
--- a/engines/sword2/sound.h
+++ b/engines/sword2/sound.h
@@ -124,7 +124,7 @@ struct SoundFileHandle {
Common::File file;
uint32 *idxTab;
uint32 idxLen;
- uint32 fileSize;
+ int32 fileSize;
uint32 fileType;
volatile bool inUse;
};
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index e2a24dbd47..e37c80ec61 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -74,7 +74,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound
assert(id > 0 && id < _sampleIndexLen);
// get file offset for this sample
- uint32 dwSampleIndex = _sampleIndex[id];
+ int32 dwSampleIndex = _sampleIndex[id];
// move to correct position in the sample file
_sampleStream.seek(dwSampleIndex);
@@ -166,7 +166,7 @@ void SoundManager::openSampleFiles(void) {
if (_sampleIndex == NULL) {
// allocate a buffer for the indices
- _sampleIndex = (uint32 *)malloc(_sampleIndexLen);
+ _sampleIndex = (int32 *)malloc(_sampleIndexLen);
// make sure memory allocated
if (_sampleIndex == NULL) {
diff --git a/engines/tinsel/sound.h b/engines/tinsel/sound.h
index 56618eeb8e..c17995e91e 100644
--- a/engines/tinsel/sound.h
+++ b/engines/tinsel/sound.h
@@ -52,7 +52,7 @@ protected:
Audio::SoundHandle _handle;
/** Sample index buffer and number of entries */
- uint32 *_sampleIndex;
+ int32 *_sampleIndex;
/** Number of entries in the sample index */
long _sampleIndexLen;