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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jul 3 12:40:49 CEST 2009


Revision: 42054
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42054&view=rev
Author:   fingolfin
Date:     2009-07-03 10:40:49 +0000 (Fri, 03 Jul 2009)

Log Message:
-----------
Added more GCC_PRINTF attributes, and fixed resulting warnings in format strings

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/script_e1.cpp
    scummvm/trunk/engines/groovie/script.cpp
    scummvm/trunk/engines/kyra/screen_lol.h
    scummvm/trunk/engines/kyra/text_lol.h
    scummvm/trunk/engines/lure/lure.h
    scummvm/trunk/engines/scumm/he/resource_he.cpp
    scummvm/trunk/engines/scumm/he/script_v71he.cpp
    scummvm/trunk/engines/scumm/resource.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/smush/imuse_channel.cpp
    scummvm/trunk/engines/scumm/sound.cpp
    scummvm/trunk/engines/sky/control.cpp
    scummvm/trunk/engines/sky/control.h
    scummvm/trunk/engines/sword1/control.h
    scummvm/trunk/gui/console.h

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/agos/agos.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -673,7 +673,7 @@
 	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();

Modified: scummvm/trunk/engines/agos/script_e1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e1.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/agos/script_e1.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -532,7 +532,7 @@
 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() {

Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/groovie/script.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -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 @@
 		}
 	}
 	if (fileref != _videoRef) {
-		debugScript(1, true, "");
+		debugScript(1, false, "\n");
 	}
 	// Play the video
 	if (!playvideofromref(fileref)) {
@@ -569,7 +571,7 @@
 			_eventKbdChar = 0;
 
 			// Newline
-			debugScript(1, true, "");
+			debugScript(1, false, "\n");
 		}
 
 		// Let the caller know if the video has ended
@@ -759,7 +761,7 @@
 		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 @@
 
 		varnum++;
 	} while (!_firstbit);
-	debugScript(1, true, "");
+	debugScript(1, false, "\n");
 }
 
 void Script::o_vdxtransition() {		// 0x1C
@@ -1095,7 +1097,7 @@
 		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() {

Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/kyra/screen_lol.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -46,8 +46,8 @@
 	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);

Modified: scummvm/trunk/engines/kyra/text_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/text_lol.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/kyra/text_lol.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -47,7 +47,7 @@
 	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;
 

Modified: scummvm/trunk/engines/lure/lure.h
===================================================================
--- scummvm/trunk/engines/lure/lure.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/lure/lure.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -91,7 +91,7 @@
 	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;

Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -913,7 +913,7 @@
 				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);

Modified: scummvm/trunk/engines/scumm/he/script_v71he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v71he.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/scumm/he/script_v71he.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -59,7 +59,7 @@
 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;

Modified: scummvm/trunk/engines/scumm/resource.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/scumm/resource.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -1372,7 +1372,7 @@
 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) {

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/scumm/scumm.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -128,7 +128,7 @@
 };
 
 /* 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 @@
 	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 @@
 	// 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);
 		}

Modified: scummvm/trunk/engines/scumm/smush/imuse_channel.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/imuse_channel.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/scumm/smush/imuse_channel.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -158,7 +158,7 @@
 			_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];

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/scumm/sound.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -1710,7 +1710,7 @@
 		} 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;

Modified: scummvm/trunk/engines/sky/control.cpp
===================================================================
--- scummvm/trunk/engines/sky/control.cpp	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/sky/control.cpp	2009-07-03 10:40:49 UTC (rev 42054)
@@ -1115,7 +1115,7 @@
 	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);

Modified: scummvm/trunk/engines/sky/control.h
===================================================================
--- scummvm/trunk/engines/sky/control.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/sky/control.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -198,7 +198,7 @@
 	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);

Modified: scummvm/trunk/engines/sword1/control.h
===================================================================
--- scummvm/trunk/engines/sword1/control.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/engines/sword1/control.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -101,7 +101,7 @@
 	}
 
 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);

Modified: scummvm/trunk/gui/console.h
===================================================================
--- scummvm/trunk/gui/console.h	2009-07-03 10:20:08 UTC (rev 42053)
+++ scummvm/trunk/gui/console.h	2009-07-03 10:40:49 UTC (rev 42054)
@@ -143,7 +143,7 @@
 	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);


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