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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun May 31 18:59:45 CEST 2009


Revision: 41077
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41077&view=rev
Author:   fingolfin
Date:     2009-05-31 16:59:45 +0000 (Sun, 31 May 2009)

Log Message:
-----------
GOB: Replaced many uses of strdupcpy by Common::String

Modified Paths:
--------------
    scummvm/trunk/engines/gob/dataio.cpp
    scummvm/trunk/engines/gob/demos/demoplayer.cpp
    scummvm/trunk/engines/gob/detection.cpp
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/gob/gob.h
    scummvm/trunk/engines/gob/init.cpp
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/save/saveconverter.cpp
    scummvm/trunk/engines/gob/save/saveconverter.h
    scummvm/trunk/engines/gob/save/savefile.cpp
    scummvm/trunk/engines/gob/save/savefile.h
    scummvm/trunk/engines/gob/save/saveload.cpp
    scummvm/trunk/engines/gob/save/saveload.h
    scummvm/trunk/engines/gob/save/saveload_v2.cpp
    scummvm/trunk/engines/gob/save/saveload_v3.cpp
    scummvm/trunk/engines/gob/save/saveload_v4.cpp
    scummvm/trunk/engines/gob/save/saveload_v6.cpp
    scummvm/trunk/engines/gob/video.h
    scummvm/trunk/engines/gob/video_v6.cpp
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/dataio.cpp
===================================================================
--- scummvm/trunk/engines/gob/dataio.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/dataio.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -215,9 +215,7 @@
 	if (i == MAX_FILES)
 		return -1;
 
-	file_getHandle(i)->open(path);
-
-	if (file_getHandle(i)->isOpen())
+	if (file_getHandle(i)->open(path))
 		return i;
 
 	return -1;

Modified: scummvm/trunk/engines/gob/demos/demoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/demos/demoplayer.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -128,7 +128,7 @@
 	uint32 waitTime = 0;
 	char *file, *filePtr;
 
-	file = filePtr = strdupcpy(fileName);
+	file = filePtr = strdup(fileName);
 
 	// Trimming spaces front
 	while (*file == ' ')
@@ -168,7 +168,7 @@
 	}
 
 
