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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Nov 16 21:20:35 CET 2008


Revision: 35096
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35096&view=rev
Author:   lordhoto
Date:     2008-11-16 20:20:31 +0000 (Sun, 16 Nov 2008)

Log Message:
-----------
Fixed various g++ warnings ("format not a string literal and no format arguments").

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp
    scummvm/trunk/engines/engine.cpp
    scummvm/trunk/engines/groovie/script.cpp
    scummvm/trunk/engines/kyra/saveload.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/engines/lure/scripts.cpp
    scummvm/trunk/engines/saga/rscfile.cpp
    scummvm/trunk/engines/saga/sthread.cpp
    scummvm/trunk/engines/scumm/debugger.cpp
    scummvm/trunk/engines/scumm/he/logic_he.cpp
    scummvm/trunk/engines/sword1/resman.cpp
    scummvm/trunk/engines/sword1/sword1.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -834,7 +834,7 @@
 	if (!in.isOpen()) {
 		Common::String errorMessage = "You're missing the 'drascula.dat' file. Get it from the ScummVM website";
 		GUIErrorMessage(errorMessage);
-		warning(errorMessage.c_str());
+		warning("%s", errorMessage.c_str());
 
 		return false;
 	}
@@ -848,7 +848,7 @@
 	if (strcmp(buf, "DRASCULA")) {
 		Common::String errorMessage = "File 'drascula.dat' is corrupt. Get it from the ScummVM website";
 		GUIErrorMessage(errorMessage);
-		warning(errorMessage.c_str());
+		warning("%s", errorMessage.c_str());
 
 		return false;
 	}
@@ -858,7 +858,7 @@
 	if (ver != DRASCULA_DAT_VER) {
 		snprintf(buf, 256, "File 'drascula.dat' is wrong version. Expected %d but got %d. Get it from the ScummVM website", DRASCULA_DAT_VER, ver);
 		GUIErrorMessage(buf);
-		warning(buf);
+		warning("%s", buf);
 
 		return false;
 	}

Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/engine.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -146,7 +146,7 @@
 		message += "'.";
 
 		GUIErrorMessage(message);
-		error(message.c_str());
+		error("%s", message.c_str());
 	}
 
 	// Just show warnings then these occur:
@@ -179,7 +179,7 @@
 		GUI::MessageDialog dialog(msg);
 		dialog.runModal();
 	} else {
-		error(msg.c_str());
+		error("%s", msg.c_str());
 	}
 }
 

Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/groovie/script.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -53,9 +53,9 @@
 	va_end(va);
 
 	if (nl)
-		debug(level, buf);
+		debug(level, "%s", buf);
 	else
-		debugN(level, buf);
+		debugN(level, "%s", buf);
 }
 
 Script::Script(GroovieEngine *vm) :

Modified: scummvm/trunk/engines/kyra/saveload.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/kyra/saveload.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -259,7 +259,7 @@
 		errorMessage += "'";
 
 		GUIErrorMessage(errorMessage);
-		error(errorMessage.c_str());
+		error("%s", errorMessage.c_str());
 	}
 }
 

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -167,7 +167,7 @@
 	if (!foundWorkingKyraDat) {
 		Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
 		GUIErrorMessage(errorMessage);
-		error(errorMessage.c_str());
+		error("%s", errorMessage.c_str());
 	}
 
 	return true;

Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/lure/scripts.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -1094,7 +1094,7 @@
 					sprintf(debugInfo + strlen(debugInfo), " (%d)", stack[stack.size()-1]);
 				strcat(debugInfo, ")");
 
-				debugC(ERROR_DETAILED, kLureDebugScripts, debugInfo);
+				debugC(ERROR_DETAILED, kLureDebugScripts, "%s", debugInfo);
 			}
 
 			param1 = 0; param2 = 0; param3 = 0;
@@ -1164,7 +1164,7 @@
 				break;
 			}
 
-			debugC(ERROR_DETAILED, kLureDebugScripts, debugInfo);
+			debugC(ERROR_DETAILED, kLureDebugScripts, "%s", debugInfo);
 		}
 	}
 

