Added more GCC_PRINTF attributes, and fixed resulting warnings in format strings

svn-id: r42054
This commit is contained in:
Max Horn 2009-07-03 10:40:49 +00:00
parent 9664050ff0
commit cbea1a1193
16 changed files with 27 additions and 27 deletions

View File

@ -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();

View File

@ -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() {

View File

@ -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() {

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}

View File

@ -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];

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -143,7 +143,7 @@ public:
void handleKeyDown(Common::KeyState state);
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
int printf(const char *format, ...);
int printf(const char *format, ...) GCC_PRINTF(2, 3);
int vprintf(const char *format, va_list argptr);
#undef putchar
void putchar(int c);