diff options
Diffstat (limited to 'graphics/video/coktelvideo')
-rw-r--r-- | graphics/video/coktelvideo/coktelvideo.cpp | 14 |
1 files changed, 8 insertions, 6 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); |