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

svn-id: r35096
This commit is contained in:
Johannes Schickel 2008-11-16 20:20:31 +00:00
parent e1fdb1f882
commit 2ef8a32a01
12 changed files with 23 additions and 23 deletions

View File

@ -834,7 +834,7 @@ bool DrasculaEngine::loadDrasculaDat() {
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 @@ bool DrasculaEngine::loadDrasculaDat() {
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 @@ bool DrasculaEngine::loadDrasculaDat() {
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;
}

View File

@ -146,7 +146,7 @@ void initGraphics(int width, int height, bool defaultTo1xScaler) {
message += "'.";
GUIErrorMessage(message);
error(message.c_str());
error("%s", message.c_str());
}
// Just show warnings then these occur:
@ -179,7 +179,7 @@ void GUIErrorMessage(const Common::String msg) {
GUI::MessageDialog dialog(msg);
dialog.runModal();
} else {
error(msg.c_str());
error("%s", msg.c_str());
}
}

View File

@ -53,9 +53,9 @@ void debugScript(int level, bool nl, const char *s, ...) {
va_end(va);
if (nl)
debug(level, buf);
debug(level, "%s", buf);
else
debugN(level, buf);
debugN(level, "%s", buf);
}
Script::Script(GroovieEngine *vm) :

View File

@ -259,7 +259,7 @@ void KyraEngine_v1::loadGameStateCheck(int slot) {
errorMessage += "'";
GUIErrorMessage(errorMessage);
error(errorMessage.c_str());
error("%s", errorMessage.c_str());
}
}

View File

@ -167,7 +167,7 @@ bool StaticResource::loadStaticResourceFile() {
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;

View File

@ -1094,7 +1094,7 @@ uint16 Script::execute(uint16 startOffset) {
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 @@ uint16 Script::execute(uint16 startOffset) {
break;
}
debugC(ERROR_DETAILED, kLureDebugScripts, debugInfo);
debugC(ERROR_DETAILED, kLureDebugScripts, "%s", debugInfo);
}
}

View File

@ -408,7 +408,7 @@ bool Resource::createContexts() {
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 @@ bool Resource::createContexts() {
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 @@ bool Resource::createContexts() {
_contextsCount++;
digitalMusic = true;
fileFound = true;
sprintf(musicFileName, musicFilesITE[i].fileName);
strcpy(musicFileName, musicFilesITE[i].fileName);
break;
}
}

View File

@ -232,7 +232,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
#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());

View File

@ -54,7 +54,7 @@ void debugC(int channel, const char *s, ...) {
vsnprintf(buf, STRINGBUFLEN, s, va);
va_end(va);
debug(buf);
debug("%s", buf);
}
ScummDebugger::ScummDebugger(ScummEngine *s)

View File

@ -90,7 +90,7 @@ int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
}
strncat(str, "])", 256);
debug(0, str);
debug(0, "%s", str);
#else
// Used for parallel trace utility
for (int i = 0; i < numArgs; i++)

View File

@ -46,7 +46,7 @@ namespace Sword1 {
GUI::MessageDialog dialog(msg);
dialog.runModal();
error(msg);
error("%s", msg);
}
#define MAX_PATH_LEN 260

View File

@ -323,10 +323,10 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
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 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
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 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
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...