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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sun Jan 3 20:37:50 CET 2010


Revision: 46941
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46941&view=rev
Author:   eriktorbjorn
Date:     2010-01-03 19:37:43 +0000 (Sun, 03 Jan 2010)

Log Message:
-----------
Fixed a bunch of cppcheck warnings. Mostly about checking if a pointer is null
before freeing it, which isn't necessary.

Modified Paths:
--------------
    scummvm/trunk/backends/keymapper/keymap.cpp
    scummvm/trunk/backends/keymapper/keymapper.cpp
    scummvm/trunk/backends/keymapper/remap-dialog.cpp
    scummvm/trunk/backends/midi/timidity.cpp
    scummvm/trunk/common/EventDispatcher.cpp
    scummvm/trunk/common/EventRecorder.cpp
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/detection.cpp
    scummvm/trunk/engines/agos/saveload.cpp
    scummvm/trunk/engines/cine/object.cpp
    scummvm/trunk/engines/cruise/detection.cpp
    scummvm/trunk/engines/cruise/saveload.cpp
    scummvm/trunk/engines/groovie/detection.cpp
    scummvm/trunk/engines/kyra/script_lol.cpp
    scummvm/trunk/engines/lure/animseq.cpp
    scummvm/trunk/engines/lure/disk.cpp
    scummvm/trunk/engines/lure/fights.cpp
    scummvm/trunk/engines/lure/hotspots.cpp
    scummvm/trunk/engines/lure/intro.cpp
    scummvm/trunk/engines/lure/menu.cpp
    scummvm/trunk/engines/lure/res_struct.cpp
    scummvm/trunk/engines/lure/room.cpp
    scummvm/trunk/engines/lure/sound.cpp
    scummvm/trunk/engines/m4/actor.cpp
    scummvm/trunk/engines/m4/events.cpp
    scummvm/trunk/engines/m4/globals.cpp
    scummvm/trunk/engines/m4/gui.cpp
    scummvm/trunk/engines/m4/m4_menus.cpp
    scummvm/trunk/engines/m4/mads_anim.cpp
    scummvm/trunk/engines/m4/mads_menus.cpp
    scummvm/trunk/engines/m4/midi.cpp
    scummvm/trunk/engines/m4/scene.cpp
    scummvm/trunk/engines/m4/script.cpp
    scummvm/trunk/engines/m4/woodscript.cpp
    scummvm/trunk/engines/made/database.cpp
    scummvm/trunk/engines/made/pmvplayer.cpp
    scummvm/trunk/engines/made/resource.cpp
    scummvm/trunk/engines/parallaction/gui.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
    scummvm/trunk/engines/sci/gui/gui_animate.cpp
    scummvm/trunk/engines/sci/gui/gui_text.cpp
    scummvm/trunk/engines/sci/gui32/res_pal.cpp
    scummvm/trunk/engines/sci/sfx/music.cpp
    scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp
    scummvm/trunk/engines/scumm/file.cpp
    scummvm/trunk/engines/scumm/he/resource_he.cpp
    scummvm/trunk/engines/scumm/imuse/imuse_player.cpp
    scummvm/trunk/engines/scumm/imuse/instrument.cpp
    scummvm/trunk/engines/scumm/smush/smush_player.cpp
    scummvm/trunk/engines/sky/control.cpp
    scummvm/trunk/engines/sky/detection.cpp
    scummvm/trunk/engines/sky/intro.cpp
    scummvm/trunk/engines/sky/music/musicbase.cpp
    scummvm/trunk/engines/sky/screen.cpp
    scummvm/trunk/engines/sky/sound.cpp
    scummvm/trunk/engines/sky/text.cpp
    scummvm/trunk/engines/sword1/resman.cpp
    scummvm/trunk/engines/sword1/screen.cpp
    scummvm/trunk/sound/midiparser_smf.cpp
    scummvm/trunk/sound/mods/infogrames.cpp
    scummvm/trunk/sound/softsynth/mt32/synth.cpp
    scummvm/trunk/sound/softsynth/mt32.cpp

