[Scummvm-git-logs] scummvm master -> 502a0df328f7299a187dfe00ce1df2dc33d2a2a1
AndywinXp
noreply at scummvm.org
Mon Apr 29 21:14:56 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
502a0df328 SCUMM: HE: Another attempt at fixing Coverity #1544404
Commit: 502a0df328f7299a187dfe00ce1df2dc33d2a2a1
https://github.com/scummvm/scummvm/commit/502a0df328f7299a187dfe00ce1df2dc33d2a2a1
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-04-29T23:14:50+02:00
Commit Message:
SCUMM: HE: Another attempt at fixing Coverity #1544404
This time without returning pointers for local variables within another function...
Changed paths:
engines/scumm/he/sprite_he.cpp
engines/scumm/he/sprite_he.h
engines/scumm/he/wiz_he.h
diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp
index fa1c6efc48d..7a5fec2ea3a 100644
--- a/engines/scumm/he/sprite_he.cpp
+++ b/engines/scumm/he/sprite_he.cpp
@@ -1671,21 +1671,6 @@ void Sprite::buildActiveSpriteList() {
}
}
-WizSimpleBitmap *Sprite::getSimpleBitmapForSprite(const SpriteInfo *spritePtr) {
- WizSimpleBitmap simpleBitmap;
- int image = spritePtr->image;
- int group = spritePtr->group;
- int groupImage = _groupTable[group].image;
-
- if (image != 0 && group != 0 && groupImage != 0) {
- if (_vm->_wiz->dwSetSimpleBitmapStructFromImage(groupImage, 0, &simpleBitmap)) {
- return &simpleBitmap;
- }
- }
-
- return nullptr;
-}
-
void Sprite::renderSprites(bool negativeOrPositiveRender) {
int image, group, shadow, state, angle;
int sourceImage, scale, destImageNumber;
@@ -1952,9 +1937,17 @@ void Sprite::renderSprites(bool negativeOrPositiveRender) {
}
WizSimpleBitmap *bitmapPtr = nullptr;
+ WizSimpleBitmap simpleBitmap;
if (_vm->_game.heversion >= 95) {
- bitmapPtr = getSimpleBitmapForSprite(spritePtr[i]);
+ // This was originally an inlined function, getSimpleBitmapForSprite().
+ // I got fed up with the fact it returned the address of a local WizSimpleBitmap variable,
+ // and it was used here and only here, so I decided to get rid of it and just unroll it...
+ if (spritePtr[i]->image != 0 && spritePtr[i]->group != 0 && _groupTable[group].image != 0) {
+ if (_vm->_wiz->dwSetSimpleBitmapStructFromImage(_groupTable[group].image, 0, &simpleBitmap)) {
+ bitmapPtr = &simpleBitmap;
+ }
+ }
}
if (simpleDraw) {
diff --git a/engines/scumm/he/sprite_he.h b/engines/scumm/he/sprite_he.h
index e8983ebfab9..d09d39b934a 100644
--- a/engines/scumm/he/sprite_he.h
+++ b/engines/scumm/he/sprite_he.h
@@ -237,7 +237,6 @@ public:
bool doesRectIntersectUpdateAreas(const Common::Rect *rectPtr);
void checkForForcedRedraws(bool checkOnlyPositivePriority);
void buildActiveSpriteList();
- WizSimpleBitmap *getSimpleBitmapForSprite(const SpriteInfo *spritePtr);
void renderSprites(bool negativeOrPositiveRender);
void runSpriteEngines();
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index 44778265588..6cf501682b6 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -268,6 +268,10 @@ struct WizSimpleBitmap {
WizRawPixel *bufferPtr;
int32 bitmapWidth;
int32 bitmapHeight;
+
+ WizSimpleBitmap() {
+
+ }
};
struct WizMultiTypeBitmap {
More information about the Scummvm-git-logs
mailing list