[Scummvm-cvs-logs] SF.net SVN: scummvm:[43444] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Aug 16 19:35:59 CEST 2009


Revision: 43444
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43444&view=rev
Author:   lordhoto
Date:     2009-08-16 17:35:59 +0000 (Sun, 16 Aug 2009)

Log Message:
-----------
Fix format arugments in LoL code. (triggered via -Wformat-security)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/saveload_lol.cpp
    scummvm/trunk/engines/kyra/scene_lol.cpp
    scummvm/trunk/engines/kyra/sequences_lol.cpp
    scummvm/trunk/engines/kyra/sprites_lol.cpp

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-08-16 16:39:34 UTC (rev 43443)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-08-16 17:35:59 UTC (rev 43444)
@@ -127,7 +127,7 @@
 		if (_availableSpells[i] == -1)
 			continue;
 		uint8 col = (i == _selectedSpell) ? 132 : 1;
-		_screen->fprintString(getLangString(_spellProperties[_availableSpells[i]].spellNameCode), 24, y, col, 0, 0);
+		_screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode));
 		y += 9;
 	}
 }
@@ -138,7 +138,7 @@
 		if (_availableSpells[i] == -1)
 			continue;
 		uint8 col = (mode && (i == _selectedSpell)) ? 132 : 1;
-		_screen->fprintString(getLangString(_spellProperties[_availableSpells[i]].spellNameCode), 24, y, col, 0, 0);
+		_screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode));
 		y += 9;
 	}
 }
@@ -165,14 +165,14 @@
 	_screen->copyRegion(80, 143, 80, 143, 232, 35, 0, 2);
 	gui_drawAllCharPortraitsWithStats();
 
-	_screen->fprintString(l->name, 157, 9, 254, 0, 5);
+	_screen->fprintString("%s", 157, 9, 254, 0, 5, l->name);
 
 	gui_printCharInventoryStats(charNum);
 
 	for (int i = 0; i < 11; i++)
 		gui_drawCharInventoryItem(i);
 
-	_screen->fprintString(getLangString(0x4033), 182, 103, 172, 0, 5);
+	_screen->fprintString("%s", 182, 103, 172, 0, 5, getLangString(0x4033));
 
 	static const uint16 statusFlags[] = { 0x0080, 0x0000, 0x1000, 0x0002, 0x100, 0x0001, 0x0000, 0x0000 };
 
@@ -232,14 +232,14 @@
 		y = index * 10 + 22;
 		col = 158;
 		if (redraw)
-			_screen->fprintString(getLangString(0x4014 + index), offs + 108, y, col, 0, 4);
+			_screen->fprintString("%s", offs + 108, y, col, 0, 4, getLangString(0x4014 + index));
 	} else {
 		//skills
 		int s = index - 2;
 		y = s * 10 + 62;
 		col = _characters[_selectedCharacter].flags & (0x200 << s) ? 254 : 180;
 		if (redraw)
-			_screen->fprintString(getLangString(0x4014 + index), offs + 108, y, col, 0, 4);
+			_screen->fprintString("%s", offs + 108, y, col, 0, 4, getLangString(0x4014 + index));
 	}
 
 	if (offs)
@@ -1215,7 +1215,7 @@
 		return 1;
 	}
 
-	_txt->printMessage(2, getLangString((flg & 8) ? 0x4029 : ((flg & 0x10) ? 0x402a : 0x402b)));
+	_txt->printMessage(2, "%s", getLangString((flg & 8) ? 0x4029 : ((flg & 0x10) ? 0x402a : 0x402b)));
 	return 1;
 }
 
@@ -1235,13 +1235,13 @@
 			}
 
 			if (!f)
-				_txt->printMessage(_itemsInPlay[_itemInHand].itemPropertyIndex == 231 ? 2 : 0, getLangString(0x418C));
+				_txt->printMessage(_itemsInPlay[_itemInHand].itemPropertyIndex == 231 ? 2 : 0, "%s", getLangString(0x418C));
 
 			return 1;
 		}
 	} else {
 		if (!_characters[_selectedCharacter].items[button->arg]) {
-			_txt->printMessage(0, getLangString(_inventorySlotDesc[button->arg] + 8));
+			_txt->printMessage(0, "%s", getLangString(_inventorySlotDesc[button->arg] + 8));
 			return 1;
 		}
 	}