Modified: scummvm/trunk/backends/keymapper/keymap.cpp
===================================================================
--- scummvm/trunk/backends/keymapper/keymap.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/backends/keymapper/keymap.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -36,7 +36,7 @@
 Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDomain(0) {
 	List<Action*>::iterator it;
 
-	for (it = _actions.begin(); it != _actions.end(); it++) {
+	for (it = _actions.begin(); it != _actions.end(); ++it) {
 		const HardwareKey *hwKey = (*it)->getMappedKey();
 
 		if (hwKey) {
@@ -48,7 +48,7 @@
 Keymap::~Keymap() {
 	List<Action*>::iterator it;
 
-	for (it = _actions.begin(); it != _actions.end(); it++)
+	for (it = _actions.begin(); it != _actions.end(); ++it)
 		delete *it;
 }
 
@@ -87,7 +87,7 @@
 Action *Keymap::findAction(const char *id) {
 	List<Action*>::iterator it;
 
-	for (it = _actions.begin(); it != _actions.end(); it++) {
+	for (it = _actions.begin(); it != _actions.end(); ++it) {
 		if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
 			return *it;
 	}
@@ -97,7 +97,7 @@
 const Action *Keymap::findAction(const char *id) const {
 	List<Action*>::const_iterator it;
 
-	for (it = _actions.begin(); it != _actions.end(); it++) {
+	for (it = _actions.begin(); it != _actions.end(); ++it) {
 		if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
 			return *it;
 	}
@@ -127,7 +127,7 @@
 	ConfigManager::Domain::iterator it;
 	String prefix = KEYMAP_KEY_PREFIX + _name + "_";
 
-	for (it = _configDomain->begin(); it != _configDomain->end(); it++) {
+	for (it = _configDomain->begin(); it != _configDomain->end(); ++it) {
 		const String& key = it->_key;
 
 		if (!key.hasPrefix(prefix.c_str()))
@@ -164,7 +164,7 @@
 	List<Action*>::const_iterator it;
 	String prefix = KEYMAP_KEY_PREFIX + _name + "_";
 
-	for (it = _actions.begin(); it != _actions.end(); it++) {
+	for (it = _actions.begin(); it != _actions.end(); ++it) {
 		uint actIdLen = strlen((*it)->id);
 
 		actIdLen = (actIdLen > ACTION_ID_SIZE) ? ACTION_ID_SIZE : actIdLen;
@@ -186,7 +186,7 @@
 	bool allMapped = true;
 	uint numberMapped = 0;
 
-	for (it = _actions.begin(); it != _actions.end(); it++) {
+	for (it = _actions.begin(); it != _actions.end(); ++it) {
 		if ((*it)->getMappedKey()) {
 			numberMapped++;
 		} else {

Modified: scummvm/trunk/backends/keymapper/keymapper.cpp
===================================================================
--- scummvm/trunk/backends/keymapper/keymapper.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/backends/keymapper/keymapper.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -41,7 +41,7 @@
 }
 
 void Keymapper::Domain::deleteAllKeyMaps() {
-	for (iterator it = begin(); it != end(); it++)
+	for (iterator it = begin(); it != end(); ++it)
 		delete it->_value;
 
 	clear();

Modified: scummvm/trunk/backends/keymapper/remap-dialog.cpp
===================================================================
--- scummvm/trunk/backends/keymapper/remap-dialog.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/backends/keymapper/remap-dialog.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -94,7 +94,7 @@
 	if (_globalKeymaps) {
 		if (divider)
 			_kmPopUp->appendEntry("");
-		for (it = _globalKeymaps->begin(); it != _globalKeymaps->end(); it++) {
+		for (it = _globalKeymaps->begin(); it != _globalKeymaps->end(); ++it) {
 			_kmPopUp->appendEntry(it->_value->getName() + " (Global)", idx);
 			_keymapTable[idx++] = it->_value;
 		}
@@ -104,7 +104,7 @@
 	if (_gameKeymaps) {
 		if (divider)
 			_kmPopUp->appendEntry("");
-		for (it = _gameKeymaps->begin(); it != _gameKeymaps->end(); it++) {
+		for (it = _gameKeymaps->begin(); it != _gameKeymaps->end(); ++it) {
 			_kmPopUp->appendEntry(it->_value->getName() + " (Game)", idx);
 			_keymapTable[idx++] = it->_value;
 		}
@@ -317,7 +317,7 @@
 
 		List<Action*>::iterator it;
 
-		for (it = km->getActions().begin(); it != km->getActions().end(); it++) {
+		for (it = km->getActions().begin(); it != km->getActions().end(); ++it) {
 			ActionInfo info = {*it, false, (*it)->description};
 
 			_currentActions.push_back(info);

Modified: scummvm/trunk/backends/midi/timidity.cpp
===================================================================
--- scummvm/trunk/backends/midi/timidity.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/backends/midi/timidity.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -320,13 +320,12 @@
 char *MidiDriver_TIMIDITY::timidity_ctl_command(const char *fmt, ...) {
 	/* XXX: I don't like this static buffer!!! */
 	static char buff[BUFSIZ];
-	int status, len;
 	va_list ap;
 
 	if (fmt != NULL) {
 		/* if argumends are present, write them to control connection */
 		va_start(ap, fmt);
-		len = vsnprintf(buff, BUFSIZ-1, fmt, ap); /* leave one byte for \n */
+		int len = vsnprintf(buff, BUFSIZ-1, fmt, ap); /* leave one byte for \n */
 		va_end(ap);
 
 		/* add newline if needed */
@@ -345,7 +344,7 @@
 		}
 
 		/* report errors from server */
-		status = atoi(buff);
+		int status = atoi(buff);
 		if (400 <= status && status <= 499) { /* Error of data stream */
 			warning("TiMidity: error from server: %s", buff);
 			continue;

Modified: scummvm/trunk/common/EventDispatcher.cpp
===================================================================
--- scummvm/trunk/common/EventDispatcher.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/common/EventDispatcher.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -72,8 +72,7 @@
 }
 
 void EventDispatcher::registerMapper(EventMapper *mapper) {
-	if (_mapper)
-		delete _mapper;
+	delete _mapper;
 	_mapper = mapper;
 }
 

Modified: scummvm/trunk/common/EventRecorder.cpp
===================================================================
--- scummvm/trunk/common/EventRecorder.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/common/EventRecorder.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -203,12 +203,8 @@
 	g_system->unlockMutex(_timeMutex);
 	g_system->unlockMutex(_recorderMutex);
 
-	if (_playbackFile != NULL) {
-		delete _playbackFile;
-	}
-	if (_playbackTimeFile != NULL) {
-		delete _playbackTimeFile;
-	}
+	delete _playbackFile;
+	delete _playbackTimeFile;
 
 	if (_recordFile != NULL) {
 		_recordFile->finalize();

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/agos/agos.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -894,8 +894,7 @@
 		delete _gameFile;
 
 	_midi.close();
-	if (_driver)
-		delete _driver;
+	delete _driver;
 
 	AudioCD.stop();
 

Modified: scummvm/trunk/engines/agos/detection.cpp
===================================================================
--- scummvm/trunk/engines/agos/detection.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/agos/detection.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -194,7 +194,7 @@
 	sort(filenames.begin(), filenames.end());	// Sort (hopefully ensuring we are sorted numerically..)
 
 	SaveStateList saveList;
-	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
 		// Obtain the last 3 digits of the filename, since they correspond to the save slot
 		int slotNum = atoi(file->c_str() + file->size() - 3);
 

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/agos/saveload.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -49,7 +49,7 @@
 	memset(marks, false, 256 * sizeof(bool));	//assume no savegames for this title
 	filenames = _saveFileMan->listSavefiles(prefix);
 
-	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
+	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file){
 		//Obtain the last 3 digits of the filename, since they correspond to the save slot
 		slot[0] = file->c_str()[file->size()-3];
 		slot[1] = file->c_str()[file->size()-2];

Modified: scummvm/trunk/engines/cine/object.cpp
===================================================================
--- scummvm/trunk/engines/cine/object.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/cine/object.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -40,7 +40,7 @@
 
 /*! \brief Resets all elements in the object table. */
 void resetObjectTable() {
-	for (Common::Array<ObjectStruct>::iterator it = objectTable.begin(); it != objectTable.end(); it++) {
+	for (Common::Array<ObjectStruct>::iterator it = objectTable.begin(); it != objectTable.end(); ++it) {
 		it->clear();
 	}
 }

Modified: scummvm/trunk/engines/cruise/detection.cpp
===================================================================
--- scummvm/trunk/engines/cruise/detection.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/cruise/detection.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -262,7 +262,7 @@
 				Cruise::CruiseSavegameHeader header;
 				Cruise::readSavegameHeader(in, header);
 				saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
-				if (header.thumbnail) delete header.thumbnail;
+				delete header.thumbnail;
 				delete in;
 			}
 		}

Modified: scummvm/trunk/engines/cruise/saveload.cpp
===================================================================
--- scummvm/trunk/engines/cruise/saveload.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/cruise/saveload.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -828,7 +828,7 @@
 	// Skip over the savegame header
 	CruiseSavegameHeader header;
 	readSavegameHeader(f, header);
-	if (header.thumbnail) delete header.thumbnail;
+	delete header.thumbnail;
 
 	// Synchronise the remaining data of the savegame
 	Common::Serializer s(f, NULL);

Modified: scummvm/trunk/engines/groovie/detection.cpp
===================================================================
--- scummvm/trunk/engines/groovie/detection.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/groovie/detection.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -238,10 +238,7 @@
 	SaveStateDescriptor desc;
 
 	Common::InSaveFile *savefile = SaveLoad::openForLoading(target, slot, &desc);
-	if (savefile) {
-		// Loaded correctly
-		delete savefile;
-	}
+	delete savefile;
 
 	return desc;
 }

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -2202,6 +2202,7 @@
 	WSAMovie_v2 *mov = new WSAMovie_v2(this);
 	mov->open("DARKLITE.WSA", 2, 0);
 	if (!mov->opened()) {
+		delete mov;
 		warning("LoLEngine::olol_restoreMagicShroud: Could not open file: \"DARKLITE.WSA\"");
 		return 1;
 	}

Modified: scummvm/trunk/engines/lure/animseq.cpp
===================================================================
--- scummvm/trunk/engines/lure/animseq.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/animseq.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -213,8 +213,7 @@
 }
 
 AnimationSequence::~AnimationSequence() {
-	if (_lineRefs != NULL)
-		delete _lineRefs;
+	delete _lineRefs;
 	delete _decodedData;
 
 	// Renable GMM saving/loading now that the animation is done

Modified: scummvm/trunk/engines/lure/disk.cpp
===================================================================
--- scummvm/trunk/engines/lure/disk.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/disk.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -49,7 +49,7 @@
 }
 
 Disk::~Disk() {
-	if (_fileHandle) delete _fileHandle;
+	delete _fileHandle;
 	int_disk = NULL;
 }
 

Modified: scummvm/trunk/engines/lure/fights.cpp
===================================================================
--- scummvm/trunk/engines/lure/fights.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/fights.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -49,9 +49,8 @@
 }
 
 FightsManager::~FightsManager() {
-	if (_fightData != NULL)
-		// Release the fight data
-		delete _fightData;
+	// Release the fight data
+	delete _fightData;
 }
 
 FightsManager &FightsManager::getReference() {

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -199,7 +199,7 @@
 }
 
 Hotspot::~Hotspot() {
-	if (_frames) delete _frames;
+	delete _frames;
 }
 
 void Hotspot::setAnimation(uint16 newAnimId) {

Modified: scummvm/trunk/engines/lure/intro.cpp
===================================================================
--- scummvm/trunk/engines/lure/intro.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/intro.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -131,9 +131,14 @@
 		anim = new AnimationSequence(curr_anim->resourceId,
 			isEGA ? EgaPalette : coll.getPalette(curr_anim->paletteIndex), fadeIn,
 			(curr_anim->resourceId == 0x44) ? 4 : 7);
-		if (curr_anim->initialPause != 0)
-			if (interruptableDelay(curr_anim->initialPause * 1000 / 50)) return true;
 
+		if (curr_anim->initialPause != 0) {
+			if (interruptableDelay(curr_anim->initialPause * 1000 / 50)) {
+				delete anim;
+				return true;
+			}
+		}
+
 		result = false;
 		switch (anim->show()) {
 		case ABORT_NONE:

Modified: scummvm/trunk/engines/lure/menu.cpp
===================================================================
--- scummvm/trunk/engines/lure/menu.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/menu.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -175,7 +175,7 @@
 		system.delayMillis(10);
 	}
 
-	if (_surfaceMenu) delete _surfaceMenu;
+	delete _surfaceMenu;
 
 	// Deselect the currently selected menu header
 	if (_selectedMenu)

Modified: scummvm/trunk/engines/lure/res_struct.cpp
===================================================================
--- scummvm/trunk/engines/lure/res_struct.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -150,7 +150,7 @@
 
 RoomExitData *RoomExitList::checkExits(int16 xp, int16 yp) {
 	iterator i;
-	for (i = begin(); i != end(); i++) {
+	for (i = begin(); i != end(); ++i) {
 		RoomExitData *rec = (*i).get();
 		if (rec->insideRect(xp, yp)) {
 			return rec;

Modified: scummvm/trunk/engines/lure/room.cpp
===================================================================
--- scummvm/trunk/engines/lure/room.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/room.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -116,10 +116,9 @@
 
 Room::~Room() {
 	for (int layerNum = 0; layerNum < _numLayers; ++layerNum)
-		if (_layers[layerNum])
-			delete _layers[layerNum];
+		delete _layers[layerNum];
 
-	if (_talkDialog) delete _talkDialog;
+	delete _talkDialog;
 	int_room = NULL;
 }
 

Modified: scummvm/trunk/engines/lure/sound.cpp
===================================================================
--- scummvm/trunk/engines/lure/sound.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/lure/sound.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -82,8 +82,7 @@
 	g_system->unlockMutex(_soundMutex);
 
 	delete _descs;
-	if (_soundData)
-		delete _soundData;
+	delete _soundData;
 
 	if (_driver) {
 		_driver->close();
@@ -641,8 +640,7 @@
 	_parser->unloadMusic();
 	delete _parser;
 	this->close();
-	if (_decompressedSound != NULL)
-		delete _decompressedSound;
+	delete _decompressedSound;
 }
 
 void MidiMusic::setVolume(int volume) {

Modified: scummvm/trunk/engines/m4/actor.cpp
===================================================================
--- scummvm/trunk/engines/m4/actor.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/actor.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -95,8 +95,7 @@
 			continue;	// walker sprite 6 is unused
 		SpriteAsset *tempSprite = _walkerSprites[i];
 		_walkerSprites.remove_at(i);
-		if (tempSprite)
-			delete tempSprite;
+		delete tempSprite;
 	}
 }
 

Modified: scummvm/trunk/engines/m4/events.cpp
===================================================================
--- scummvm/trunk/engines/m4/events.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/events.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -186,8 +186,7 @@
 }
 
 Mouse::~Mouse() {
-	if (_cursorSprites)
-		delete _cursorSprites;
+	delete _cursorSprites;
 }
 
 bool Mouse::init(const char *seriesName, RGB8 *palette) {

Modified: scummvm/trunk/engines/m4/globals.cpp
===================================================================
--- scummvm/trunk/engines/m4/globals.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/globals.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -397,7 +397,7 @@
 		if (buffer[i] == '\0') buffer[i] = '\n';
 
 	_vm->res()->toss("messages.dat");
-	delete compData;
+	delete[] compData;
 
 	return (char*)buffer;
 }

Modified: scummvm/trunk/engines/m4/gui.cpp
===================================================================
--- scummvm/trunk/engines/m4/gui.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/gui.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -90,8 +90,7 @@
 }
 
 MenuObject::~MenuObject() {
-	if (_background)
-		delete _background;
+	delete _background;
 }
 
 void MenuObject::onExecute() {

Modified: scummvm/trunk/engines/m4/m4_menus.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4_menus.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/m4_menus.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -433,10 +433,8 @@
 		delete *i;
 	_menuObjects.clear();
 
-	if (_saveNames)
-		delete _saveNames;
-	if (_savegameThumbnail)
-		delete _savegameThumbnail;
+	delete _saveNames;
+	delete _savegameThumbnail;
 }
 
 bool OrionMenuView::loadSprites(const char *seriesName) {

Modified: scummvm/trunk/engines/m4/mads_anim.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/mads_anim.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -75,12 +75,9 @@
 TextviewView::~TextviewView() {
 	if (_script)
 		_vm->res()->toss(_resourceName);
-	if (_spareScreen)
-		delete _spareScreen;
-	if (_bgCurrent)
-		delete _bgCurrent;
-	if (_bgSpare)
-		delete _bgSpare;
+	delete _spareScreen;
+	delete _bgCurrent;
+	delete _bgSpare;
 }
 
 void TextviewView::reset() {

Modified: scummvm/trunk/engines/m4/mads_menus.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_menus.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/mads_menus.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -74,8 +74,7 @@
 }
 
 RexMainMenuView::~RexMainMenuView() {
-	if (_menuItem)
-		delete _menuItem;
+	delete _menuItem;
 
 	_vm->_palette->deleteRange(_bgPalData);
 
@@ -121,8 +120,7 @@
 			// Goodness knows why, but Rex has a key to restart the menuitem animations
 
 			// Delete the current menu items
-			if (_menuItem)
-				delete _menuItem;
+			delete _menuItem;
 
 			_vm->_palette->deleteRange(_bgPalData);
 			delete _bgPalData;

Modified: scummvm/trunk/engines/m4/midi.cpp
===================================================================
--- scummvm/trunk/engines/m4/midi.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/midi.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -47,9 +47,7 @@
 	stopMusic();
 	close();
 	delete _parser;
-	
-	if (_midiData)
-		free(_midiData);
+	free(_midiData);
 }
 
 void MidiPlayer::setVolume(int volume) {

Modified: scummvm/trunk/engines/m4/scene.cpp
===================================================================
--- scummvm/trunk/engines/m4/scene.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/scene.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -73,21 +73,13 @@
 
 	delete _backgroundSurface;
 	delete _codeSurface;
+	delete _sceneSprites;
 
-	if (_sceneSprites)
-		delete _sceneSprites;
-
 //	_vm->_palette->deleteAllRanges();
 
-	if (_palData)
-		delete _palData;
-
-	if (_interfacePal)
-		delete _interfacePal;
-
-	if (_inverseColorTable)
-		delete[] _inverseColorTable;
-
+	delete _palData;
+	delete _interfacePal;
+	delete[] _inverseColorTable;
 }
 
 void Scene::loadScene(int sceneNumber) {
@@ -284,8 +276,7 @@
 	if (_vm->isM4()) {
 		sprintf(filename, "%i.ipl", sceneNumber);
 		iplS = _vm->res()->openFile(filename);
-		if (_inverseColorTable)
-			delete[] _inverseColorTable;
+		delete[] _inverseColorTable;
 		_inverseColorTable = new byte[iplS->size()];
 		iplS->read(_inverseColorTable, iplS->size());
 		_vm->res()->toss(filename);

Modified: scummvm/trunk/engines/m4/script.cpp
===================================================================
--- scummvm/trunk/engines/m4/script.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/script.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -101,8 +101,7 @@
 }
 
 StringTable::~StringTable() {
-	if (_stringsData)
-		delete[] _stringsData;
+	delete[] _stringsData;
 }
 
 void StringTable::load(Common::File *fd) {
@@ -191,8 +190,7 @@
 }
 
 ScriptFunction::~ScriptFunction() {
-	if (_code)
-		delete _code;
+	delete _code;
 }
 
 void ScriptFunction::load(Common::File *fd) {
@@ -293,9 +291,7 @@
 }
 
 void ScriptInterpreter::close() {
-	if (_scriptFile) {
-		delete _scriptFile;
-	}
+	delete _scriptFile;
 }
 
 void ScriptInterpreter::initScriptKernel() {

Modified: scummvm/trunk/engines/m4/woodscript.cpp
===================================================================
--- scummvm/trunk/engines/m4/woodscript.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/m4/woodscript.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -180,7 +180,7 @@
 
 void WoodScript::runSequencePrograms() {
 	// A lot TODO
-	for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); it++) {
+	for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); ++it) {
 		Sequence *sequence = *it;
 		if (sequence->isActive()) {
 			sequence->runProgram();

Modified: scummvm/trunk/engines/made/database.cpp
===================================================================
--- scummvm/trunk/engines/made/database.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/made/database.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -255,8 +255,7 @@
 }
 
 GameDatabase::~GameDatabase() {
-	if (_gameState)
-		delete[] _gameState;
+	delete[] _gameState;
 }
 
 void GameDatabase::open(const char *filename) {
@@ -388,8 +387,7 @@
 }
 
 GameDatabaseV2::~GameDatabaseV2() {
-	if (_gameText)
-		delete[] _gameText;
+	delete[] _gameText;
 }
 
 void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {

Modified: scummvm/trunk/engines/made/pmvplayer.cpp
===================================================================
--- scummvm/trunk/engines/made/pmvplayer.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/made/pmvplayer.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -115,9 +115,7 @@
 
 		// Only reallocate the frame data buffer if its size has changed
 		if (prevChunkSize != chunkSize || !frameData) {
-			if (frameData)
-				delete[] frameData;
-
+			delete[] frameData;
 			frameData = new byte[chunkSize];
 		}
 

Modified: scummvm/trunk/engines/made/resource.cpp
===================================================================
--- scummvm/trunk/engines/made/resource.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/made/resource.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -310,8 +310,7 @@
 }
 
 FontResource::~FontResource() {
-	if (_data)
-		delete[] _data;
+	delete[] _data;
 }
 
 void FontResource::load(byte *source, int size) {
@@ -362,8 +361,7 @@
 }
 
 GenericResource::~GenericResource() {
-	if (_data)
-		delete[] _data;
+	delete[] _data;
 }
 
 void GenericResource::load(byte *source, int size) {

Modified: scummvm/trunk/engines/parallaction/gui.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/parallaction/gui.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -47,7 +47,7 @@
 
 MenuInputHelper::~MenuInputHelper() {
 	StateMap::iterator b = _map.begin();
-	for ( ; b != _map.end(); b++) {
+	for ( ; b != _map.end(); ++b) {
 		delete b->_value;
 	}
 	_map.clear();

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -66,11 +66,9 @@
 	pic->visual_map = NULL;
 	pic->priority_map = NULL;
 	pic->control_map = NULL;
-	if (pic->priorityTable)
-		free(pic->priorityTable);
+	free(pic->priorityTable);
 	pic->priorityTable = NULL;
-	if (pic->undithered_buffer)
-		free(pic->undithered_buffer);
+	free(pic->undithered_buffer);
 	pic->undithered_buffer = 0;
 	free(pic);
 }

Modified: scummvm/trunk/engines/sci/gui/gui_animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_animate.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sci/gui/gui_animate.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -44,10 +44,8 @@
 }
 
 SciGuiAnimate::~SciGuiAnimate() {
-	if (_listData)
-		free(_listData);
-	if (_lastCastData)
-		free(_lastCastData);
+	free(_listData);
+	free(_lastCastData);
 }
 
 void SciGuiAnimate::init() {
@@ -129,15 +127,13 @@
 
 	// Adjust list size, if needed
 	if ((_listData == NULL) || (_listCount < listCount)) {
-		if (_listData)
-			free(_listData);
+		free(_listData);
 		_listData = (GuiAnimateEntry *)malloc(listCount * sizeof(GuiAnimateEntry));
 		if (!_listData)
 			error("Could not allocate memory for _listData");
 		_listCount = listCount;
 
-		if (_lastCastData)
-			free(_lastCastData);
+		free(_lastCastData);
 		_lastCastData = (GuiAnimateEntry *)malloc(listCount * sizeof(GuiAnimateEntry));
 		if (!_lastCastData)
 			error("Could not allocate memory for _lastCastData");

Modified: scummvm/trunk/engines/sci/gui/gui_text.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_text.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sci/gui/gui_text.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -74,9 +74,7 @@
 void SciGuiText::CodeSetFonts(int argc, reg_t *argv) {
 	int i;
 
-	if (_codeFonts) {
-		delete _codeFonts;
-	}
+	delete _codeFonts;
 	_codeFontsCount = argc;
 	_codeFonts = new GuiResourceId[argc];
 	for (i = 0; i < argc; i++) {
@@ -87,9 +85,7 @@
 void SciGuiText::CodeSetColors(int argc, reg_t *argv) {
 	int i;
 
-	if (_codeColors) {
-		delete _codeColors;
-	}
+	delete _codeColors;
 	_codeColorsCount = argc;
 	_codeColors = new uint16[argc];
 	for (i = 0; i < argc; i++) {

Modified: scummvm/trunk/engines/sci/gui32/res_pal.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/res_pal.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sci/gui32/res_pal.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -125,6 +125,7 @@
 		b2 = file.readByte();
 
 		if (b1 == EOF || b2 == EOF) {
+			delete retval;
 			error("Amiga palette file ends prematurely");
 			return NULL;
 		}

Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sci/sfx/music.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -332,8 +332,7 @@
 		// play digital sample
 		if (track->digitalChannelNr != -1) {
 			byte *channelData = track->channels[track->digitalChannelNr].data;
-			if (pSnd->pStreamAud)
-				delete pSnd->pStreamAud;
+			delete pSnd->pStreamAud;
 			pSnd->pStreamAud = Audio::makeLinearInputStream(channelData, track->digitalSampleSize, track->digitalSampleRate,
 					Audio::Mixer::FLAG_UNSIGNED, 0, 0);
 			pSnd->soundType = Audio::Mixer::kSFXSoundType;

Modified: scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sci/sfx/softseq/adlib.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -238,9 +238,7 @@
 	_mixer->stopHandle(_mixerSoundHandle);
 
 	delete _opl;
-
-	if (_rhythmKeyMap)
-		delete[] _rhythmKeyMap;
+	delete[] _rhythmKeyMap;
 }
 
 void MidiDriver_Adlib::setVolume(byte volume) {

Modified: scummvm/trunk/engines/scumm/file.cpp
===================================================================
--- scummvm/trunk/engines/scumm/file.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/scumm/file.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -399,9 +399,7 @@
 
 	extractIndex(&out);
 
-	if (_stream)
-		delete _stream;
-
+	delete _stream;
 	_stream = new Common::MemoryReadStream(_buf, bufsize);
 
 	return true;

Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -983,10 +983,8 @@
 
 				}
 
-				if (row != NULL)
-					free(row);
-				if (palette != NULL)
-					free(palette);
+				free(row);
+				free(palette);
 				if (image_data != NULL) {
 					free(image_data);
 					free(mask_data);
@@ -995,10 +993,8 @@
 
 			local_cleanup:
 
-				if (row != NULL)
-					free(row);
-				if (palette != NULL)
-					free(palette);
+				free(row);
+				free(palette);
 				if (image_data != NULL) {
 					free(image_data);
 					free(mask_data);

Modified: scummvm/trunk/engines/scumm/imuse/imuse_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse/imuse_player.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/scumm/imuse/imuse_player.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -188,8 +188,7 @@
 	ptr = _se->findStartOfSound(sound);
 	if (ptr == NULL)
 		return -1;
-	if (_parser)
-		delete _parser;
+	delete _parser;
 
 	if (!memcmp(ptr, "RO", 2)) {
 		// Old style 'RO' resource

Modified: scummvm/trunk/engines/scumm/imuse/instrument.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse/instrument.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/scumm/imuse/instrument.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -273,8 +273,7 @@
 }
 
 void Instrument::clear() {
-	if (_instrument)
-		delete _instrument;
+	delete _instrument;
 	_instrument = NULL;
 	_type = itNone;
 }

Modified: scummvm/trunk/engines/scumm/smush/smush_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/scumm/smush/smush_player.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -647,12 +647,8 @@
 		error("SmushPlayer::handleTextResource. Not handled flags: %d", flags);
 	}
 
-	if (string != NULL) {
-		free (string);
-	}
-	if (string3 != NULL) {
-		free (string3);
-	}
+	free(string);
+	free(string3);
 }
 
 const char *SmushPlayer::getString(int id) {

Modified: scummvm/trunk/engines/sky/control.cpp
===================================================================
--- scummvm/trunk/engines/sky/control.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/control.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -165,8 +165,7 @@
 }
 
 ControlStatus::~ControlStatus() {
-	if (_textData)
-		free(_textData);
+	free(_textData);
 	delete _statusText;
 }
 
@@ -184,8 +183,7 @@
 }
 
 void ControlStatus::setToText(uint16 textNum) {
-	if (_textData)
-		free(_textData);
+	free(_textData);
 	DisplayedText disText = _skyText->displayText(textNum, NULL, true, STATUS_WIDTH, 255);
 	_textData = (DataFileHeader *)disText.textData;
 	_statusText->setSprite(_textData);
@@ -330,16 +328,14 @@
 void Control::buttonControl(ConResource *pButton) {
 	char autoSave[] = "Restore Autosave";
 	if (pButton == NULL) {
-		if (_textSprite)
-			free(_textSprite);
+		free(_textSprite);
 		_textSprite = NULL;
 		_curButtonText = 0;
 		_text->setSprite(NULL);
 		return;
 	}
 	if (_curButtonText != pButton->_text) {
-		if (_textSprite)
-			free(_textSprite);
+		free(_textSprite);
 		_textSprite = NULL;
 		_curButtonText = pButton->_text;
 		if (pButton->_text) {
@@ -647,8 +643,7 @@
 	}
 	_mouseClicked = false;
 	_skyMouse->spriteMouse(MOUSE_NORMAL, 0, 0);
-	if (dlgTextDat)
-		free(dlgTextDat);
+	free(dlgTextDat);
 	delete dlgText;
 	return retVal;
 }

Modified: scummvm/trunk/engines/sky/detection.cpp
===================================================================
--- scummvm/trunk/engines/sky/detection.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/detection.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -206,7 +206,7 @@
 	saveList.insert_at(0, SaveStateDescriptor(0, "*AUTOSAVE*"));
 
 	// Prepare the list of savestates by looping over all matching savefiles
-	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+	for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
 		// Extract the extension
 		Common::String ext = file->c_str() + file->size() - 3;
 		ext.toUppercase();

Modified: scummvm/trunk/engines/sky/intro.cpp
===================================================================
--- scummvm/trunk/engines/sky/intro.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/intro.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -743,8 +743,7 @@
 		return true;
 	case LOADBG:
 		_mixer->stopID(SOUND_BG);
-		if (_bgBuf)
-			free(_bgBuf);
+		free(_bgBuf);
 		_bgBuf = _skyDisk->loadFile(*data++);
 		_bgSize = _skyDisk->_lastLoadedFileSize;
 		return true;

Modified: scummvm/trunk/engines/sky/music/musicbase.cpp
===================================================================
--- scummvm/trunk/engines/sky/music/musicbase.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/music/musicbase.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -40,16 +40,14 @@
 
 MusicBase::~MusicBase() {
 	stopMusic();
-	if (_musicData)
-		free(_musicData);
+	free(_musicData);
 }
 
 void MusicBase::loadSection(uint8 pSection) {
 	_mutex.lock();
 	if (_currentMusic)
 		stopMusicInternal();
-	if (_musicData)
-		free(_musicData);
+	free(_musicData);
 	_currentSection = pSection;
 	_musicData = _skyDisk->loadFile(_driverFileBase + FILES_PER_SECTION * pSection);
 

Modified: scummvm/trunk/engines/sky/screen.cpp
===================================================================
--- scummvm/trunk/engines/sky/screen.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/screen.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -93,10 +93,8 @@
 
 Screen::~Screen() {
 	free(_gameGrid);
-	if (_currentScreen)
-		free(_currentScreen);
-	if (_scrollScreen)
-		free(_scrollScreen);
+	free(_currentScreen);
+	free(_scrollScreen);
 }
 
 void Screen::clearScreen() {
@@ -151,8 +149,7 @@
 
 void Screen::showScreen(uint16 fileNum) {
 	// This is only used for static images in the floppy and cd intro
-	if (_currentScreen)
-		free(_currentScreen);
+	free(_currentScreen);
 	_currentScreen = _skyDisk->loadFile(fileNum);
 	// make sure the last 8 lines are forced to black.
 	memset(_currentScreen + GAME_SCREEN_HEIGHT * GAME_SCREEN_WIDTH, 0, (FULL_SCREEN_HEIGHT - GAME_SCREEN_HEIGHT) * GAME_SCREEN_WIDTH);

Modified: scummvm/trunk/engines/sky/sound.cpp
===================================================================
--- scummvm/trunk/engines/sky/sound.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/sound.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -1030,8 +1030,7 @@
 
 Sound::~Sound() {
 	_mixer->stopAll();
-	if (_soundData)
-		free(_soundData);
+	free(_soundData);
 }
 
 void Sound::playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle) {
@@ -1049,8 +1048,7 @@
 	fnStopFx();
 	_mixer->stopAll();
 
-	if (_soundData)
-		free(_soundData);
+	free(_soundData);
 	_soundData = _skyDisk->loadFile(pSection * 4 + SOUND_FILE_BASE);
 	uint16 asmOfs;
 	if (SkyEngine::_systemVars.gameVersion == 109) {

Modified: scummvm/trunk/engines/sky/text.cpp
===================================================================
--- scummvm/trunk/engines/sky/text.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sky/text.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -78,12 +78,9 @@
 			SkyEngine::_itemList[i] = NULL;
 		}
 
-	if (_mainCharacterSet.addr)
-		free(_mainCharacterSet.addr);
-	if (_controlCharacterSet.addr)
-		free(_controlCharacterSet.addr);
-	if (_linkCharacterSet.addr)
-		free(_linkCharacterSet.addr);
+	free(_mainCharacterSet.addr);
+	free(_controlCharacterSet.addr);
+	free(_linkCharacterSet.addr);
 }
 
 void Text::fnSetFont(uint32 fontNr) {

Modified: scummvm/trunk/engines/sword1/resman.cpp
===================================================================
--- scummvm/trunk/engines/sword1/resman.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sword1/resman.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -166,9 +166,7 @@
 			}
 		}
 		delete[] cluster->grp;
-
-		if (cluster->file != NULL)
-			delete cluster->file;
+		delete cluster->file;
 	}
 	delete[] _prj.clu;
 }

Modified: scummvm/trunk/engines/sword1/screen.cpp
===================================================================
--- scummvm/trunk/engines/sword1/screen.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/engines/sword1/screen.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -314,10 +314,8 @@
 	Logic::_scriptVars[SCROLL_OFFSET_X] = 0;
 	Logic::_scriptVars[SCROLL_OFFSET_Y] = 0;
 
-	if (_screenBuf)
-		free(_screenBuf);
-	if (_screenGrid)
-		free(_screenGrid);
+	free(_screenBuf);
+	free(_screenGrid);
 
 	if (SwordEngine::isPsx())
 		flushPsxCache();
@@ -554,11 +552,8 @@
 	if (compact->o_type != TYPE_TEXT)
 		_resMan->resClose(compact->o_resource);
 
-	if (tonyBuf)
-		free(tonyBuf);
-
-	if (hifBuf)
-		free(hifBuf);
+	free(tonyBuf);
+	free(hifBuf);
 }
 
 void Screen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight) {

Modified: scummvm/trunk/sound/midiparser_smf.cpp
===================================================================
--- scummvm/trunk/sound/midiparser_smf.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/sound/midiparser_smf.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -52,8 +52,7 @@
 static const byte special_lengths[16] = { 0, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
 
 MidiParser_SMF::~MidiParser_SMF() {
-	if (_buffer)
-		free(_buffer);
+	free(_buffer);
 }
 
 void MidiParser_SMF::property(int prop, int value) {

Modified: scummvm/trunk/sound/mods/infogrames.cpp
===================================================================
--- scummvm/trunk/sound/mods/infogrames.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/sound/mods/infogrames.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -34,8 +34,7 @@
 }
 
 Infogrames::Instruments::~Instruments() {
-	if (_sampleData)
-		delete[] _sampleData;
+	delete[] _sampleData;
 }
 
 void Infogrames::Instruments::init() {
@@ -104,8 +103,7 @@
 }
 
 void Infogrames::Instruments::unload() {
-	if (_sampleData)
-		delete[] _sampleData;
+	delete[] _sampleData;
 	init();
 }
 
@@ -142,8 +140,7 @@
 }
 
 Infogrames::~Infogrames() {
-	if (_data)
-		delete[] _data;
+	delete[] _data;
 }
 
 void Infogrames::init() {

Modified: scummvm/trunk/sound/softsynth/mt32/synth.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32/synth.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/sound/softsynth/mt32/synth.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -129,8 +129,7 @@
 
 void Synth::initReverb(Bit8u newRevMode, Bit8u newRevTime, Bit8u newRevLevel) {
 	// FIXME:KG: I don't think it's necessary to recreate the reverbModel... Just set the parameters
-	if (reverbModel != NULL)
-		delete reverbModel;
+	delete reverbModel;
 	reverbModel = new revmodel();
 
 	switch (newRevMode) {

Modified: scummvm/trunk/sound/softsynth/mt32.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32.cpp	2010-01-03 19:27:20 UTC (rev 46940)
+++ scummvm/trunk/sound/softsynth/mt32.cpp	2010-01-03 19:37:43 UTC (rev 46941)
@@ -248,8 +248,7 @@
 }
 
 MidiDriver_MT32::~MidiDriver_MT32() {
-	if (_synth != NULL)
-		delete _synth;
+	delete _synth;
 }
 
 int MidiDriver_MT32::open() {


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