aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-10-15 13:07:31 +0000
committerFilippos Karapetis2010-10-15 13:07:31 +0000
commite74e4814e43724eb9dc5b1cdece8958a03257135 (patch)
tree79c47188b7b1377499b3cab9df72c6723433a50d /engines
parent9717686337d7acd83ed3e46daa57e929d3e632df (diff)
downloadscummvm-rg350-e74e4814e43724eb9dc5b1cdece8958a03257135.tar.gz
scummvm-rg350-e74e4814e43724eb9dc5b1cdece8958a03257135.tar.bz2
scummvm-rg350-e74e4814e43724eb9dc5b1cdece8958a03257135.zip
SWORD1: Fixed bug #3087855 - "SWORD1: Code analysis warnings"
svn-id: r53488
Diffstat (limited to 'engines')
-rw-r--r--engines/sword1/resman.cpp11
-rw-r--r--engines/sword1/screen.cpp4
2 files changed, 9 insertions, 6 deletions
diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp
index 41f952c3f4..228cd28bb7 100644
--- a/engines/sword1/resman.cpp
+++ b/engines/sword1/resman.cpp
@@ -332,10 +332,13 @@ Common::File *ResMan::resFile(uint32 id) {
Clu *closeClu = _openCluStart;
_openCluStart = _openCluStart->nextOpen;
- closeClu->file->close();
- delete closeClu->file;
- closeClu->file = NULL;
- closeClu->nextOpen = NULL;
+ if (closeClu) {
+ if (closeClu->file)
+ closeClu->file->close();
+ delete closeClu->file;
+ closeClu->file = NULL;
+ closeClu->nextOpen = NULL;
+ }
_openClus--;
}
}
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index b07acf9a0b..9fa808d561 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -886,8 +886,8 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint
// needed because some psx backgrounds are half width and half height
uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres) {
- uint32 xresInTiles = (bakXres / 2) % 16 ? (bakXres / 32) + 1 : (bakXres / 32);
- uint32 yresInTiles = (bakYres / 2) % 16 ? (bakYres / 32) + 1 : (bakYres / 32);
+ uint32 xresInTiles = ((bakXres / 2) % 16) ? (bakXres / 32) + 1 : (bakXres / 32);
+ uint32 yresInTiles = ((bakYres / 2) % 16) ? (bakYres / 32) + 1 : (bakYres / 32);
uint32 totTiles = xresInTiles * yresInTiles;
uint32 tileYpos = 0; //tile position in a virtual xresInTiles * yresInTiles grid
uint32 tileXpos = 0;