aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-05-20 08:28:12 -0400
committerPaul Gilbert2015-05-20 08:28:12 -0400
commit30133cef0e2a840325c1b46b106628c3cccd7d04 (patch)
tree33f2fb95e81abc5e7624fc7d0d0ae9ae51b9ed43 /engines/sherlock
parentfe8139b57168bbb85eb1d4bb0d2c62219ee6383d (diff)
downloadscummvm-rg350-30133cef0e2a840325c1b46b106628c3cccd7d04.tar.gz
scummvm-rg350-30133cef0e2a840325c1b46b106628c3cccd7d04.tar.bz2
scummvm-rg350-30133cef0e2a840325c1b46b106628c3cccd7d04.zip
SHERLOCK: Re-add GCC_PRINTF and fix resulting GCC warnings
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/journal.cpp20
-rw-r--r--engines/sherlock/map.cpp6
-rw-r--r--engines/sherlock/objects.cpp6
-rw-r--r--engines/sherlock/scalpel/darts.cpp4
-rw-r--r--engines/sherlock/screen.cpp8
-rw-r--r--engines/sherlock/screen.h4
-rw-r--r--engines/sherlock/talk.cpp26
-rw-r--r--engines/sherlock/user_interface.cpp22
8 files changed, 48 insertions, 48 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index ba6a809b44..5a8338bdc8 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -732,26 +732,26 @@ bool Journal::drawJournal(int direction, int howFar) {
screen.gPrint(Common::Point(53, yp), 15, "%s", lineStart.c_str() + 1);
} else {
width = screen.stringWidth(lineStart.c_str());
- screen.gPrint(Common::Point(53, yp), PEN_COLOR, lineStart.c_str());
- }
+ screen.gPrint(Common::Point(53, yp), PEN_COLOR, "%s", lineStart.c_str());
+ }
// Print out the found keyword
Common::String lineMatch(matchP, matchP + _find.size());
- screen.gPrint(Common::Point(53 + width, yp), INV_FOREGROUND, lineMatch.c_str());
+ screen.gPrint(Common::Point(53 + width, yp), INV_FOREGROUND, "%s", lineMatch.c_str());
width += screen.stringWidth(lineMatch.c_str());
// Print remainder of line
- screen.gPrint(Common::Point(53 + width, yp), PEN_COLOR, matchP + _find.size());
+ screen.gPrint(Common::Point(53 + width, yp), PEN_COLOR, "%s", matchP + _find.size());
} else if (_lines[temp].hasPrefix("@")) {
- screen.gPrint(Common::Point(53, yp), 15, _lines[temp].c_str() + 1);
+ screen.gPrint(Common::Point(53, yp), 15, "%s", _lines[temp].c_str() + 1);
} else {
- screen.gPrint(Common::Point(53, yp), PEN_COLOR, _lines[temp].c_str());
+ screen.gPrint(Common::Point(53, yp), PEN_COLOR, "%s", _lines[temp].c_str());
}
} else {
if (_lines[temp].hasPrefix("@")) {
- screen.gPrint(Common::Point(53, yp), 15, _lines[temp].c_str() + 1);
+ screen.gPrint(Common::Point(53, yp), 15, "%s", _lines[temp].c_str() + 1);
} else {
- screen.gPrint(Common::Point(53, yp), PEN_COLOR, _lines[temp].c_str());
+ screen.gPrint(Common::Point(53, yp), PEN_COLOR, "%s", _lines[temp].c_str());
}
}
@@ -1033,7 +1033,7 @@ int Journal::getSearchString(bool printError) {
INV_FOREGROUND, "Text Not Found !");
} else if (!_find.empty()) {
// There's already a search term, display it already
- screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, _find.c_str());
+ screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, "%s", _find.c_str());
name = _find;
}
@@ -1051,7 +1051,7 @@ int Journal::getSearchString(bool printError) {
screen.fillRect(Common::Rect(13, 186, 306, 195), BUTTON_MIDDLE);
if (!_find.empty()) {
- screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, _find.c_str());
+ screen.gPrint(Common::Point(15, 185), TALK_FOREGROUND, "%s", _find.c_str());
name = _find;
}
diff --git a/engines/sherlock/map.cpp b/engines/sherlock/map.cpp
index ed2912edc9..96442893ef 100644
--- a/engines/sherlock/map.cpp
+++ b/engines/sherlock/map.cpp
@@ -349,9 +349,9 @@ void Map::showPlaceName(int idx, bool highlighted) {
if (highlighted) {
int xp = (SHERLOCK_SCREEN_WIDTH - screen.stringWidth(name)) / 2;
- screen.gPrint(Common::Point(xp + 2, 2), 0, name.c_str());
- screen.gPrint(Common::Point(xp + 1, 1), 0, name.c_str());
- screen.gPrint(Common::Point(xp, 0), 12, name.c_str());
+ screen.gPrint(Common::Point(xp + 2, 2), 0, "%s", name.c_str());
+ screen.gPrint(Common::Point(xp + 1, 1), 0, "%s", name.c_str());
+ screen.gPrint(Common::Point(xp, 0), 12, "%s", name.c_str());
screen.slamArea(xp, 0, width + 2, 15);
}
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 94457b3dd5..02f2526ae9 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -865,13 +865,13 @@ int Object::checkNameForCodes(const Common::String &name, const char *const mess
int messageNum = atoi(name.c_str() + 1);
ui._infoFlag = true;
ui.clearInfo();
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, messages[messageNum]);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", messages[messageNum]);
ui._menuCounter = 25;
} else if (name.hasPrefix("@")) {
// Message attached to canimation
ui._infoFlag = true;
ui.clearInfo();
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, name.c_str() + 1);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", name.c_str() + 1);
printed = true;
ui._menuCounter = 25;
}
@@ -955,7 +955,7 @@ int Object::pickUpObject(const char *const messages[]) {
ui._infoFlag = true;
ui.clearInfo();
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, messages[message]);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", messages[message]);
ui._menuCounter = 30;
} else {
// Pick it up
diff --git a/engines/sherlock/scalpel/darts.cpp b/engines/sherlock/scalpel/darts.cpp
index 96d272fed0..de93621e2f 100644
--- a/engines/sherlock/scalpel/darts.cpp
+++ b/engines/sherlock/scalpel/darts.cpp
@@ -235,10 +235,10 @@ void Darts::showNames(int playerNum) {
if (playerNum != 0)
screen.print(Common::Point(STATUS_INFO_X + 50, STATUS_INFO_Y), PLAYER_COLOR + 3,
- _opponent.c_str());
+ "%s", _opponent.c_str());
else
screen.print(Common::Point(STATUS_INFO_X + 50, STATUS_INFO_Y), color,
- _opponent.c_str());
+ "%s", _opponent.c_str());
screen._backBuffer1.fillRect(Common::Rect(STATUS_INFO_X + 50, STATUS_INFO_Y + 10,
STATUS_INFO_X + 81, STATUS_INFO_Y + 12), color);
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 1d3c0e0dbf..e70d0614d1 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -369,16 +369,16 @@ void Screen::buttonPrint(const Common::Point &pt, byte color, bool slamIt,
if (slamIt) {
print(Common::Point(xStart, pt.y + 1), COMMAND_HIGHLIGHTED, "%c", str[0]);
print(Common::Point(xStart + charWidth(str[0]), pt.y + 1),
- COMMAND_FOREGROUND, str.c_str() + 1);
+ COMMAND_FOREGROUND, "%s", str.c_str() + 1);
} else {
gPrint(Common::Point(xStart, pt.y), COMMAND_HIGHLIGHTED, "%c", str[0]);
gPrint(Common::Point(xStart + charWidth(str[0]), pt.y),
- COMMAND_FOREGROUND, str.c_str() + 1);
+ COMMAND_FOREGROUND, "%s", str.c_str() + 1);
}
} else if (slamIt) {
- print(Common::Point(xStart, pt.y + 1), color, str.c_str());
+ print(Common::Point(xStart, pt.y + 1), color, "%s", str.c_str());
} else {
- gPrint(Common::Point(xStart, pt.y), color, str.c_str());
+ gPrint(Common::Point(xStart, pt.y), color, "%s", str.c_str());
}
}
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index ee9e800cdc..a2c0aa3c84 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -145,12 +145,12 @@ public:
* Prints the text passed onto the back buffer at the given position and color.
* The string is then blitted to the screen
*/
- void print(const Common::Point &pt, byte color, const char *formatStr, ...);
+ void print(const Common::Point &pt, byte color, const char *formatStr, ...) GCC_PRINTF(4, 5);
/**
* Print a strings onto the back buffer without blitting it to the screen
*/
- void gPrint(const Common::Point &pt, byte color, const char *formatStr, ...);
+ void gPrint(const Common::Point &pt, byte color, const char *formatStr, ...) GCC_PRINTF(4, 5);
/**
* Copies a section of the second back buffer into the main back buffer
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index 47b9f6f277..bd4e8c2e78 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -772,23 +772,23 @@ int Talk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool slamIt
// Are we drawing the first line?
if (lineStartP == msg.c_str()) {
// We are, so print the number and then the text
- screen.print(Common::Point(16, lineY), color, number.c_str());
+ screen.print(Common::Point(16, lineY), color, "%s", number.c_str());
}
// Draw the line with an indent
- screen.print(Common::Point(30, lineY), color, sLine.c_str());
+ screen.print(Common::Point(30, lineY), color, "%s", sLine.c_str());
} else {
- screen.print(Common::Point(16, lineY), color, sLine.c_str());
+ screen.print(Common::Point(16, lineY), color, "%s", sLine.c_str());
}
} else {
if (numberFlag) {
if (lineStartP == msg.c_str()) {
- screen.gPrint(Common::Point(16, lineY - 1), color, number.c_str());
+ screen.gPrint(Common::Point(16, lineY - 1), color, "%s", number.c_str());
}
- screen.gPrint(Common::Point(30, lineY - 1), color, sLine.c_str());
+ screen.gPrint(Common::Point(30, lineY - 1), color, "%s", sLine.c_str());
} else {
- screen.gPrint(Common::Point(16, lineY - 1), color, sLine.c_str());
+ screen.gPrint(Common::Point(16, lineY - 1), color, "%s", sLine.c_str());
}
}
@@ -1367,7 +1367,7 @@ void Talk::doScript(const Common::String &script) {
tempString += str[idx + 1];
str += str[0];
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, tempString.c_str());
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", tempString.c_str());
ui._menuCounter = 30;
break;
@@ -1426,9 +1426,9 @@ void Talk::doScript(const Common::String &script) {
// If the window is open, display the name directly on-screen.
// Otherwise, simply draw it on the back buffer
if (ui._windowOpen) {
- screen.print(Common::Point(16, yp), TALK_FOREGROUND, NAMES[_speaker & 127]);
+ screen.print(Common::Point(16, yp), TALK_FOREGROUND, "%s", NAMES[_speaker & 127]);
} else {
- screen.gPrint(Common::Point(16, yp - 1), TALK_FOREGROUND, NAMES[_speaker & 127]);
+ screen.gPrint(Common::Point(16, yp - 1), TALK_FOREGROUND, "%s", NAMES[_speaker & 127]);
openTalkWindow = true;
}
@@ -1466,16 +1466,16 @@ void Talk::doScript(const Common::String &script) {
// If the speaker indicates a description file, print it in yellow
if (_speaker != -1) {
if (ui._windowOpen) {
- screen.print(Common::Point(16, yp), COMMAND_FOREGROUND, lineStr.c_str());
+ screen.print(Common::Point(16, yp), COMMAND_FOREGROUND, "%s", lineStr.c_str());
} else {
- screen.gPrint(Common::Point(16, yp - 1), COMMAND_FOREGROUND, lineStr.c_str());
+ screen.gPrint(Common::Point(16, yp - 1), COMMAND_FOREGROUND, "%s", lineStr.c_str());
openTalkWindow = true;
}
} else {
if (ui._windowOpen) {
- screen.print(Common::Point(16, yp), COMMAND_FOREGROUND, lineStr.c_str());
+ screen.print(Common::Point(16, yp), COMMAND_FOREGROUND, "%s", lineStr.c_str());
} else {
- screen.gPrint(Common::Point(16, yp - 1), COMMAND_FOREGROUND, lineStr.c_str());
+ screen.gPrint(Common::Point(16, yp - 1), COMMAND_FOREGROUND, "%s", lineStr.c_str());
openTalkWindow = true;
}
}
diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp
index ed6558c6dd..940fcbca03 100644
--- a/engines/sherlock/user_interface.cpp
+++ b/engines/sherlock/user_interface.cpp
@@ -230,7 +230,7 @@ void UserInterface::handleInput() {
if (_help != -1 && !scene._bgShapes[_bgFound]._description.empty()
&& scene._bgShapes[_bgFound]._description[0] != ' ')
screen.print(Common::Point(0, INFO_LINE + 1),
- INFO_FOREGROUND, scene._bgShapes[_bgFound]._description.c_str());
+ INFO_FOREGROUND, "%s", scene._bgShapes[_bgFound]._description.c_str());
_oldBgFound = _bgFound;
}
@@ -603,14 +603,14 @@ void UserInterface::lookScreen(const Common::Point &pt) {
if (_selector != -1) {
screen.print(Common::Point(xStart + width, INFO_LINE + 1),
- TALK_FOREGROUND, inv[_selector]._name.c_str());
+ TALK_FOREGROUND, "%s", inv[_selector]._name.c_str());
screen.print(Common::Point(xStart + width + width1, INFO_LINE + 1),
INFO_FOREGROUND, " on ");
screen.print(Common::Point(xStart + width + width1 + width2, INFO_LINE + 1),
- INFO_FOREGROUND, tempStr.c_str());
+ INFO_FOREGROUND, "%s", tempStr.c_str());
} else {
screen.print(Common::Point(xStart + width, INFO_LINE + 1),
- INFO_FOREGROUND, tempStr.c_str());
+ INFO_FOREGROUND, "%s", tempStr.c_str());
}
} else if (temp >= 0 && temp < 1000 && _selector != -1 &&
scene._bgShapes[temp]._aType == PERSON) {
@@ -632,14 +632,14 @@ void UserInterface::lookScreen(const Common::Point &pt) {
screen.print(Common::Point(xStart, INFO_LINE + 1),
INFO_FOREGROUND, "Give ");
screen.print(Common::Point(xStart + width, INFO_LINE + 1),
- TALK_FOREGROUND, inv[_selector]._name.c_str());
+ TALK_FOREGROUND, "%s", inv[_selector]._name.c_str());
screen.print(Common::Point(xStart + width + width1, INFO_LINE + 1),
INFO_FOREGROUND, " to ");
screen.print(Common::Point(xStart + width + width1 + width2, INFO_LINE + 1),
- INFO_FOREGROUND, tempStr.c_str());
+ INFO_FOREGROUND, "%s", tempStr.c_str());
}
} else {
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, tempStr.c_str());
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", tempStr.c_str());
}
_infoFlag = true;
@@ -664,7 +664,7 @@ void UserInterface::lookInv() {
if (temp < inv._holdings) {
clearInfo();
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND,
- inv[temp]._description.c_str());
+ "%s", inv[temp]._description.c_str());
_infoFlag = true;
_oldLook = temp;
}
@@ -1896,7 +1896,7 @@ void UserInterface::printObjectDesc(const Common::String &str, bool firstTime) {
// Print out the line
Common::String line(lineStartP, msgP);
screen.gPrint(Common::Point(16, CONTROLS_Y + 12 + lineNum * 9),
- INV_FOREGROUND, line.c_str());
+ INV_FOREGROUND, "%s", line.c_str());
if (!endOfStr)
// Start next line at start of the nxet word after space
@@ -2148,7 +2148,7 @@ void UserInterface::checkUseAction(const UseType *use, const Common::String &inv
} else if (messages == nullptr) {
screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "You can't do that.");
} else {
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, messages[0]);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", messages[0]);
}
_infoFlag = true;
@@ -2174,7 +2174,7 @@ void UserInterface::checkAction(ActionType &action, const char *const messages[]
// Invalid action, to print error message
_infoFlag = true;
clearInfo();
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, messages[action._cAnimNum]);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", messages[action._cAnimNum]);
_infoFlag = true;
// Set how long to show the message