-	delete[] filePtr;
+	free(filePtr);
 }
 
 void DemoPlayer::playVideoNormal() {
@@ -177,11 +177,9 @@
 
 void DemoPlayer::playVideoDoubled() {
 	const char *fileNameOpened = _vm->_vidPlayer->getFileName();
-	char *fileName = strdupcpy(fileNameOpened);
-
 	_vm->_vidPlayer->primaryClose();
 
-	if (_vm->_vidPlayer->primaryOpen(fileName, 0, -1, VideoPlayer::kFlagOtherSurface)) {
+	if (_vm->_vidPlayer->primaryOpen(fileNameOpened, 0, -1, VideoPlayer::kFlagOtherSurface)) {
 		for (int i = 0; i < _vm->_vidPlayer->getFramesCount(); i++) {
 			if (_vm->_vidPlayer->primaryPlay(i, i))
 				break;
@@ -200,8 +198,6 @@
 			_vm->_video->retrace();
 		}
 	}
-
-	delete[] fileName;
 }
 
 void DemoPlayer::evaluateVideoMode(const char *mode) {

Modified: scummvm/trunk/engines/gob/detection.cpp
===================================================================
--- scummvm/trunk/engines/gob/detection.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/detection.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -3468,14 +3468,14 @@
 
 void GobEngine::initGame(const GOBGameDescription *gd) {
 	if (gd->startTotBase == 0)
-		_startTot = strdupcpy("intro.tot");
+		_startTot = "intro.tot";
 	else
-		_startTot = strdupcpy(gd->startTotBase);
+		_startTot = gd->startTotBase;
 
 	if (gd->startStkBase == 0)
-		_startStk = strdupcpy("intro.stk");
+		_startStk = "intro.stk";
 	else
-		_startStk = strdupcpy(gd->startStkBase);
+		_startStk = gd->startStkBase;
 
 	_demoIndex = gd->demoIndex;
 

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/gob.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -106,9 +106,6 @@
 
 	// Stop all mixer streams (except for the permanent ones).
 	_vm->_mixer->stopAll();
-
-	delete[] _startStk;
-	delete[] _startTot;
 }
 
 const char *GobEngine::getLangDesc(int16 language) const {
@@ -191,7 +188,7 @@
 	}
 
 	_video->setSize(is640());
-	_video->init(_targetName.c_str());
+	_video->init();
 
 	// On some systems it's not safe to run CD audio games from the CD.
 	if (isCD())
@@ -413,7 +410,7 @@
 		_map = new Map_v4(this);
 		_goblin = new Goblin_v4(this);
 		_scenery = new Scenery_v2(this);
-		_saveLoad = new SaveLoad(this, _targetName.c_str());
+		_saveLoad = new SaveLoad(this);
 		break;
 
 	case kGameTypeAdibou4:

Modified: scummvm/trunk/engines/gob/gob.h
===================================================================
--- scummvm/trunk/engines/gob/gob.h	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/gob.h	2009-05-31 16:59:45 UTC (rev 41077)
@@ -162,8 +162,8 @@
 	uint16 _height;
 	uint8 _mode;
 
-	char *_startStk;
-	char *_startTot;
+	Common::String _startStk;
+	Common::String _startTot;
 	uint32 _demoIndex;
 
 	bool _copyProtection;

Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/init.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -91,10 +91,10 @@
 	initVideo();
 
 	if (!_vm->isDemo()) {
-		handle2 = _vm->_dataIO->openData(_vm->_startStk);
+		handle2 = _vm->_dataIO->openData(_vm->_startStk.c_str());
 		if (handle2 >= 0) {
 			_vm->_dataIO->closeData(handle2);
-			_vm->_dataIO->openDataFile(_vm->_startStk);
+			_vm->_dataIO->openDataFile(_vm->_startStk.c_str());
 		}
 	}
 
@@ -167,7 +167,7 @@
 		delete[] infBuf;
 	}
 
-	strcpy(buffer, _vm->_startTot);
+	strcpy(buffer, _vm->_startTot.c_str());
 	handle = _vm->_dataIO->openData(buffer);
 
 	if (handle >= 0) {

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -1136,7 +1136,7 @@
 
 	// Skipping the copy protection screen in Gobliiins
 	if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob1) && (offset == 3905)
-			&& !scumm_stricmp(_vm->_game->_curTotFile, _vm->_startTot)) {
+			&& !scumm_stricmp(_vm->_game->_curTotFile, _vm->_startTot.c_str())) {
 		debugC(2, kDebugGameFlow, "Skipping copy protection screen");
 		return false;
 	}

Modified: scummvm/trunk/engines/gob/save/saveconverter.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveconverter.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveconverter.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -34,16 +34,14 @@
 
 namespace Gob {
 
-SaveConverter::SaveConverter(GobEngine *vm, const char *fileName) : _vm(vm) {
-	_fileName = strdupcpy(fileName);
+SaveConverter::SaveConverter(GobEngine *vm, const Common::String &fileName)
+: _vm(vm), _fileName(fileName) {
 
 	_data = 0;
 	_stream = 0;
 }
 
 SaveConverter::~SaveConverter() {
-	delete[] _fileName;
-
 	delete _stream;
 	delete[] _data;
 }
@@ -56,16 +54,13 @@
 	_stream = 0;
 }
 
-void SaveConverter::setFileName(const char *fileName) {
+void SaveConverter::setFileName(const Common::String &fileName) {
 	clear();
-
-	delete[] _fileName;
-
-	_fileName = strdupcpy(fileName);
+	_fileName = fileName;
 }
 
 Common::InSaveFile *SaveConverter::openSave() const {
-	if (!_fileName)
+	if (_fileName.empty())
 		return 0;
 
 	Common::SaveFileManager *saveMan = g_system->getSavefileManager();

Modified: scummvm/trunk/engines/gob/save/saveconverter.h
===================================================================
--- scummvm/trunk/engines/gob/save/saveconverter.h	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveconverter.h	2009-05-31 16:59:45 UTC (rev 41077)
@@ -40,13 +40,13 @@
 /** A wrapping stream class for old saves. */
 class SaveConverter : public Common::SeekableReadStream {
 public:
-	SaveConverter(GobEngine *vm, const char *fileName = 0);
+	SaveConverter(GobEngine *vm, const Common::String &fileName);
 	virtual ~SaveConverter();
 
 	/** Clear the converter. */
 	virtual void clear();
 	/** Set the filename on which to operate. */
-	virtual void setFileName(const char *fileName);
+	virtual void setFileName(const Common::String &fileName);
 
 	/** Is it actually an old save? */
 	virtual int isOldSave(Common::InSaveFile **save = 0) const = 0;
@@ -74,7 +74,7 @@
 protected:
 	GobEngine *_vm;
 
-	char *_fileName;
+	Common::String _fileName;
 
 	byte *_data;
 	Common::MemoryReadStream *_stream;

Modified: scummvm/trunk/engines/gob/save/savefile.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/savefile.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/savefile.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -783,10 +783,9 @@
 }
 
 
-SaveReader::SaveReader(uint32 partCount, uint32 slot, const char *fileName) :
-	SaveContainer(partCount, slot) {
+SaveReader::SaveReader(uint32 partCount, uint32 slot, const Common::String &fileName) :
+	SaveContainer(partCount, slot), _fileName(fileName) {
 
-	_fileName = strdupcpy(fileName);
 	_stream = 0;
 
 	_loaded = false;
@@ -795,14 +794,12 @@
 SaveReader::SaveReader(uint32 partCount, uint32 slot, Common::SeekableReadStream &stream) :
 	SaveContainer(partCount, slot) {
 
-	_fileName = 0;
 	_stream = &stream;
 
 	_loaded = false;
 }
 
 SaveReader::~SaveReader() {
-	delete[] _fileName;
 }
 
 // Open the save and read it
@@ -811,7 +808,7 @@
 	Common::InSaveFile *in = 0;
 	Common::SeekableReadStream *stream;
 
-	if (_fileName) {
+	if (!_fileName.empty()) {
 		in = openSave();
 
 		if (!in)
@@ -852,8 +849,8 @@
 	return true;
 }
 
-Common::InSaveFile *SaveReader::openSave(const char *fileName) {
-	if (!fileName)
+Common::InSaveFile *SaveReader::openSave(const Common::String &fileName) {
+	if (fileName.empty())
 		return 0;
 
 	Common::SaveFileManager *saveMan = g_system->getSavefileManager();
@@ -899,7 +896,7 @@
 	return result;
 }
 
-bool SaveReader::getInfo(const char *fileName, SavePartInfo &info) {
+bool SaveReader::getInfo(const Common::String &fileName, SavePartInfo &info) {
 	Common::InSaveFile *in = openSave(fileName);
 
 	if (!in)
@@ -912,14 +909,15 @@
 	return result;
 }
 
-SaveWriter::SaveWriter(uint32 partCount, uint32 slot, const char *fileName) :
+SaveWriter::SaveWriter(uint32 partCount, uint32 slot) :
 	SaveContainer(partCount, slot) {
+}
 
-	_fileName = strdupcpy(fileName);
+SaveWriter::SaveWriter(uint32 partCount, uint32 slot, const Common::String &fileName) :
+	SaveContainer(partCount, slot), _fileName(fileName) {
 }
 
 SaveWriter::~SaveWriter() {
-	delete[] _fileName;
 }
 
 bool SaveWriter::writePart(uint32 partN, const SavePart *part) {
@@ -958,14 +956,15 @@
 }
 
 bool SaveWriter::canSave() const {
-	if (!_fileName)
+	// FIXME: The logic here is the opposite from what I (Fingolfin) would expect ?!?
+	if (!_fileName.empty())
 		return false;
 	
 	return true;
 }
 
-Common::OutSaveFile *SaveWriter::openSave(const char *fileName) {
-	if (!fileName)
+Common::OutSaveFile *SaveWriter::openSave(const Common::String &fileName) {
+	if (fileName.empty())
 		return 0;
 
 	Common::SaveFileManager *saveMan = g_system->getSavefileManager();

Modified: scummvm/trunk/engines/gob/save/savefile.h
===================================================================
--- scummvm/trunk/engines/gob/save/savefile.h	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/savefile.h	2009-05-31 16:59:45 UTC (rev 41077)
@@ -296,7 +296,7 @@
 /** Reads a save. */
 class SaveReader : public SaveContainer {
 public:
-	SaveReader(uint32 partCount, uint32 slot, const char *fileName);
+	SaveReader(uint32 partCount, uint32 slot, const Common::String &fileName);
 	SaveReader(uint32 partCount, uint32 slot, Common::SeekableReadStream &stream);
 	~SaveReader();
 
@@ -308,22 +308,23 @@
 	/** Find and read the save's info part. */
 	static bool getInfo(Common::SeekableReadStream &stream, SavePartInfo &info);
 	/** Find and read the save's info part. */
-	static bool getInfo(const char *fileName, SavePartInfo &info);
+	static bool getInfo(const Common::String &fileName, SavePartInfo &info);
 
 protected:
-	char *_fileName;
+	Common::String _fileName;
 	Common::SeekableReadStream *_stream;
 
 	bool _loaded;
 
-	static Common::InSaveFile *openSave(const char *fileName);
+	static Common::InSaveFile *openSave(const Common::String &fileName);
 	Common::InSaveFile *openSave();
 };
 
 /** Writes a save. */
 class SaveWriter: public SaveContainer {
 public:
-	SaveWriter(uint32 partCount, uint32 slot, const char *fileName = 0);
+	SaveWriter(uint32 partCount, uint32 slot);
+	SaveWriter(uint32 partCount, uint32 slot, const Common::String &fileName);
 	~SaveWriter();
 
 	bool writePart(uint32 partN, const SavePart *part);
@@ -333,12 +334,12 @@
 protected:
 	bool save();
 
-	char *_fileName;
+	Common::String _fileName;
 
 	/** Is everything ready for saving? */
 	bool canSave() const;
 
-	static Common::OutSaveFile *openSave(const char *fileName);
+	static Common::OutSaveFile *openSave(const Common::String &fileName);
 	Common::OutSaveFile *openSave();
 };
 

Modified: scummvm/trunk/engines/gob/save/saveload.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveload.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveload.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -35,12 +35,10 @@
 
 namespace Gob {
 
-SaveLoad::SaveLoad(GobEngine *vm, const char *targetName) : _vm(vm) {
-	_targetName = strdupcpy(targetName);
+SaveLoad::SaveLoad(GobEngine *vm) : _vm(vm) {
 }
 
 SaveLoad::~SaveLoad() {
-	delete[] _targetName;
 }
 
 const char *SaveLoad::stripPath(const char *fileName) {

Modified: scummvm/trunk/engines/gob/save/saveload.h
===================================================================
--- scummvm/trunk/engines/gob/save/saveload.h	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveload.h	2009-05-31 16:59:45 UTC (rev 41077)
@@ -48,7 +48,7 @@
 	 *
 	 *  @param targetName The game's target name. Used as a base for the save names.
 	 */
-	SaveLoad(GobEngine *vm, const char *targetName);
+	SaveLoad(GobEngine *vm);
 	virtual ~SaveLoad();
 
 	/** "foo\bar\quux.bla" => "quux.bla". */
@@ -67,8 +67,6 @@
 protected:
 	GobEngine *_vm;
 
-	char *_targetName;
-
 	virtual SaveHandler *getHandler(const char *fileName) const;
 	virtual const char *getDescription(const char *fileName) const;
 };

Modified: scummvm/trunk/engines/gob/save/saveload_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveload_v2.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveload_v2.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -260,10 +260,10 @@
 
 
 SaveLoad_v2::SaveLoad_v2(GobEngine *vm, const char *targetName) :
-		SaveLoad(vm, targetName) {
+		SaveLoad(vm) {
 
-	_gameHandler = new GameHandler(vm, _targetName);
-	_notesHandler = new NotesHandler(600, vm, _targetName);
+	_gameHandler = new GameHandler(vm, targetName);
+	_notesHandler = new NotesHandler(600, vm, targetName);
 	_tempSpriteHandler = new TempSpriteHandler(vm);
 
 	_saveFiles[0].handler = _gameHandler;

Modified: scummvm/trunk/engines/gob/save/saveload_v3.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveload_v3.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveload_v3.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -491,21 +491,21 @@
 
 
 SaveLoad_v3::SaveLoad_v3(GobEngine *vm, const char *targetName, ScreenshotType sShotType) :
-		SaveLoad(vm, targetName) {
+		SaveLoad(vm) {
 
 	_sShotType = sShotType;
 
 	// The Amiga version doesn't use screenshots
 	if (_vm->getPlatform() == Common::kPlatformAmiga) {
-		_gameHandler = new GameHandler(vm, _targetName, false);
+		_gameHandler = new GameHandler(vm, targetName, false);
 		_screenshotHandler = 0;
 	} else {
-		_gameHandler = new GameHandler(vm, _targetName, true);
+		_gameHandler = new GameHandler(vm, targetName, true);
 		_screenshotHandler = new ScreenshotHandler(vm, _gameHandler, sShotType);
 	}
 	
 	_tempSpriteHandler = new TempSpriteHandler(vm);
-	_notesHandler = new NotesHandler(2560, vm, _targetName);
+	_notesHandler = new NotesHandler(2560, vm, targetName);
 
 	_saveFiles[0].handler = _gameHandler;
 	_saveFiles[1].handler = _screenshotHandler;

Modified: scummvm/trunk/engines/gob/save/saveload_v4.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveload_v4.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveload_v4.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -485,9 +485,9 @@
 
 
 SaveLoad_v4::SaveLoad_v4(GobEngine *vm, const char *targetName) :
-		SaveLoad(vm, targetName) {
+		SaveLoad(vm) {
 
-	_gameHandler = new GameHandler(vm, _targetName);
+	_gameHandler = new GameHandler(vm, targetName);
 	_curProps    = new CurScreenPropsHandler(vm);
 	for (int i = 0; i < 10; i++)
 		_props[i] = new ScreenPropsHandler(vm, i, _curProps, _gameHandler);

Modified: scummvm/trunk/engines/gob/save/saveload_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveload_v6.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/save/saveload_v6.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -281,9 +281,9 @@
 
 
 SaveLoad_v6::SaveLoad_v6(GobEngine *vm, const char *targetName) :
-		SaveLoad(vm, targetName) {
+		SaveLoad(vm) {
 
-	_gameHandler = new GameHandler(vm, _targetName);
+	_gameHandler = new GameHandler(vm, targetName);
 
 	_saveFiles[0].handler = _gameHandler;
 }

Modified: scummvm/trunk/engines/gob/video.h
===================================================================
--- scummvm/trunk/engines/gob/video.h	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/video.h	2009-05-31 16:59:45 UTC (rev 41077)
@@ -183,7 +183,7 @@
 			int16 srcHeight, int16 x, int16 y, int16 transp,
 			SurfaceDesc *destDesc) = 0;
 
-	virtual void init(const char *target = "") { }
+	virtual void init() {}
 
 	virtual void setPrePalette() { }
 
@@ -233,7 +233,7 @@
 	virtual void fillRect(SurfaceDesc *dest, int16 left, int16 top,
 			int16 right, int16 bottom, int16 color);
 
-	virtual void init(const char *target = "");
+	virtual void init();
 
 	virtual void setPrePalette();
 

Modified: scummvm/trunk/engines/gob/video_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v6.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/video_v6.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -57,7 +57,7 @@
 
 }
 
-void Video_v6::init(const char *target) {
+void Video_v6::init() {
 	initOSD();
 
 	buildPalLUT();

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2009-05-31 16:59:45 UTC (rev 41077)
@@ -41,7 +41,7 @@
 
 const char *VideoPlayer::_extensions[] = { "IMD", "VMD", "RMD" };
 
-VideoPlayer::Video::Video(GobEngine *vm) : _vm(vm), _fileName(0), _stream(0), _video(0) {
+VideoPlayer::Video::Video(GobEngine *vm) : _vm(vm), _stream(0), _video(0) {
 }
 
 VideoPlayer::Video::~Video() {
@@ -78,7 +78,7 @@
 		return false;
 	}
 
-	_fileName = strdupcpy(fileName);
+	_fileName = fileName;
 
 	_defaultX = _video->getX();
 	_defaultY = _video->getY();
@@ -89,11 +89,9 @@
 void VideoPlayer::Video::close() {
 	delete _video;
 	delete _stream;
-	delete[] _fileName;
 
 	_video = 0;
 	_stream = 0;
-	_fileName = 0;
 	memset(&_state, 0, sizeof(Graphics::CoktelVideo::State));
 	_defaultX = _defaultY = 0;
 }
@@ -103,7 +101,7 @@
 }
 
 const char *VideoPlayer::Video::getFileName() const {
-	return _fileName ? _fileName : "";
+	return _fileName.c_str();
 }
 
 Graphics::CoktelVideo *VideoPlayer::Video::getVideo() {

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2009-05-31 16:02:10 UTC (rev 41076)
+++ scummvm/trunk/engines/gob/videoplayer.h	2009-05-31 16:59:45 UTC (rev 41077)
@@ -27,6 +27,7 @@
 #define GOB_VIDEOPLAYER_H
 
 #include "common/array.h"
+#include "common/str.h"
 
 #include "graphics/video/coktelvideo/coktelvideo.h"
 
@@ -126,7 +127,7 @@
 		private:
 			GobEngine *_vm;
 
-			char *_fileName;
+			Common::String _fileName;
 			DataStream *_stream;
 			Graphics::CoktelVideo *_video;
 			Graphics::CoktelVideo::State _state;


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