@@ -1506,7 +1506,7 @@
 
 int LoLEngine::clickedSpellTargetScene(Button *button) {
 	LoLCharacter *c = &_characters[_activeSpell.charNum];
-	_txt->printMessage(0, getLangString(0x4041));
+	_txt->printMessage(0, "%s", getLangString(0x4041));
 
 	c->magicPointsCur += _activeSpell.p->mpRequired[_activeSpell.level];
 	if (c->magicPointsCur > c->magicPointsMax)
@@ -1633,7 +1633,7 @@
 		_screen->fillRect(112, 0, 288, 120, 1);
 		gui_drawAllCharPortraitsWithStats();
 
-		_txt->printMessage(0x8000, getLangString(0x4057));
+		_txt->printMessage(0x8000, "%s", getLangString(0x4057));
 		gui_toggleButtonDisplayMode(77, 0);
 
 		int h = 600 / tHp;
@@ -1761,7 +1761,7 @@
 		_partyAwake = true;
 		updateDrawPage2();
 		gui_drawScene(0);
-		_txt->printMessage(0x8000, getLangString(0x4059));
+		_txt->printMessage(0x8000, "%s", getLangString(0x4059));
 		_screen->fadeToPalette1(40);
 
 	} else {
@@ -1774,12 +1774,12 @@
 				if (needPoisoningFlags & (1 << i))
 					setTemporaryFaceFrame(i, 3, 8, 0);
 			}
-			_txt->printMessage(0x8000, getLangString(0x405a));
+			_txt->printMessage(0x8000, "%s", getLangString(0x405a));
 			gui_drawAllCharPortraitsWithStats();
 
 		} else {
 			setTemporaryFaceFrameForAllCharacters(2, 4, 1);
-			_txt->printMessage(0x8000, getLangString(0x4058));
+			_txt->printMessage(0x8000, "%s", getLangString(0x4058));
 		}
 		gui_toggleButtonDisplayMode(77, 0);
 	}
@@ -1798,9 +1798,9 @@
 
 	if (_compassBroken) {
 		if (characterSays(0x425b, -1, true))
-			_txt->printMessage(4, getLangString(0x425b));
+			_txt->printMessage(4, "%s", getLangString(0x425b));
 	} else {
-		_txt->printMessage(0, getLangString(0x402f + _currentDirection));
+		_txt->printMessage(0, "%s", getLangString(0x402f + _currentDirection));
 	}
 
 	return 1;
@@ -1824,11 +1824,11 @@
 
 	if (_itemsInPlay[_itemInHand].itemPropertyIndex == 248) {
 		if (_lampOilStatus >= 100) {
-			_txt->printMessage(0, getLangString(0x4061));
+			_txt->printMessage(0, "%s", getLangString(0x4061));
 			return 1;
 		}
 
-		_txt->printMessage(0, getLangString(0x4062));
+		_txt->printMessage(0, "%s", getLangString(0x4062));
 
 		deleteItem(_itemInHand);
 		snd_playSoundEffect(181, -1);
@@ -1860,7 +1860,7 @@
 	if (str == 0 || str > 3)
 		return 1;
 
-	_txt->printMessage(0x8002, getLangString(str == 1 ? 0x424c : (str == 2 ? 0x424e : 0x424d)));
+	_txt->printMessage(0x8002, "%s", getLangString(str == 1 ? 0x424c : (str == 2 ? 0x424e : 0x424d)));
 	return 1;
 }
 
@@ -2386,7 +2386,7 @@
 				fC = _screen->getTextWidth(_saveDescription);
 			}
 
-			_screen->fprintString(_saveDescription, (d->sx << 3), d->sy + 2, d->unk8, d->unkA, 0);
+			_screen->fprintString("%s", (d->sx << 3), d->sy + 2, d->unk8, d->unkA, 0, _saveDescription);
 			_screen->fillRect((d->sx << 3) + fC, d->sy, (d->sx << 3) + fC + wW, d->sy + d->h - 1, d->unk8, 0);
 			_screen->setCurPage(pg);
 		}
@@ -2485,7 +2485,7 @@
 }
 
 void GUI_LoL::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags, Screen::FontId font) {
-	_screen->fprintString(str, x, y, c0, c1, flags);
+	_screen->fprintString("%s", x, y, c0, c1, flags, str);
 }
 
 int GUI_LoL::getMenuCenterStringX(const char *str, int x1, int x2) {

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-08-16 16:39:34 UTC (rev 43443)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-08-16 17:35:59 UTC (rev 43444)
@@ -1900,7 +1900,7 @@
 	_activeSpell.level = ABS(spellLevel);
 
 	if ((_spellProperties[spellType].flags & 0x100) && testWallFlag(calcNewBlockPosition(_currentBlock, _currentDirection), _currentDirection, 1)) {
-		_txt->printMessage(2, getLangString(0x4257));
+		_txt->printMessage(2, "%s", getLangString(0x4257));
 		return 0;
 	}
 
@@ -2062,7 +2062,7 @@
 }
 
 int LoLEngine::processMagicHealSelectTarget() {
-	_txt->printMessage(0, getLangString(0x4040));
+	_txt->printMessage(0, "%s", getLangString(0x4040));
 	gui_resetButtonList();
 	gui_setFaceFramesControlButtons(81, 0);
 	gui_initButtonsFromList(_buttonList8);
@@ -2929,7 +2929,7 @@
 		}
 
 		if (_availableSpells[i] == spell) {
-			_txt->printMessage(2, getLangString(0x42d0));
+			_txt->printMessage(2, "%s", getLangString(0x42d0));
 			return;
 		}
 	}
