From 0c018bf3923a142d239e97f482165c3e0daed90e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Nov 2010 00:19:28 +0000 Subject: SWORD25: cleanup svn-id: r54045 --- engines/sword25/fmv/theora_decoder.cpp | 10 ++++++---- engines/sword25/gfx/graphicengine.cpp | 3 ++- engines/sword25/gfx/image/renderedimage.cpp | 3 ++- engines/sword25/gfx/image/swimage.cpp | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'engines/sword25') diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index d211136614..d6c2544fe5 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -244,10 +244,12 @@ bool TheoraDecoder::load(Common::SeekableReadStream *stream) { if (_theoraComment.user_comments[i]) { int len = _theoraComment.comment_lengths[i]; char *value = (char *)malloc(len + 1); - memcpy(value, _theoraComment.user_comments[i], len); - value[len] = '\0'; - debug(1, "\t%s", value); - free(value); + if (value) { + memcpy(value, _theoraComment.user_comments[i], len); + value[len] = '\0'; + debug(1, "\t%s", value); + free(value); + } } } } diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index f629993abf..44b9932de1 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -309,7 +309,8 @@ Resource *GraphicEngine::loadResource(const Common::String &filename) { // Datei laden byte *pFileData; uint fileSize; - if (!(pFileData = static_cast(pPackage->getFile(filename, &fileSize)))) { + pFileData = pPackage->getFile(filename, &fileSize); + if (!pFileData) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", filename.c_str()); return 0; } diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index 9392eca044..fb82f893c6 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -64,7 +64,8 @@ RenderedImage::RenderedImage(const Common::String &filename, bool &result) : // Datei laden byte *pFileData; uint fileSize; - if (!(pFileData = (byte *)pPackage->getFile(filename, &fileSize))) { + pFileData = pPackage->getFile(filename, &fileSize); + if (!pFileData) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", filename.c_str()); return; } diff --git a/engines/sword25/gfx/image/swimage.cpp b/engines/sword25/gfx/image/swimage.cpp index f0a8899bb6..84aa35b0f4 100644 --- a/engines/sword25/gfx/image/swimage.cpp +++ b/engines/sword25/gfx/image/swimage.cpp @@ -53,7 +53,8 @@ SWImage::SWImage(const Common::String &filename, bool &result) : // Datei laden byte *pFileData; uint fileSize; - if (!(pFileData = (byte *)pPackage->getFile(filename, &fileSize))) { + pFileData = pPackage->getFile(filename, &fileSize); + if (!pFileData) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", filename.c_str()); return; } -- cgit v1.2.3