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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jan 20 10:38:55 CET 2009


Revision: 35943
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35943&view=rev
Author:   lordhoto
Date:     2009-01-20 09:38:55 +0000 (Tue, 20 Jan 2009)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/scene_lol.cpp
    scummvm/trunk/engines/kyra/sound_lok.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-01-20 09:32:43 UTC (rev 35942)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-01-20 09:38:55 UTC (rev 35943)
@@ -1284,8 +1284,8 @@
 	if (id < 0)
 		id = -id;
 
-	char file[] = "FACE%02d.SHP";
-	sprintf(file, "FACE%02d.SHP", id);
+	char file[13];
+	snprintf(file, sizeof(file), "FACE%02d.SHP", id);
 	_screen->loadBitmap(file, 3, 3, 0);
 
 	const uint8 *p = _screen->getCPagePtr(3);

Modified: scummvm/trunk/engines/kyra/scene_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_lol.cpp	2009-01-20 09:32:43 UTC (rev 35942)
+++ scummvm/trunk/engines/kyra/scene_lol.cpp	2009-01-20 09:38:55 UTC (rev 35943)
@@ -66,8 +66,8 @@
 	loadLevelWLL(index, true);
 	_loadLevelFlag = 1;
 
-	char filename[16];
-	sprintf(filename, "LEVEL%d.INI", index);
+	char filename[13];
+	snprintf(filename, sizeof(filename), "LEVEL%d.INI", index);
 	
 	int f = _levelFlagUnk & (1 << ((index + 0xff) & 0xff));
 
@@ -76,7 +76,7 @@
 	if (f)
 		loadLevelCmzFile(index);
 
-	sprintf(filename, "LEVEL%d.INF", index);
+	snprintf(filename, sizeof(filename), "LEVEL%d.INF", index);
 	runInfScript(filename);
 
 	addLevelItems();
@@ -268,8 +268,8 @@
 }
 
 void LoLEngine::loadLevelWLL(int index, bool mapShapes) {
-	char filename[16];
-	sprintf(filename, "level%d.wll", index);
+	char filename[13];
+	snprintf(filename, sizeof(filename), "LEVEL%d.WLL", index);
 
 	uint32 size;
 	uint8 *file = _res->fileData(filename, &size);
@@ -360,15 +360,15 @@
 }
 
 void LoLEngine::loadLevelCmzFile(int index) {
-	//char filename[16];
-	//sprintf(filename, "_LEVEL%d.TMP", index);
+	//char filename[13];
+	//snprintf(filename, sizeof(filename), "_LEVEL%d.TMP", index);
 	// TODO ???
 	memset(_tempBuffer5120, 0, 5120);
 	uint16 tmpLvlVal = 0;
 
 
-	char filename[16];
-	sprintf(filename, "level%d.cmz", index);
+	char filename[13];
+	snprintf(filename, sizeof(filename), "LEVEL%d.CMZ", index);
 	
 	_screen->loadBitmap(filename, 3, 3, 0);
 	const uint8 *p = _screen->getCPagePtr(2);
@@ -599,8 +599,8 @@
 		}
 	}
 	
-	char fname[] = "            ";
-	sprintf(fname, "%s.%s", _lastSuppFile, "VCN");
+	char fname[13];
+	snprintf(fname, sizeof(fname), "%s.VCN", _lastSuppFile);
 
 	_screen->loadBitmap(fname, 3, 3, 0);
 	const uint8 *v = _screen->getCPagePtr(2);
@@ -643,7 +643,7 @@
 	memcpy(_vcnBlocks, v, vcnLen);
 	v += vcnLen;
 
-	sprintf(fname, "%s.%s", _lastSuppFile, "VMP");
+	snprintf(fname, sizeof(fname), "%s.VMP", _lastSuppFile);
 	_screen->loadBitmap(fname, 3, 3, 0);
 	v = _screen->getCPagePtr(2);
 
@@ -678,8 +678,8 @@
 	_loadSuppFilesFlag = 0;
 	_screen->generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampOilStatus);
 
-	char tname[16];
-	sprintf(tname, "LEVEL%.02d.TLC", _currentLevel);
+	char tname[13];
+	snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
 	Common::SeekableReadStream *s = _res->getFileStream(tname);
 	s->read(_tlcTable1, 256);
 	s->read(_tlcTable2, 5120);

Modified: scummvm/trunk/engines/kyra/sound_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_lok.cpp	2009-01-20 09:32:43 UTC (rev 35942)
+++ scummvm/trunk/engines/kyra/sound_lok.cpp	2009-01-20 09:38:55 UTC (rev 35943)
@@ -74,8 +74,7 @@
 void KyraEngine_LoK::snd_playVoiceFile(int id) {
 	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_LoK::snd_playVoiceFile(%d)", id);
 	char vocFile[9];
-	assert(id >= 0 && id < 9999);
-	sprintf(vocFile, "%03d", id);
+	snprintf(vocFile, sizeof(vocFile), "%03d", id);
 	_speechFile = vocFile;
 	_speechPlayTime = _sound->voicePlay(vocFile);
 }


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