[Scummvm-git-logs] scummvm master -> ea8be6913242e31aeb57c6bf511de1592dece3d8

dreammaster paulfgilbert at gmail.com
Mon Apr 20 19:55:57 UTC 2020


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:
ea8be69132 ULTIMA4: Fixing Coverity reported warnings


Commit: ea8be6913242e31aeb57c6bf511de1592dece3d8
    https://github.com/scummvm/scummvm/commit/ea8be6913242e31aeb57c6bf511de1592dece3d8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-04-20T12:55:06-07:00

Commit Message:
ULTIMA4: Fixing Coverity reported warnings

Changed paths:
    engines/ultima/ultima4/core/debugger_actions.cpp
    engines/ultima/ultima4/events/event.cpp
    engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp


diff --git a/engines/ultima/ultima4/core/debugger_actions.cpp b/engines/ultima/ultima4/core/debugger_actions.cpp
index 4cd6e72a6e..b59d892b65 100644
--- a/engines/ultima/ultima4/core/debugger_actions.cpp
+++ b/engines/ultima/ultima4/core/debugger_actions.cpp
@@ -358,9 +358,9 @@ bool DebuggerActions::talkAt(const Coords &coords) {
 	}
 
 	city = dynamic_cast<City *>(g_context->_location->_map);
-	Person *talker = city->personAt(coords);
+	Person *talker = city ? city->personAt(coords) : nullptr;
 
-	/* make sure we have someone we can talk with */
+	// Make sure we have someone we can talk with
 	if (!talker || !talker->canConverse())
 		return false;
 
@@ -370,7 +370,7 @@ bool DebuggerActions::talkAt(const Coords &coords) {
 		talker->getId() != PYTHON_ID)
 		return false;
 
-	/* if we're talking to Lord British and the avatar is dead, LB resurrects them! */
+	// If we're talking to Lord British and the avatar is dead, LB resurrects them!
 	if (talker->getNpcType() == NPC_LORD_BRITISH &&
 		g_context->_party->member(0)->getStatus() == STAT_DEAD) {
 		g_screen->screenMessage("%s, Thou shalt live again!\n", g_context->_party->member(0)->getName().c_str());
diff --git a/engines/ultima/ultima4/events/event.cpp b/engines/ultima/ultima4/events/event.cpp
index 51a589ac47..de6e1a5d40 100644
--- a/engines/ultima/ultima4/events/event.cpp
+++ b/engines/ultima/ultima4/events/event.cpp
@@ -260,8 +260,6 @@ void EventHandler::handleMouseButtonDownEvent(const Common::Event &event, Contro
 	if (!settings._mouseOptions._enabled)
 		return;
 
-	if (button > 2)
-		button = 0;
 	const MouseArea *area = eventHandler->mouseAreaForPoint(event.mouse.x, event.mouse.y);
 	if (!area || area->_command[button] == 0)
 		return;
diff --git a/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp b/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
index 81c81cbc3a..ffddbf1f2d 100644
--- a/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
@@ -39,12 +39,12 @@ Image *FMTOWNSImageLoader::load(Common::File *file, int width, int height, int b
 
 	ASSERT((bpp == 16) | (bpp == 4), "invalid bpp: %d", bpp);
 
-	long rawLen = file->size() - _offset;
+	int rawLen = file->size() - _offset;
 	file->seek(_offset, 0);
 	byte *raw = (byte *) malloc(rawLen);
 	file->read(raw, rawLen);
 
-	long requiredLength = (width * height * bpp / 8);
+	int requiredLength = (width * height * bpp / 8);
 	if (rawLen < requiredLength) {
 		if (raw)
 			free(raw);
@@ -108,12 +108,10 @@ Image *FMTOWNSImageLoader::load(Common::File *file, int width, int height, int b
 				int b = byte1 & high6;
 				b <<= 1;
 
-
-
-
-				image->putPixel(x, y,
-				                g, b, r,
-				                lastbit & byte1 ? IM_TRANSPARENT : IM_OPAQUE);
+				// TODO: Previously r & b were reversed. See if this proper
+				// order is correct, and if not properly swap value calculations
+				image->putPixel(x, y, r, g, b,
+					lastbit & byte1 ? IM_TRANSPARENT : IM_OPAQUE);
 			}
 		}
 	}




More information about the Scummvm-git-logs mailing list