aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp10
-rw-r--r--engines/sword25/gfx/graphicengine.cpp3
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp3
-rw-r--r--engines/sword25/gfx/image/swimage.cpp3
4 files changed, 12 insertions, 7 deletions
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<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 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;
}