[Scummvm-cvs-logs] scummvm master -> f9cf18b95f1065449307cfb13d82eeeef77727e8

digitall dgturner at iee.org
Mon Sep 30 05:27:08 CEST 2013


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:
f9cf18b95f COMPOSER: Fix uninitialized class variables and divide by zero bugs.


Commit: f9cf18b95f1065449307cfb13d82eeeef77727e8
    https://github.com/scummvm/scummvm/commit/f9cf18b95f1065449307cfb13d82eeeef77727e8
Author: D G Turner (digitall at scummvm.org)
Date: 2013-09-29T20:27:42-07:00

Commit Message:
COMPOSER: Fix uninitialized class variables and divide by zero bugs.

This was highlighted by Coverity in CID 1003844 and 1003410.

Changed paths:
    engines/composer/composer.cpp



diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 5db778d..2d7075c 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -48,6 +48,15 @@ namespace Composer {
 ComposerEngine::ComposerEngine(OSystem *syst, const ComposerGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
 	_rnd = new Common::RandomSource("composer");
 	_audioStream = NULL;
+	_currSoundPriority = 0;
+	_currentTime = 0;
+	_lastTime = 0;
+	_needsUpdate = true;
+	_directoriesToStrip = 1;
+	_mouseVisible = true;
+	_mouseEnabled = false;
+	_mouseSpriteId = 0;
+	_lastButton = NULL;
 }
 
 ComposerEngine::~ComposerEngine() {
@@ -79,12 +88,6 @@ Common::Error ComposerEngine::run() {
 		_queuedScripts[i]._scriptId = 0;
 	}
 
-	_mouseVisible = true;
-	_mouseEnabled = false;
-	_mouseSpriteId = 0;
-	_lastButton = NULL;
-
-	_directoriesToStrip = 1;
 	if (!_bookIni.loadFromFile("book.ini")) {
 		_directoriesToStrip = 0;
 		if (!_bookIni.loadFromFile("programs/book.ini")) {
@@ -103,7 +106,6 @@ Common::Error ComposerEngine::run() {
 		height = atoi(getStringFromConfig("Common", "Height").c_str());
 	initGraphics(width, height, true);
 	_screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-	_needsUpdate = true;
 
 	Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
 	CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(),
@@ -113,11 +115,12 @@ Common::Error ComposerEngine::run() {
 
 	loadLibrary(0);
 
-	_currentTime = 0;
-	_lastTime = 0;
-
 	uint fps = atoi(getStringFromConfig("Common", "FPS").c_str());
-	uint frameTime = 1000 / fps;
+	uint frameTime = 125; // Default to 125ms (1000/8)
+	if (fps != 0)
+		frameTime = 1000 / fps;
+	else
+		warning("FPS in book.ini is zero. Defaulting to 8...");
 	uint32 lastDrawTime = 0;
 
 	while (!shouldQuit()) {






More information about the Scummvm-git-logs mailing list