[Scummvm-git-logs] scummvm master -> 11812d9af9fa8ff6ca78496ea54fd5a16c822676

sev- sev at scummvm.org
Thu Jan 5 08:28:38 CET 2017


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
704b4838bd FULLPIPE: Delete cursors in _cursorsArray in InputController destructor
c3a3d7ef98 FULLPIPE: Change _gameName into a Common::String
907bab8a01 FULLPIPE: Remove unused variable
8a16f9d785 FULLPIPE: Delete temporary memory streams used with MfcArchive
b4514bfe92 FULLPIPE: Change _objCommandName and _queueName to Common::String
11812d9af9 Merge pull request #883 from bluegr/fullpipe_mem


Commit: 704b4838bddf410cce09cf9df1f0cf6b8be13d8d
    https://github.com/scummvm/scummvm/commit/704b4838bddf410cce09cf9df1f0cf6b8be13d8d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-12-20T01:31:03+02:00

Commit Message:
FULLPIPE: Delete cursors in _cursorsArray in InputController destructor

Changed paths:
    engines/fullpipe/input.cpp


diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index 5573562..55bc217 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -56,6 +56,9 @@ InputController::~InputController() {
 	removeMessageHandler(126, -1);
 
 	g_fp->_inputController = 0;
+
+	for (int i = 0; i < _cursorsArray.size(); i++)
+		delete _cursorsArray[i];
 }
 
 void InputController::setInputDisabled(bool state) {


Commit: c3a3d7ef9874a00ce860a700abd93ede0316b2bc
    https://github.com/scummvm/scummvm/commit/c3a3d7ef9874a00ce860a700abd93ede0316b2bc
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-12-20T01:55:51+02:00

Commit Message:
FULLPIPE: Change _gameName into a Common::String

Changed paths:
    engines/fullpipe/gameloader.cpp
    engines/fullpipe/gameloader.h


diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index aebf73d..efa5f8c 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -55,7 +55,6 @@ GameLoader::GameLoader() {
 	_inputController = new InputController();
 
 	_gameProject = 0;
-	_gameName = 0;
 
 	addMessageHandlerByIndex(global_messageHandler2, 0, 0);
 	insertMessageHandler(global_messageHandler3, 0, 128);
@@ -78,7 +77,6 @@ GameLoader::GameLoader() {
 }
 
 GameLoader::~GameLoader() {
-	free(_gameName);
 	delete _gameProject;
 	delete _interactionController;
 	delete _inputController;
@@ -112,7 +110,7 @@ bool GameLoader::load(MfcArchive &file) {
 	debugC(1, kDebugLoading, "GameLoader::load()");
 
 	_gameName = file.readPascalString();
-	debugC(1, kDebugLoading, "_gameName: %s", _gameName);
+	debugC(1, kDebugLoading, "_gameName: %s", _gameName.c_str());
 
 	_gameProject = new GameProject();
 
@@ -125,7 +123,7 @@ bool GameLoader::load(MfcArchive &file) {
 	}
 
 	_gameName = file.readPascalString();
-	debugC(1, kDebugLoading, "_gameName: %s", _gameName);
+	debugC(1, kDebugLoading, "_gameName: %s", _gameName.c_str());
 
 	_inventory.load(file);
 
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index a6c2416..6180ab0 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -133,7 +133,7 @@ class GameLoader : public CObject {
 	int16 _field_FA;
 	PreloadItems _preloadItems;
 	GameVar *_gameVar;
-	char *_gameName;
+	Common::String _gameName;
 	ExCommand _exCommand;
 	int _updateCounter;
 	int _preloadSceneId;


Commit: 907bab8a015c3d65f71e32297483e402dad62fae
    https://github.com/scummvm/scummvm/commit/907bab8a015c3d65f71e32297483e402dad62fae
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-12-20T02:06:58+02:00

Commit Message:
FULLPIPE: Remove unused variable

Changed paths:
    engines/fullpipe/sound.cpp
    engines/fullpipe/sound.h


diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index be539bc..1a88e47 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -102,14 +102,12 @@ Sound::Sound() {
 	_soundData = 0;
 	_objectId = 0;
 	memset(_directSoundBuffers, 0, sizeof(_directSoundBuffers));
-	_description = 0;
 	_volume = 100;
 	_handle = new Audio::SoundHandle();
 }
 
 Sound::~Sound() {
 	freeSound();
-	free(_description);
 	delete _handle;
 }
 
@@ -119,7 +117,7 @@ bool Sound::load(MfcArchive &file, NGIArchive *archive) {
 	MemoryObject::load(file);
 
 	_id = file.readUint32LE();
-	_description = file.readPascalString();
+	/*_description = */file.readPascalString();
 
 	assert(g_fp->_gameProjectVersion >= 6);
 
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index 4066c5e..bfc3882 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -31,7 +31,6 @@ namespace Fullpipe {
 
 class Sound : public MemoryObject {
 	int _id;
-	char *_description;
 	int _directSoundBuffer;
 	int _directSoundBuffers[7];
 	byte *_soundData;


Commit: 8a16f9d7857e517bd2b87744c0bea17fab9d1eb3
    https://github.com/scummvm/scummvm/commit/8a16f9d7857e517bd2b87744c0bea17fab9d1eb3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-12-20T02:13:18+02:00

Commit Message:
FULLPIPE: Delete temporary memory streams used with MfcArchive

Changed paths:
    engines/fullpipe/stateloader.cpp


diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index adc4fe3..86865f9 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -69,18 +69,21 @@ bool GameLoader::readSavegame(const char *fname) {
 	byte *map = (byte *)malloc(800);
 	saveFile->read(map, 800);
 
-	MfcArchive temp(new Common::MemoryReadStream(map, 800));
+	Common::MemoryReadStream *tempStream = new Common::MemoryReadStream(map, 800);
+	MfcArchive temp(tempStream);
 
 	if (_savegameCallback)
 		_savegameCallback(&temp, false);
 
+	delete tempStream;
 	delete saveFile;
 
 	// Deobfuscate the data
 	for (int i = 0; i < header.encSize; i++)
 		data[i] -= i & 0x7f;
 
-	MfcArchive *archive = new MfcArchive(new Common::MemoryReadStream(data, header.encSize));
+	Common::MemoryReadStream *archiveStream = new Common::MemoryReadStream(data, header.encSize);
+	MfcArchive *archive = new MfcArchive(archiveStream);
 
 	GameVar *var = (GameVar *)archive->readClass();
 
@@ -91,6 +94,7 @@ bool GameLoader::readSavegame(const char *fname) {
 
 		if (!v) {
 			warning("No state to save");
+			delete archiveStream;
 			delete archive;
 			return false;
 		}
@@ -121,6 +125,7 @@ bool GameLoader::readSavegame(const char *fname) {
 		_sc2array[i]._isLoaded = 0;
 	}
 
+	delete archiveStream;
 	delete archive;
 
 	getGameLoaderInventory()->rebuildItemRects();


Commit: b4514bfe92307249d5b52c3c37d5838ea2e3c4d5
    https://github.com/scummvm/scummvm/commit/b4514bfe92307249d5b52c3c37d5838ea2e3c4d5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-12-20T02:17:58+02:00

Commit Message:
FULLPIPE: Change _objCommandName and _queueName to Common::String

Changed paths:
    engines/fullpipe/messagehandlers.cpp
    engines/fullpipe/messages.cpp
    engines/fullpipe/messages.h
    engines/fullpipe/scene.cpp


diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp
index f53a705..bd75e01 100644
--- a/engines/fullpipe/messagehandlers.cpp
+++ b/engines/fullpipe/messagehandlers.cpp
@@ -519,7 +519,7 @@ int global_messageHandler3(ExCommand *cmd) {
 		if (cmd->_objtype == kObjTypeObjstateCommand) {
 			ObjstateCommand *c = (ObjstateCommand *)cmd;
 			result = 1;
-			g_fp->setObjectState(c->_objCommandName, c->_value);
+			g_fp->setObjectState(c->_objCommandName.c_str(), c->_value);
 		}
 		return result;
 	default:
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index a9fc521..111c70c 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -232,20 +232,17 @@ Message::Message(int16 parentId, int messageKind, int x, int y, int a6, int a7,
 
 ObjstateCommand::ObjstateCommand() {
 	_value = 0;
-	_objCommandName = 0;
 	_objtype = kObjTypeObjstateCommand;
 }
 
 ObjstateCommand::ObjstateCommand(ObjstateCommand *src) : ExCommand(src) {
 	_value = src->_value;
-	_objCommandName = (char *)calloc(strlen(src->_objCommandName) + 1, 1);
 	_objtype = kObjTypeObjstateCommand;
 
-	strncpy(_objCommandName, src->_objCommandName, strlen(src->_objCommandName));
+	_objCommandName = src->_objCommandName;
 }
 
 ObjstateCommand::~ObjstateCommand() {
-	free(_objCommandName);
 }
 
 bool ObjstateCommand::load(MfcArchive &file) {
@@ -273,7 +270,6 @@ MessageQueue::MessageQueue() {
 	_id = 0;
 	_isFinished = 0;
 	_flags = 0;
-	_queueName = 0;
 	_counter = 0;
 	_field_38 = 0;
 	_flag1 = 0;
@@ -286,7 +282,6 @@ MessageQueue::MessageQueue(int dataId) {
 	_id = g_fp->_globalMessageQueueList->compact();
 	_isFinished = 0;
 	_flags = 0;
-	_queueName = 0;
 	_counter = 0;
 	_field_38 = 0;
 	_flag1 = 0;
@@ -312,7 +307,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) {
 	_id = g_fp->_globalMessageQueueList->compact();
 	_dataId = src->_dataId;
 	_flags = src->_flags;
-	_queueName = 0;
+	_queueName = "";
 
 	g_fp->_globalMessageQueueList->addMessageQueue(this);
 
@@ -338,8 +333,6 @@ MessageQueue::~MessageQueue() {
 	}
 
 	finish();
-
-	free(_queueName);
 }
 
 bool MessageQueue::load(MfcArchive &file) {
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index b99b842..0bdfb23 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -94,7 +94,7 @@ class ExCommand2 : public ExCommand {
 
 class ObjstateCommand : public ExCommand {
  public:
-	char *_objCommandName;
+	Common::String _objCommandName;
 	int _value;
 
  public:
@@ -111,7 +111,7 @@ class MessageQueue : public CObject {
   public:
 	int _id;
 	int _flags;
-	char *_queueName;
+	Common::String _queueName;
 	int16 _dataId;
 	CObject *_field_14;
 	int _counter;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index b525818..d560703 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -400,7 +400,7 @@ MessageQueue *Scene::getMessageQueueById(int messageId) {
 
 MessageQueue *Scene::getMessageQueueByName(char *name) {
 	for (uint i = 0; i < _messageQueueList.size(); i++)
-		if (!strcmp(_messageQueueList[i]->_queueName, name))
+		if (!strcmp(_messageQueueList[i]->_queueName.c_str(), name))
 			return _messageQueueList[i];
 
 	return 0;


Commit: 11812d9af9fa8ff6ca78496ea54fd5a16c822676
    https://github.com/scummvm/scummvm/commit/11812d9af9fa8ff6ca78496ea54fd5a16c822676
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-01-05T08:28:32+01:00

Commit Message:
Merge pull request #883 from bluegr/fullpipe_mem

FULLPIPE: Plug some memory leaks

Changed paths:
    engines/fullpipe/gameloader.cpp
    engines/fullpipe/gameloader.h
    engines/fullpipe/input.cpp
    engines/fullpipe/messagehandlers.cpp
    engines/fullpipe/messages.cpp
    engines/fullpipe/messages.h
    engines/fullpipe/scene.cpp
    engines/fullpipe/sound.cpp
    engines/fullpipe/sound.h
    engines/fullpipe/stateloader.cpp







More information about the Scummvm-git-logs mailing list