[Scummvm-cvs-logs] SF.net SVN: scummvm: [29975] scummvm/trunk/engines/scumm/sound.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Dec 24 15:40:39 CET 2007


Revision: 29975
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29975&view=rev
Author:   fingolfin
Date:     2007-12-24 06:40:39 -0800 (Mon, 24 Dec 2007)

Log Message:
-----------
cleanup; workaround for bug #1852635 (INDY3 Mac: Crash When Playing Sound 54)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/sound.cpp

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2007-12-24 14:20:53 UTC (rev 29974)
+++ scummvm/trunk/engines/scumm/sound.cpp	2007-12-24 14:40:39 UTC (rev 29975)
@@ -160,7 +160,6 @@
 }
 
 void Sound::playSound(int soundID) {
-	byte *mallocedPtr = NULL;
 	byte *ptr;
 	char *sound;
 	int size = -1;
@@ -352,7 +351,6 @@
 			ptr += 0x16;
 
 			if (soundID == _currentCDSound && pollCD() == 1) {
-				free(mallocedPtr);
 				return;
 			}
 
@@ -397,9 +395,12 @@
 	}
 	else if ((_vm->_game.platform == Common::kPlatformMacintosh) && (_vm->_game.id == GID_INDY3) && (ptr[26] == 0)) {
 		size = READ_BE_UINT16(ptr + 12);
+		if (size == 0)	// WORKAROUND bug #1852635: Sound 54 has size 0.
+			return;
 		rate = 3579545 / READ_BE_UINT16(ptr + 20);
 		sound = (char *)malloc(size);
 		int vol = ptr[24] * 4;
+
 		memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size);
 		_mixer->playRaw(Audio::Mixer::kSFXSoundType, NULL, sound, size, rate, Audio::Mixer::FLAG_AUTOFREE, soundID, vol, 0);
 	}
@@ -441,8 +442,6 @@
 			_vm->_musicEngine->startSound(soundID);
 		}
 	}
-
-	free(mallocedPtr);
 }
 
 void Sound::processSfxQueues() {


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