aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-07-03 10:40:49 +0000
committerMax Horn2009-07-03 10:40:49 +0000
commitcbea1a11935074090f737737e0a26d43cd708f89 (patch)
tree823cce2d1933f519fefc17a3f40adc1e802e3a18 /engines
parent9664050ff07214ccd2ae2189475ddde80e7630ef (diff)
downloadscummvm-rg350-cbea1a11935074090f737737e0a26d43cd708f89.tar.gz
scummvm-rg350-cbea1a11935074090f737737e0a26d43cd708f89.tar.bz2
scummvm-rg350-cbea1a11935074090f737737e0a26d43cd708f89.zip
Added more GCC_PRINTF attributes, and fixed resulting warnings in format strings
svn-id: r42054
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.h2
-rw-r--r--engines/agos/script_e1.cpp2
-rw-r--r--engines/groovie/script.cpp14
-rw-r--r--engines/kyra/screen_lol.h4
-rw-r--r--engines/kyra/text_lol.h2
-rw-r--r--engines/lure/lure.h2
-rw-r--r--engines/scumm/he/resource_he.cpp2
-rw-r--r--engines/scumm/he/script_v71he.cpp2
-rw-r--r--engines/scumm/resource.cpp2
-rw-r--r--engines/scumm/scumm.h10
-rw-r--r--engines/scumm/smush/imuse_channel.cpp2
-rw-r--r--engines/scumm/sound.cpp2
-rw-r--r--engines/sky/control.cpp2
-rw-r--r--engines/sky/control.h2
-rw-r--r--engines/sword1/control.h2
15 files changed, 26 insertions, 26 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 1edfe54612..f6a85d498d 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -673,7 +673,7 @@ protected:
void uncompressText(byte *ptr);
byte *uncompressToken(byte a, byte *ptr);
- void showMessageFormat(const char *s, ...);
+ void showMessageFormat(const char *s, ...) GCC_PRINTF(2, 3);
const byte *getStringPtrByID(uint16 stringId, bool upperCase = false);
const byte *getLocalStringByID(uint16 stringId);
uint getNextStringID();
diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index 0080748699..df37a38a7c 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.cpp
@@ -532,7 +532,7 @@ void AGOSEngine_Elvira1::oe1_moveDirn() {
void AGOSEngine_Elvira1::oe1_score() {
// 90: score
SubPlayer *p = (SubPlayer *)findChildOfType(me(), kPlayerType);
- showMessageFormat("Your score is %ld.\n", p->score);
+ showMessageFormat("Your score is %d.\n", p->score);
}
void AGOSEngine_Elvira1::oe1_look() {
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index df627e841c..eb53842b91 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -38,7 +38,9 @@
namespace Groovie {
-void debugScript(int level, bool nl, const char *s, ...) {
+static void debugScript(int level, bool nl, const char *s, ...) GCC_PRINTF(3, 4);
+
+static void debugScript(int level, bool nl, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
@@ -511,7 +513,7 @@ void Script::o_videofromref() { // 0x09
}
}
if (fileref != _videoRef) {
- debugScript(1, true, "");
+ debugScript(1, false, "\n");
}
// Play the video
if (!playvideofromref(fileref)) {
@@ -569,7 +571,7 @@ bool Script::playvideofromref(uint32 fileref) {
_eventKbdChar = 0;
// Newline
- debugScript(1, true, "");
+ debugScript(1, false, "\n");
}
// Let the caller know if the video has ended
@@ -759,7 +761,7 @@ void Script::o_loadstring() {
setVariable(varnum++, readScriptChar(true, true, true));
debugScript(1, false, " 0x%02X", _variables[varnum - 1]);
} while (!(getCodeByte(_currentInstruction - 1) & 0x80));
- debugScript(1, true, "");
+ debugScript(1, false, "\n");
}
void Script::o_ret() {
@@ -840,7 +842,7 @@ void Script::o_xor_obfuscate() {
varnum++;
} while (!_firstbit);
- debugScript(1, true, "");
+ debugScript(1, false, "\n");
}
void Script::o_vdxtransition() { // 0x1C
@@ -1095,7 +1097,7 @@ void Script::o_loadstringvar() {
setVariable(varnum++, readScriptChar(true, true, true));
debugScript(1, false, " 0x%02X", _variables[varnum - 1]);
} while (!(getCodeByte(_currentInstruction - 1) & 0x80));
- debugScript(1, true, "");
+ debugScript(1, false, "\n");
}
void Script::o_chargreatjmp() {
diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h
index db355977f8..2545064b58 100644
--- a/engines/kyra/screen_lol.h
+++ b/engines/kyra/screen_lol.h
@@ -46,8 +46,8 @@ public:
int curDimIndex() { return _curDimIndex; }
void modifyScreenDim(int dim, int x, int y, int w, int h);
- void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...);
- void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...);
+ void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8);
+ void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) GCC_PRINTF(2, 9);
void drawGridBox(int x, int y, int w, int h, int col);
void fadeClearSceneWindow(int delay);
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index 06c13e1fef..5586be730e 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -47,7 +47,7 @@ public:
void resetDimTextPositions(int dim);
void printDialogueText(int dim, char *str, EMCState *script, const uint16 *paramList, int16 paramIndex);
- void printMessage(uint16 type, const char *str, ...);
+ void printMessage(uint16 type, const char *str, ...) GCC_PRINTF(3, 4);
int16 _scriptParameter;
diff --git a/engines/lure/lure.h b/engines/lure/lure.h
index 12494870ad..e8f1a7c1e1 100644
--- a/engines/lure/lure.h
+++ b/engines/lure/lure.h
@@ -91,7 +91,7 @@ public:
bool saveGame(uint8 slotNumber, Common::String &caption);
Common::String *detectSave(int slotNumber);
uint8 saveVersion() { return _saveVersion; }
- void GUIError(const char *msg, ...);
+ void GUIError(const char *msg, ...) GCC_PRINTF(2, 3);
uint32 getFeatures() const;
Common::Language getLanguage() const;
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 1b5b467512..022dbc0eb3 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -913,7 +913,7 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
if (entries[c].dib_size != bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad))
debugC(DEBUG_RESOURCE, "incorrect total size of bitmap (%d specified; %d real)",
entries[c].dib_size,
- bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad)
+ (int)(bitmap.size + image_size + mask_size + palette_count * sizeof(Win32RGBQuad))
);
image_data = (byte *)malloc(image_size);
diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp
index 316d51b12d..c832d64316 100644
--- a/engines/scumm/he/script_v71he.cpp
+++ b/engines/scumm/he/script_v71he.cpp
@@ -59,7 +59,7 @@ byte *ScummEngine_v71he::heFindResourceData(uint32 tag, byte *ptr) {
byte *ScummEngine_v71he::heFindResource(uint32 tag, byte *searchin) {
uint32 curpos, totalsize, size;
- debugC(DEBUG_RESOURCE, "heFindResource(%s, %lx)", tag2str(tag), searchin);
+ debugC(DEBUG_RESOURCE, "heFindResource(%s, %p)", tag2str(tag), (const void *)searchin);
assert(searchin);
searchin += 4;
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 4638c40828..88802a205f 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -1372,7 +1372,7 @@ const byte *ResourceIterator::findNext(uint32 tag) {
const byte *ScummEngine::findResource(uint32 tag, const byte *searchin) {
uint32 curpos, totalsize, size;
- debugC(DEBUG_RESOURCE, "findResource(%s, %lx)", tag2str(tag), searchin);
+ debugC(DEBUG_RESOURCE, "findResource(%s, %p)", tag2str(tag), (const void *)searchin);
if (!searchin) {
if (_game.heversion >= 70) {
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 9ac6f87f26..e3be053810 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -128,7 +128,7 @@ enum GameFeatures {
};
/* SCUMM Debug Channels */
-void debugC(int level, const char *s, ...);
+void debugC(int level, const char *s, ...) GCC_PRINTF(2, 3);
enum {
DEBUG_GENERAL = 1 << 0, // General debug
@@ -528,7 +528,7 @@ protected:
void versionDialog();
void scummMenuDialog();
- char displayMessage(const char *altButton, const char *message, ...);
+ char displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);
byte _fastMode;
@@ -543,15 +543,13 @@ public:
// VAR is a wrapper around scummVar, which attempts to include additional
// useful information should an illegal var access be detected.
#define VAR(x) scummVar(x, #x, __FILE__, __LINE__)
- int32& scummVar(byte var, const char *varName, const char *file, int line)
- {
+ int32& scummVar(byte var, const char *varName, const char *file, int line) {
if (var == 0xFF) {
error("Illegal access to variable %s in file %s, line %d", varName, file, line);
}
return _scummVars[var];
}
- int32 scummVar(byte var, const char *varName, const char *file, int line) const
- {
+ int32 scummVar(byte var, const char *varName, const char *file, int line) const {
if (var == 0xFF) {
error("Illegal access to variable %s in file %s, line %d", varName, file, line);
}
diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp
index e39397eded..c1167a57c1 100644
--- a/engines/scumm/smush/imuse_channel.cpp
+++ b/engines/scumm/smush/imuse_channel.cpp
@@ -158,7 +158,7 @@ void ImuseChannel::decode() {
_sbufferSize -= remaining_size;
} else {
debugC(DEBUG_SMUSH, "impossible ! : %p, %d, %d, %p(%d), %p(%d, %d)",
- this, _dataSize, _inData, _tbuffer, _tbufferSize, _sbuffer, _sbufferSize, _srbufferSize);
+ (const void *)this, _dataSize, _inData, _tbuffer, _tbufferSize, _sbuffer, _sbufferSize, _srbufferSize);
byte *old = _tbuffer;
int new_size = remaining_size + _tbufferSize;
_tbuffer = new byte[new_size];
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index bc3ca00571..ad48029bd2 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1710,7 +1710,7 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, in
} else {
dw = 500000 * 256 / ticks;
}
- debugC(DEBUG_SOUND, " ticks = %d, speed = %ld", ticks, dw);
+ debugC(DEBUG_SOUND, " ticks = %d, speed = %d", ticks, dw);
// Write a tempo change Meta event
memcpy(ptr, "\x00\xFF\x51\x03", 4); ptr += 4;
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index 764f3de9dd..4b5887da69 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -1115,7 +1115,7 @@ void Control::doAutoSave(void) {
outf->finalize();
if (outf->err())
- displayMessage(0, "Unable to write autosave file '%s'. Disk full?", fName, _saveFileMan->popErrorDesc().c_str());
+ displayMessage(0, "Unable to write autosave file '%s'. Disk full? (%s)", fName, _saveFileMan->popErrorDesc().c_str());
delete outf;
free(saveData);
diff --git a/engines/sky/control.h b/engines/sky/control.h
index 2a3a229cb3..04ed26fefe 100644
--- a/engines/sky/control.h
+++ b/engines/sky/control.h
@@ -198,7 +198,7 @@ public:
void saveDescriptions(const Common::StringList &list);
private:
- int displayMessage(const char *altButton, const char *message, ...);
+ int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);
void initPanel(void);
void removePanel(void);
diff --git a/engines/sword1/control.h b/engines/sword1/control.h
index d6adc61c3a..0193afc7f1 100644
--- a/engines/sword1/control.h
+++ b/engines/sword1/control.h
@@ -101,7 +101,7 @@ public:
}
private:
- int displayMessage(const char *altButton, const char *message, ...);
+ int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);
bool convertSaveGame(uint8 slot, char* desc);
void showSavegameNames(void);