@@ -2965,7 +2965,7 @@
 				if (_availableSpells[ii] == -1)
 					continue;
 				uint8 col = (ii == _selectedSpell) ? 132 : 1;
-				_screen->fprintString(getLangString(_spellProperties[_availableSpells[ii]].spellNameCode), 24, y, col, 0, 0);
+				_screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[ii]].spellNameCode));
 				y += 9;
 			}
 
@@ -3459,7 +3459,7 @@
 		if (t) {
 			giveItemToMonster(monster, t);
 			if (characterSays(0x4019, _characters[target].id, true))
-				_txt->printMessage(6, getLangString(0x4019));
+				_txt->printMessage(6, "%s", getLangString(0x4019));
 		}
 		break;
 
@@ -3473,7 +3473,7 @@
 		if (t) {
 			deleteItem(t);
 			if (characterSays(0x401b, _characters[target].id, true))
-				_txt->printMessage(6, getLangString(0x401b));
+				_txt->printMessage(6, "%s", getLangString(0x401b));
 		}
 		break;
 
@@ -3541,12 +3541,12 @@
 			if (monster->properties->defenseSkillType == 1) {
 				giveItemToMonster(monster, itm);
 				if (characterSays(0x401c, _characters[attacker].id, true))
-					_txt->printMessage(6, getLangString(0x401c));
+					_txt->printMessage(6, "%s", getLangString(0x401c));
 
 			} else {
 				deleteItem(itm);
 				if (characterSays(0x401d, _characters[attacker].id, true))
-					_txt->printMessage(6, getLangString(0x401d));
+					_txt->printMessage(6, "%s", getLangString(0x401d));
 			}
 		}
 		break;
@@ -4315,7 +4315,7 @@
 
 void LoLEngine::printMapExitButtonText() {
 	int cp = _screen->setCurPage(2);
-	_screen->fprintString(getLangString(0x4033), 295, 182, 172, 0, 5);
+	_screen->fprintString("%s", 295, 182, 172, 0, 5, getLangString(0x4033));
 	_screen->setCurPage(cp);
 }
 

Modified: scummvm/trunk/engines/kyra/saveload_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_lol.cpp	2009-08-16 16:39:34 UTC (rev 43443)
+++ scummvm/trunk/engines/kyra/saveload_lol.cpp	2009-08-16 17:35:59 UTC (rev 43444)
@@ -43,7 +43,7 @@
 	SaveHeader header;
 	Common::InSaveFile *saveFile = openSaveForReading(fileName, header);
 	if (!saveFile) {
-		_txt->printMessage(2, getLangString(0x425d));
+		_txt->printMessage(2, "%s", getLangString(0x425d));
 		return Common::kNoError;
 	}
 

Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp	2009-08-16 16:39:34 UTC (rev 43443)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp	2009-08-16 17:35:59 UTC (rev 43444)
@@ -762,7 +762,7 @@
 		movePartySmoothScrollBlocked(2);
 
 	snd_stopSpeech(true);
-	_txt->printMessage(0x8002, getLangString(0x403f));
+	_txt->printMessage(0x8002, "%s", getLangString(0x403f));
 	snd_playSoundEffect(19, -1);
 }
 

Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-08-16 16:39:34 UTC (rev 43443)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp	2009-08-16 17:35:59 UTC (rev 43444)
@@ -290,7 +290,7 @@
 	_screen->_curPage = 2;
 
 	for (int i = 0; i < 4; ++i)
-		_screen->fprintStringIntro(_charPreviews[i].name, _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120);
+		_screen->fprintStringIntro("%s", _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120, _charPreviews[i].name);
 
 	for (int i = 0; i < 4; ++i) {
 		_screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 48, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[0]);
@@ -298,9 +298,9 @@
 		_screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 64, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[2]);
 	}
 
-	_screen->fprintStringIntro(_tim->getCTableEntry(51), 36, 173, 0x98, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(53), 36, 181, 0x98, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(55), 36, 189, 0x98, 0x00, 0x9C, 0x20);
+	_screen->fprintStringIntro("%s", 36, 173, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(51));
+	_screen->fprintStringIntro("%s", 36, 181, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(53));
+	_screen->fprintStringIntro("%s", 36, 189, 0x98, 0x00, 0x9C, 0x20, _tim->getCTableEntry(55));
 
 	_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
 	_screen->_curPage = 0;