Modified: scummvm/trunk/engines/saga/rscfile.cpp
===================================================================
--- scummvm/trunk/engines/saga/rscfile.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/saga/rscfile.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -408,7 +408,7 @@
 			if (Common::File::exists(curSoundfiles[i].fileName)) {
 				_contextsCount++;
 				soundFileIndex = _contextsCount - 1;
-				sprintf(soundFileName, curSoundfiles[i].fileName);
+				strcpy(soundFileName, curSoundfiles[i].fileName);
 				_vm->_gf_compressed_sounds = curSoundfiles[i].isCompressed;
 				fileFound = true;
 				break;
@@ -452,7 +452,7 @@
 		if (Common::File::exists(curSoundfiles[i].fileName)) {
 			_contextsCount++;
 			voicesFileIndex = _contextsCount - 1;
-			sprintf(_voicesFileName[0], curSoundfiles[i].fileName);
+			strcpy(_voicesFileName[0], curSoundfiles[i].fileName);
 			_vm->_gf_compressed_sounds = curSoundfiles[i].isCompressed;
 			fileFound = true;
 
@@ -519,7 +519,7 @@
 				_contextsCount++;
 				digitalMusic = true;
 				fileFound = true;
-				sprintf(musicFileName, musicFilesITE[i].fileName);
+				strcpy(musicFileName, musicFilesITE[i].fileName);
 				break;
 			}
 		}

Modified: scummvm/trunk/engines/saga/sthread.cpp
===================================================================
--- scummvm/trunk/engines/saga/sthread.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/saga/sthread.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -232,7 +232,7 @@
 #define CASEOP(opName)	case opName:												\
 							if (operandChar == opName) {							\
 								operandName = #opName;								\
-								debug(2, operandName);								\
+								debug(2, "%s", operandName);						\
 							}
 
 		debug(8, "Executing thread offset: %u (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize());

Modified: scummvm/trunk/engines/scumm/debugger.cpp
===================================================================
--- scummvm/trunk/engines/scumm/debugger.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/scumm/debugger.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -54,7 +54,7 @@
 	vsnprintf(buf, STRINGBUFLEN, s, va);
 	va_end(va);
 
-	debug(buf);
+	debug("%s", buf);
 }
 
 ScummDebugger::ScummDebugger(ScummEngine *s)

Modified: scummvm/trunk/engines/scumm/he/logic_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/logic_he.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/scumm/he/logic_he.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -90,7 +90,7 @@
 	}
 	strncat(str, "])", 256);
 
-	debug(0, str);
+	debug(0, "%s", str);
 #else
 	// Used for parallel trace utility
 	for (int i = 0; i < numArgs; i++)

Modified: scummvm/trunk/engines/sword1/resman.cpp
===================================================================
--- scummvm/trunk/engines/sword1/resman.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/sword1/resman.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -46,7 +46,7 @@
 
 		GUI::MessageDialog dialog(msg);
 		dialog.runModal();
-		error(msg);
+		error("%s", msg);
 }
 
 #define MAX_PATH_LEN 260

Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp	2008-11-16 19:20:30 UTC (rev 35095)
+++ scummvm/trunk/engines/sword1/sword1.cpp	2008-11-16 20:20:31 UTC (rev 35096)
@@ -323,10 +323,10 @@
 		if (missCnt == 1) {
 			sprintf(msg, errorMsgs[msgId],
 					_macCdFileList[missNum].name, (_macCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
-			warning(msg);
+			warning("%s", msg);
 		} else {
 			char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
-			warning(msg);
+			warning("%s", msg);
 			for (int i = 0; i < ARRAYSIZE(_macCdFileList); i++)
 				if (!fileExists[i]) {
 					warning("\"%s\" (CD %d)", _macCdFileList[i].name, (_macCdFileList[i].flags & FLAG_CD2) ? 2 : 1);
@@ -345,10 +345,10 @@
 		if (missCnt == 1) {
 			sprintf(msg, errorMsgs[msgId],
 					_pcCdFileList[missNum].name, (_pcCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
-			warning(msg);
+			warning("%s", msg);
 		} else {
 			char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
-			warning(msg);
+			warning("%s", msg);
 			for (int i = 0; i < ARRAYSIZE(_pcCdFileList); i++)
 				if (!fileExists[i]) {
 					warning("\"%s\" (CD %d)", _pcCdFileList[i].name, (_pcCdFileList[i].flags & FLAG_CD2) ? 2 : 1);
@@ -359,7 +359,7 @@
 	GUI::MessageDialog dialog(msg);
 	dialog.runModal();
 	if (type == TYPE_IMMED) // we can't start without this file, so error() out.
-		error(msg);
+		error("%s", msg);
 }
 
 void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or what...


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