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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Jul 1 22:51:34 CEST 2009


Revision: 42010
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42010&view=rev
Author:   fingolfin
Date:     2009-07-01 20:51:34 +0000 (Wed, 01 Jul 2009)

Log Message:
-----------
Fixed some more warnings observed on buildbot

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/feeble.cpp
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/subroutine.cpp
    scummvm/trunk/engines/queen/command.cpp
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/scumm/object.cpp
    scummvm/trunk/engines/scumm/palette.cpp
    scummvm/trunk/engines/scumm/resource.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/agos/agos.h	2009-07-01 20:51:34 UTC (rev 42010)
@@ -615,8 +615,8 @@
 
 	void paletteFadeOut(byte *palPtr, uint num, uint size);
 
-	byte *allocateItem(uint size);
-	byte *allocateTable(uint size);
+	void *allocateItem(uint size);
+	void *allocateTable(uint size);
 	void alignTableMem();
 
 	Child *findChildOfType(Item *i, uint child);

Modified: scummvm/trunk/engines/agos/feeble.cpp
===================================================================
--- scummvm/trunk/engines/agos/feeble.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/agos/feeble.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -161,22 +161,17 @@
 	playVideo("fbye1.smk", true);
 
 	HitArea *ha;
-	while (!shouldQuit()) {
+	do {
 		_lastHitArea = NULL;
 		_lastHitArea3 = NULL;
 
-		while (!shouldQuit()) {
-			if (_lastHitArea3 != 0)
-				break;
+		while (!shouldQuit() && _lastHitArea3 == 0) {
 			delay(1);
 		}
 
 		ha = _lastHitArea;
+	} while (!shouldQuit() && !(ha != NULL && ha->id == 21));
 
-		if (ha != NULL && ha->id == 21)
-			break;
-	}
-
 	playVideo("fbye2.smk");
 	quitGame();
 	delay(0);
@@ -202,9 +197,7 @@
 		_lastHitArea = NULL;
 		_lastHitArea3 = NULL;
 
-		while (!shouldQuit()) {
-			if (_lastHitArea3 != 0)
-				break;
+		while (!shouldQuit() && _lastHitArea3 == 0) {
 			handleWobble();
 			delay(1);
 		}
@@ -287,25 +280,23 @@
 
 	startInteractiveVideo("mainmenu.smk");
 
-	HitArea *ha;
-	while (!shouldQuit()) {
+	HitArea *ha = 0;
+	do {
 		_lastHitArea = NULL;
 		_lastHitArea3 = NULL;
 
-		while (!shouldQuit()) {
-			if (_lastHitArea3 != 0)
-				break;
+		while (_lastHitArea3 == 0) {
+			if (shouldQuit())
+				return;
 			handleText();
 			delay(1);
 		}
 
 		ha = _lastHitArea;
+	} while (ha == NULL || !(ha->id >= 1 && ha->id <= 6));
 
-		if (ha == NULL) {
-		} else if (ha->id >= 1 && ha->id <= 6) {
-			break;
-		}
-	}
+	if (shouldQuit())
+		return;
 
 	stopInteractiveVideo();
 
@@ -384,11 +375,9 @@
 		windowPutChar(_textWindow, *message);
 
 	mouseOff();
-	while (!shouldQuit()) {
+	do {
 		delay(1);
-		if (_keyPressed.keycode == Common::KEYCODE_SPACE)
-			break;
-	}
+	} while (!shouldQuit() && (_keyPressed.keycode != Common::KEYCODE_SPACE));
 	_keyPressed.reset();
 	mouseOn();
 }

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/agos/items.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -41,7 +41,7 @@
 	return child;
 }
 
-byte *AGOSEngine::allocateItem(uint size) {
+void *AGOSEngine::allocateItem(uint size) {
 	byte *item = new byte[size];
 
 	memset(item, 0, size);

Modified: scummvm/trunk/engines/agos/subroutine.cpp
===================================================================
--- scummvm/trunk/engines/agos/subroutine.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/agos/subroutine.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -226,7 +226,7 @@
 	}
 }
 
-byte *AGOSEngine::allocateTable(uint size) {
+void *AGOSEngine::allocateTable(uint size) {
 	byte *org = _tablesHeapPtr;
 
 	size = (size + 1) & ~1;

Modified: scummvm/trunk/engines/queen/command.cpp
===================================================================
--- scummvm/trunk/engines/queen/command.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/queen/command.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -123,7 +123,7 @@
 	virtual void displayTemp(InkColor color, const char *name, bool outlined) {
 		char temp[MAX_COMMAND_LEN];
 		// don't show a space after the goto and give commands in the Greek version
-		if (_command[1] != -34 && !(_command[1] == -2 && strlen(_command) > 5))
+		if (_command[1] != (char)-34 && !(_command[1] == (char)-2 && strlen(_command) > 5))
 			sprintf(temp, "%s %s", _command, name);
 		else
 			sprintf(temp, "%s%s", _command, name);
@@ -132,7 +132,7 @@
 
 	virtual void addObject(const char *objName) {
 		// don't show a space after the goto and give commands in the Greek version
-		if (_command[1] != -34 && !(_command[1] == -2 && strlen(_command) > 5))
+		if (_command[1] != (char)-34 && !(_command[1] == (char)-2 && strlen(_command) > 5))
 			strcat(_command, " ");
 		strcat(_command, objName);
 	}

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/sci/resource.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -711,7 +711,7 @@
 int ResourceManager::detectMapVersion() {
 	Common::File file;
 	byte buff[6];
-	ResourceSource *rsrc;
+	ResourceSource *rsrc= 0;
 
 	for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
 		rsrc = *it;

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -1130,7 +1130,7 @@
 
 Audio::AudioStream* SfxState::getAudioStream(uint32 number, uint32 volume, int *sampleLen) {
 	Audio::AudioStream *audioStream = 0;
-	uint32 size;
+	uint32 size = 0;
 	byte *data = 0;
 	byte flags = 0;
 	Sci::Resource* audioRes;

Modified: scummvm/trunk/engines/scumm/object.cpp
===================================================================
--- scummvm/trunk/engines/scumm/object.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/scumm/object.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -1816,9 +1816,8 @@
 	assert(flob);
 
 	// Copy object code + object image to floating object
-	((uint32 *)flob)[0] = MKID_BE('FLOB');
-	((uint32 *)flob)[1] = TO_BE_32(flob_size);
-
+	WRITE_UINT32(flob, MKID_BE('FLOB'));
+	WRITE_BE_UINT32(flob + 4, flob_size);
 	memcpy(flob + 8, foir.obcd, obcd_size);
 	memcpy(flob + 8 + obcd_size, foir.obim, obim_size);
 

Modified: scummvm/trunk/engines/scumm/palette.cpp
===================================================================
--- scummvm/trunk/engines/scumm/palette.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/scumm/palette.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -470,13 +470,9 @@
 }
 
 void ScummEngine::palManipulateInit(int resID, int start, int end, int time) {
-	byte *pal, *target, *between;
-	byte *string1, *string2, *string3;
-	int i;
-
-	string1 = getStringAddress(resID);
-	string2 = getStringAddress(resID + 1);
-	string3 = getStringAddress(resID + 2);
+	byte *string1 = getStringAddress(resID);
+	byte *string2 = getStringAddress(resID + 1);
+	byte *string3 = getStringAddress(resID + 2);
 	if (!string1 || !string2 || !string3) {
 		error("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d",
 				resID, start, end, time, resID, resID + 1, resID + 2);
@@ -496,29 +492,24 @@
 	if (!_palManipIntermediatePal)
 		_palManipIntermediatePal = (byte *)calloc(0x600, 1);
 
-	pal = _currentPalette + start * 3;
-	target = _palManipPalette + start * 3;
-	between = _palManipIntermediatePal + start * 6;
+	byte *pal = _currentPalette + start * 3;
+	byte *target = _palManipPalette + start * 3;
+	uint16 *between = (uint16 *)(_palManipIntermediatePal + start * 6);
 
-	for (i = start; i < end; ++i) {
+	for (int i = start; i < end; ++i) {
 		*target++ = *string1++;
 		*target++ = *string2++;
 		*target++ = *string3++;
-		*(uint16 *)between = ((uint16) *pal++) << 8;
-		between += 2;
-		*(uint16 *)between = ((uint16) *pal++) << 8;
-		between += 2;
-		*(uint16 *)between = ((uint16) *pal++) << 8;
-		between += 2;
+		*between++ = ((uint16) *pal++) << 8;
+		*between++ = ((uint16) *pal++) << 8;
+		*between++ = ((uint16) *pal++) << 8;
 	}
 
 	_palManipCounter = time;
 }
 
 void ScummEngine_v6::palManipulateInit(int resID, int start, int end, int time) {
-	byte *pal, *target, *between;
 	const byte *new_pal;
-	int i;
 
 	new_pal = getPalettePtr(resID, _roomResource);
 
@@ -533,20 +524,17 @@
 	if (!_palManipIntermediatePal)
 		_palManipIntermediatePal = (byte *)calloc(0x600, 1);
 
-	pal = _currentPalette + start * 3;
-	target = _palManipPalette + start * 3;
-	between = _palManipIntermediatePal + start * 6;
+	byte *pal = _currentPalette + start * 3;
+	byte *target = _palManipPalette + start * 3;
+	uint16 *between = (uint16 *)(_palManipIntermediatePal + start * 6);
 
-	for (i = start; i < end; ++i) {
+	for (int i = start; i < end; ++i) {
 		*target++ = *new_pal++;
 		*target++ = *new_pal++;
 		*target++ = *new_pal++;
-		*(uint16 *)between = ((uint16) *pal++) << 8;
-		between += 2;
-		*(uint16 *)between = ((uint16) *pal++) << 8;
-		between += 2;
-		*(uint16 *)between = ((uint16) *pal++) << 8;
-		between += 2;
+		*between++ = ((uint16) *pal++) << 8;
+		*between++ = ((uint16) *pal++) << 8;
+		*between++ = ((uint16) *pal++) << 8;
 	}
 
 	_palManipCounter = time;
@@ -554,26 +542,24 @@
 
 
 void ScummEngine::palManipulate() {
-	byte *target, *pal, *between;
-	int i, j;
-
 	if (!_palManipCounter || !_palManipPalette || !_palManipIntermediatePal)
 		return;
 
-	target = _palManipPalette + _palManipStart * 3;
-	pal = _currentPalette + _palManipStart * 3;
-	between = _palManipIntermediatePal + _palManipStart * 6;
+	byte *target = _palManipPalette + _palManipStart * 3;
+	byte *pal = _currentPalette + _palManipStart * 3;
+	uint16 *between = (uint16 *)(_palManipIntermediatePal + _palManipStart * 6);
 
-	for (i = _palManipStart; i < _palManipEnd; ++i) {
-		j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter);
+	for (int i = _palManipStart; i < _palManipEnd; ++i) {
+		int j;
+		j = (*between += ((*target++ << 8) - *between) / _palManipCounter);
 		*pal++ = j >> 8;
-		between += 2;
-		j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter);
+		between++;
+		j = (*between += ((*target++ << 8) - *between) / _palManipCounter);
 		*pal++ = j >> 8;
-		between += 2;
-		j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter);
+		between++;
+		j = (*between += ((*target++ << 8) - *between) / _palManipCounter);
 		*pal++ = j >> 8;
-		between += 2;
+		between++;
 	}
 	setDirtyColors(_palManipStart, _palManipEnd);
 	_palManipCounter--;

Modified: scummvm/trunk/engines/scumm/resource.cpp
===================================================================
--- scummvm/trunk/engines/scumm/resource.cpp	2009-07-01 20:51:04 UTC (rev 42009)
+++ scummvm/trunk/engines/scumm/resource.cpp	2009-07-01 20:51:34 UTC (rev 42010)
@@ -787,8 +787,6 @@
 #define SAFETY_AREA 2
 
 byte *ResourceManager::createResource(int type, int idx, uint32 size) {
-	byte *ptr;
-
 	debugC(DEBUG_RESOURCE, "_res->createResource(%s,%d,%d)", resTypeFromId(type), idx, size);
 
 	if (!validateResource("allocating", type, idx))
@@ -807,17 +805,17 @@
 
 	expireResources(size);
 
-	ptr = (byte *)calloc(size + sizeof(MemBlkHeader) + SAFETY_AREA, 1);
+	void *ptr = calloc(size + sizeof(MemBlkHeader) + SAFETY_AREA, 1);
 	if (ptr == NULL) {
 		error("createResource(%s,%d): Out of memory while allocating %d", resTypeFromId(type), idx, size);
 	}
 
 	_allocatedSize += size;
 
-	address[type][idx] = ptr;
+	address[type][idx] = (byte *)ptr;
 	((MemBlkHeader *)ptr)->size = size;
 	setResourceCounter(type, idx, 1);
-	return ptr + sizeof(MemBlkHeader);	/* skip header */
+	return (byte *)ptr + sizeof(MemBlkHeader);	/* skip header */
 }
 
 ResourceManager::ResourceManager(ScummEngine *vm) {


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