@@ -363,11 +363,11 @@
 	_screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK);
 	int y = 38;
 
-	_screen->fprintStringIntro(_tim->getCTableEntry(57), 8, y, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(58), 8, y + 10, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(59), 8, y + 20, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(60), 8, y + 30, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(61), 8, y + 40, 0x32, 0x00, 0x9C, 0x20);
+	_screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(57));
+	_screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(58));
+	_screen->fprintStringIntro("%s", 8, y + 20, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(59));
+	_screen->fprintStringIntro("%s", 8, y + 30, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(60));
+	_screen->fprintStringIntro("%s", 8, y + 40, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(61));
 
 	_sound->voicePlay("KING01", &_speechHandle);
 
@@ -405,8 +405,8 @@
 	_screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK);
 	int y = 48;
 
-	_screen->fprintStringIntro(_tim->getCTableEntry(62), 8, y, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(63), 8, y + 10, 0x32, 0x00, 0x9C, 0x20);
+	_screen->fprintStringIntro("%s", 8, y, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(62));
+	_screen->fprintStringIntro("%s", 8, y + 10, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(63));
 
 	_sound->voicePlay("KING02", &_speechHandle);
 
@@ -540,13 +540,13 @@
 	static const uint8 charSelectInfoIdx[] = { 0x1D, 0x22, 0x27, 0x2C };
 	const int idx = charSelectInfoIdx[character];
 
-	_screen->fprintStringIntro(_tim->getCTableEntry(idx+0), 50, 127, 0x53, 0x00, 0xCF, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(idx+1), 50, 137, 0x53, 0x00, 0xCF, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(idx+2), 50, 147, 0x53, 0x00, 0xCF, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(idx+3), 50, 157, 0x53, 0x00, 0xCF, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(idx+4), 50, 167, 0x53, 0x00, 0xCF, 0x20);
+	_screen->fprintStringIntro("%s", 50, 127, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+0));
+	_screen->fprintStringIntro("%s", 50, 137, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+1));
+	_screen->fprintStringIntro("%s", 50, 147, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+2));
+	_screen->fprintStringIntro("%s", 50, 157, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+3));
+	_screen->fprintStringIntro("%s", 50, 167, 0x53, 0x00, 0xCF, 0x20, _tim->getCTableEntry(idx+4));
 
-	_screen->fprintStringIntro(_tim->getCTableEntry(69), 100, 168, 0x32, 0x00, 0xCF, 0x20);
+	_screen->fprintStringIntro("%s", 100, 168, 0x32, 0x00, 0xCF, 0x20, _tim->getCTableEntry(69));
 
 	selectionCharInfoIntro(vocFilename);
 	if (_charSelectionInfoResult == -1) {
@@ -568,11 +568,11 @@
 	_screen->copyRegion(48, 127, 48, 160, 272, 35, 4, 0, Screen::CR_NO_P_CHECK);
 	_screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK);
 
-	_screen->fprintStringIntro(_tim->getCTableEntry(64), 3, 28, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(65), 3, 38, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(66), 3, 48, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(67), 3, 58, 0x32, 0x00, 0x9C, 0x20);
-	_screen->fprintStringIntro(_tim->getCTableEntry(68), 3, 68, 0x32, 0x00, 0x9C, 0x20);
+	_screen->fprintStringIntro("%s", 3, 28, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(64));
+	_screen->fprintStringIntro("%s", 3, 38, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(65));
+	_screen->fprintStringIntro("%s", 3, 48, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(66));
+	_screen->fprintStringIntro("%s", 3, 58, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(67));
+	_screen->fprintStringIntro("%s", 3, 68, 0x32, 0x00, 0x9C, 0x20, _tim->getCTableEntry(68));
 
 	resetSkipFlag();
 	kingSelectionOutro();

Modified: scummvm/trunk/engines/kyra/sprites_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sprites_lol.cpp	2009-08-16 16:39:34 UTC (rev 43443)
+++ scummvm/trunk/engines/kyra/sprites_lol.cpp	2009-08-16 17:35:59 UTC (rev 43444)
@@ -1307,7 +1307,7 @@
 				if (getMonsterDistance(monster->block, _monsters[i].block) < 7)
 					setMonsterMode(monster, 7);
 			}
-			_txt->printMessage(2, getLangString(0x401a));
+			_txt->printMessage(2, "%s", getLangString(0x401a));
 
 		} else if (flyingObject == 4) {
 			launchMagicViper();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list