aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2015-06-15 21:07:47 -0400
committerMatthew Hoops2015-06-15 21:07:47 -0400
commitcf07fb562dd59c16ae91db5f9c991b8bb114d866 (patch)
tree2d69eee05d567cf0523e139cbb941494b6893451
parente5f00747edd143512c48f5ac48f68841cb280ee9 (diff)
downloadscummvm-rg350-cf07fb562dd59c16ae91db5f9c991b8bb114d866.tar.gz
scummvm-rg350-cf07fb562dd59c16ae91db5f9c991b8bb114d866.tar.bz2
scummvm-rg350-cf07fb562dd59c16ae91db5f9c991b8bb114d866.zip
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.
-rw-r--r--engines/sherlock/journal.cpp12
-rw-r--r--engines/sherlock/objects.cpp4
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.cpp2
-rw-r--r--engines/sherlock/user_interface.cpp2
4 files changed, 10 insertions, 10 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index ebd642f5d8..98ac320108 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 1c74f62d5d..6113571501 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 fb8ebe18a1..14461cffab 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 af79b34561..9e7d0df7c6 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