[Scummvm-cvs-logs] scummvm master -> 61ef0392b478cf917fa9413e53a829103a245d29

clone2727 clone2727 at gmail.com
Tue Jun 16 03:14:44 CEST 2015


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cf07fb562d SHERLOCK: Use a string literal as the format string
61ef0392b4 SHERLOCK: Fix conditional with two different enumeration types


Commit: cf07fb562dd59c16ae91db5f9c991b8bb114d866
    https://github.com/scummvm/scummvm/commit/cf07fb562dd59c16ae91db5f9c991b8bb114d866
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2015-06-15T21:07:47-04:00

Commit Message:
SHERLOCK: Use a string literal as the format string

It's a gcc warning, but can lead to crashes should a string with a specifier in it be passed in and no arguments on the stack.

Changed paths:
    engines/sherlock/journal.cpp
    engines/sherlock/objects.cpp
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/user_interface.cpp



diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index ebd642f..98ac320 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -608,8 +608,8 @@ void Journal::drawJournalFrame() {
 
 	// Set the palette and print the title
 	screen.setPalette(palette);
-	screen.gPrint(Common::Point(111, 18), BUTTON_BOTTOM, fixedText_WatsonsJournal.c_str());
-	screen.gPrint(Common::Point(110, 17), INV_FOREGROUND, fixedText_WatsonsJournal.c_str());
+	screen.gPrint(Common::Point(111, 18), BUTTON_BOTTOM, "%s", fixedText_WatsonsJournal.c_str());
+	screen.gPrint(Common::Point(110, 17), INV_FOREGROUND, "%s", fixedText_WatsonsJournal.c_str());
 
 	// Draw the buttons
 	screen.makeButton(Common::Rect(JOURNAL_POINTS[0][0], JOURNAL_BUTTONS_Y,
@@ -1200,7 +1200,7 @@ int Journal::getSearchString(bool printError) {
 
 	if (printError) {
 		screen.gPrint(Common::Point((SHERLOCK_SCREEN_WIDTH - screen.stringWidth(fixedText_NotFound)) / 2, 185),
-			INV_FOREGROUND, fixedText_NotFound.c_str());
+			INV_FOREGROUND, "%s", fixedText_NotFound.c_str());
 	} else if (!_find.empty()) {
 		// There's already a search term, display it already
 		screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, "%s", _find.c_str());
@@ -1255,7 +1255,7 @@ int Journal::getSearchString(bool printError) {
 				} else {
 					color = COMMAND_FOREGROUND;
 				}
-				screen.print(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, 175), color, fixedText_Exit.c_str());
+				screen.print(Common::Point(SEARCH_POINTS[0][2] - screen.stringWidth(fixedText_Exit) / 2, 175), color, "%s", fixedText_Exit.c_str());
 
 				if (pt.x > SEARCH_POINTS[1][0] && pt.x < SEARCH_POINTS[1][1] && pt.y > 174 && pt.y < 183) {
 					found = BTN_BACKWARD;
@@ -1263,7 +1263,7 @@ int Journal::getSearchString(bool printError) {
 				} else {
 					color = COMMAND_FOREGROUND;
 				}
-				screen.print(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, 175), color, fixedText_Backward.c_str());
+				screen.print(Common::Point(SEARCH_POINTS[1][2] - screen.stringWidth(fixedText_Backward) / 2, 175), color, "%s", fixedText_Backward.c_str());
 
 				if (pt.x > SEARCH_POINTS[2][0] && pt.x < SEARCH_POINTS[2][1] && pt.y > 174 && pt.y < 183) {
 					found = BTN_FORWARD;
@@ -1271,7 +1271,7 @@ int Journal::getSearchString(bool printError) {
 				} else {
 					color = COMMAND_FOREGROUND;
 				}
-				screen.print(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, 175), color, fixedText_Forward.c_str());
+				screen.print(Common::Point(SEARCH_POINTS[2][2] - screen.stringWidth(fixedText_Forward) / 2, 175), color, "%s", fixedText_Forward.c_str());
 			}
 
 			events.wait(2);
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 1c74f62..6113571 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -541,7 +541,7 @@ int BaseObject::checkNameForCodes(const Common::String &name, FixedTextActionId
 		ui._infoFlag = true;
 		ui.clearInfo();
 		Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, messageNum);
-		screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, errorMessage.c_str());
+		screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str());
 		ui._menuCounter = 25;
 	} else if (name.hasPrefix("@")) {
 		// Message attached to canimation
@@ -1316,7 +1316,7 @@ int Object::pickUpObject(FixedTextActionId fixedTextActionId) {
 		ui._infoFlag = true;
 		ui.clearInfo();
 		Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, message);
-		screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, errorMessage.c_str());
+		screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str());
 		ui._menuCounter = 30;
 	} else {
 		// Pick it up
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index fb8ebe1..14461cf 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -2147,7 +2147,7 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri
 			screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "You can't do that.");
 		} else {
 			Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, 0);
-			screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, errorMessage.c_str());
+			screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str());
 		}
 
 		_infoFlag = true;
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index af79b34..9e7d0df 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -72,7 +72,7 @@ void UserInterface::checkAction(ActionType &action, int objNum, FixedTextActionI
 		_infoFlag = true;
 		clearInfo();
 		Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, action._cAnimNum);
-		screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, errorMessage.c_str());
+		screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str());
 		_infoFlag = true;
 
 		// Set how long to show the message


Commit: 61ef0392b478cf917fa9413e53a829103a245d29
    https://github.com/scummvm/scummvm/commit/61ef0392b478cf917fa9413e53a829103a245d29
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2015-06-15T21:13:11-04:00

Commit Message:
SHERLOCK: Fix conditional with two different enumeration types

Changed paths:
    engines/sherlock/tattoo/widget_verbs.cpp



diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp
index fead526..a72d05f 100644
--- a/engines/sherlock/tattoo/widget_verbs.cpp
+++ b/engines/sherlock/tattoo/widget_verbs.cpp
@@ -60,7 +60,7 @@ void WidgetVerbs::highlightVerbControls() {
 	if (_selector != _oldSelector) {
 		// Redraw the verb list
 		for (int idx = 0; idx < (int)_verbCommands.size(); ++idx) {
-			byte color = (idx == _selector) ? COMMAND_HIGHLIGHTED : INFO_TOP;
+			byte color = (idx == _selector) ? (byte)COMMAND_HIGHLIGHTED : (byte)INFO_TOP;
 			_surface.writeString(_verbCommands[idx], Common::Point((_bounds.width() - screen.stringWidth(_verbCommands[idx])) / 2,
 				(screen.fontHeight() + 7) * idx + 5), color);
 		}






More information about the Scummvm-git-logs mailing list