From fde06e342db4931c229cb493f43738a8a7c67e69 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 14 Feb 2016 12:45:40 +0100 Subject: SHERLOCK: Safer print() --- .../sherlock/scalpel/scalpel_user_interface.cpp | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'engines/sherlock') diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index 13c4f6852b..7ac8d0d5cf 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -501,7 +501,7 @@ void ScalpelUserInterface::toggleButton(uint16 num) { void ScalpelUserInterface::clearInfo() { if (_infoFlag) { - _vm->_screen->vgaBar(Common::Rect(IS_3DO ? 33 : 16, INFO_LINE, + _vm->_screen->vgaBar(Common::Rect(IS_3DO ? 33 : 16, INFO_LINE, SHERLOCK_SCREEN_WIDTH - (IS_3DO ? 33 : 19), INFO_LINE + 10), INFO_BLACK); _infoFlag = false; _oldLook = -1; @@ -654,16 +654,16 @@ void ScalpelUserInterface::lookScreen(const Common::Point &pt) { int xStart = (SHERLOCK_SCREEN_WIDTH - x) / 2; screen.print(Common::Point(xStart, INFO_LINE + 1), - INFO_FOREGROUND, useText1.c_str()); + INFO_FOREGROUND, "%s", useText1.c_str()); if (_selector != -1) { screen.print(Common::Point(xStart + width1, INFO_LINE + 1), - TALK_FOREGROUND, useText2.c_str()); + TALK_FOREGROUND, "%s", useText2.c_str()); screen.print(Common::Point(xStart + width1 + width2, INFO_LINE + 1), - INFO_FOREGROUND, useText3.c_str()); + INFO_FOREGROUND, "%s", useText3.c_str()); } else { screen.print(Common::Point(xStart + width1, INFO_LINE + 1), - INFO_FOREGROUND, useText3.c_str()); + INFO_FOREGROUND, "%s", useText3.c_str()); } } else if (temp >= 0 && temp < 1000 && _selector != -1 && scene._bgShapes[temp]._aType == PERSON) { @@ -686,11 +686,11 @@ void ScalpelUserInterface::lookScreen(const Common::Point &pt) { int xStart = (SHERLOCK_SCREEN_WIDTH - x) / 2; screen.print(Common::Point(xStart, INFO_LINE + 1), - INFO_FOREGROUND, giveText1.c_str()); + INFO_FOREGROUND, "%s", giveText1.c_str()); screen.print(Common::Point(xStart + width1, INFO_LINE + 1), - TALK_FOREGROUND, giveText2.c_str()); + TALK_FOREGROUND, "%s", giveText2.c_str()); screen.print(Common::Point(xStart + width1 + width2, INFO_LINE + 1), - INFO_FOREGROUND, giveText3.c_str()); + INFO_FOREGROUND, "%s", giveText3.c_str()); } } else { screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", tempStr.c_str()); @@ -927,7 +927,7 @@ void ScalpelUserInterface::doEnvControl() { } while (saves._savegameIndex < (MAX_SAVEGAME_SLOTS - ONSCREEN_FILES_COUNT) && moreKeys); } else if ((found == 5 && events._released) || _key == saves._hotkeyQuit) { clearWindow(); - screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, saves._fixedTextQuitGameQuestion.c_str()); + screen.print(Common::Point(0, CONTROLS_Y + 20), INV_FOREGROUND, "%s", saves._fixedTextQuitGameQuestion.c_str()); screen.vgaBar(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y + 10), BORDER_COLOR); screen.makeButton(Common::Rect(112, CONTROLS_Y, 160, CONTROLS_Y + 10), 136, saves._fixedTextQuitGameYes); @@ -2252,7 +2252,7 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri if (scene._goToScene != 1 && !printed && !talk._talkToAbort) { _infoFlag = true; clearInfo(); - screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, FIXED(UserInterface_Done)); + screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_Done)); _menuCounter = 25; } } @@ -2262,9 +2262,9 @@ void ScalpelUserInterface::checkUseAction(const UseType *use, const Common::Stri clearInfo(); if (giveMode) { - screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, FIXED(UserInterface_NoThankYou)); + screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_NoThankYou)); } else if (fixedTextActionId == kFixedTextAction_Invalid) { - screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, FIXED(UserInterface_YouCantDoThat)); + screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", FIXED(UserInterface_YouCantDoThat)); } else { Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, 0); screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", errorMessage.c_str()); -- cgit v1.2.3