aboutsummaryrefslogtreecommitdiff
path: root/graphics/video
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/video')
-rw-r--r--graphics/video/coktelvideo/coktelvideo.cpp14
-rw-r--r--graphics/video/mpeg_player.cpp5
2 files changed, 9 insertions, 10 deletions
diff --git a/graphics/video/coktelvideo/coktelvideo.cpp b/graphics/video/coktelvideo/coktelvideo.cpp
index d18e727a35..c88c5beee2 100644
--- a/graphics/video/coktelvideo/coktelvideo.cpp
+++ b/graphics/video/coktelvideo/coktelvideo.cpp
@@ -1820,16 +1820,18 @@ Common::MemoryReadStream *Vmd::getExtraData(const char *fileName) {
return 0;
}
- byte *data = (byte *) malloc(_extraData[i].realSize);
-
- _stream->seek(_extraData[i].offset);
- if (_stream->ioFailed() || (((uint32) _stream->pos()) != _extraData[i].offset)) {
- warning("Vmd::getExtraData(): Can't seek to offset %d to get extra data file \"%s\"",
+ if (!_stream->seek(_extraData[i].offset)) {
+ warning("Vmd::getExtraData(): Can't seek to offset %d to (file \"%s\")",
_extraData[i].offset, fileName);
return 0;
}
- _stream->read(data, _extraData[i].realSize);
+ byte *data = (byte *) malloc(_extraData[i].realSize);
+ if (_stream->read(data, _extraData[i].realSize) != _extraData[i].realSize) {
+ free(data);
+ warning("Vmd::getExtraData(): Couldn't read %d bytes (file \"%s\")",
+ _extraData[i].realSize, fileName);
+ }
Common::MemoryReadStream *stream =
new Common::MemoryReadStream(data, _extraData[i].realSize, true);
diff --git a/graphics/video/mpeg_player.cpp b/graphics/video/mpeg_player.cpp
index 1910babce4..5b7b3eb607 100644
--- a/graphics/video/mpeg_player.cpp
+++ b/graphics/video/mpeg_player.cpp
@@ -86,13 +86,10 @@ bool BaseAnimationState::init(const char *name) {
}
p = 0;
- while (1) {
+ while (!f.eos()) {
_palettes[p].end = f.readUint16LE();
_palettes[p].cnt = f.readUint16LE();
- if (f.ioFailed())
- break;
-
for (i = 0; i < _palettes[p].cnt; i++) {
_palettes[p].pal[4 * i] = f.readByte();
_palettes[p].pal[4 * i + 1] = f.readByte();