[Scummvm-cvs-logs] SF.net SVN: scummvm:[34100] scummvm/trunk/backends/platform/sdl/sdl.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Aug 22 13:45:30 CEST 2008


Revision: 34100
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34100&view=rev
Author:   fingolfin
Date:     2008-08-22 11:45:29 +0000 (Fri, 22 Aug 2008)

Log Message:
-----------
SDL backend: Simplified openConfigFileForReading/openConfigFileForWriting impl; also init _fsFactory in constructor, as it is needed to load the config file

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/sdl.cpp

Modified: scummvm/trunk/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/sdl.cpp	2008-08-22 11:41:14 UTC (rev 34099)
+++ scummvm/trunk/backends/platform/sdl/sdl.cpp	2008-08-22 11:45:29 UTC (rev 34100)
@@ -170,21 +170,6 @@
 		_timerID = SDL_AddTimer(10, &timer_handler, _timer);
 	}
 
-	if (_fsFactory == 0) {
-		#if defined(__amigaos4__)
-			_fsFactory = new AmigaOSFilesystemFactory();
-		#elif defined(UNIX)
-			_fsFactory = new POSIXFilesystemFactory();
-		#elif defined(WIN32)
-			_fsFactory = new WindowsFilesystemFactory();
-		#elif defined(__SYMBIAN32__)
-			// Do nothing since its handled by the Symbian SDL inheritance
-		#else
-			#error Unknown and unsupported backend in OSystem_SDL::getFilesystemFactory
-		#endif
-	}
-	
-
 	// Invoke parent implementation of this method
 	OSystem::initBackend();
 
@@ -229,6 +214,19 @@
 	memset(&_mouseCurState, 0, sizeof(_mouseCurState));
 
 	_inited = false;
+
+
+	#if defined(__amigaos4__)
+		_fsFactory = new AmigaOSFilesystemFactory();
+	#elif defined(UNIX)
+		_fsFactory = new POSIXFilesystemFactory();
+	#elif defined(WIN32)
+		_fsFactory = new WindowsFilesystemFactory();
+	#elif defined(__SYMBIAN32__)
+		// Do nothing since its handled by the Symbian SDL inheritance
+	#else
+		#error Unknown and unsupported FS backend
+	#endif
 }
 
 OSystem_SDL::~OSystem_SDL() {
@@ -345,23 +343,13 @@
 }
 
 Common::SeekableReadStream *OSystem_SDL::openConfigFileForReading() {
-	Common::File *confFile = new Common::File();
-	assert(confFile);
-	if (!confFile->open(getDefaultConfigFileName())) {
-		delete confFile;
-		confFile = 0;
-	}
-	return confFile;
+	FilesystemNode file(getDefaultConfigFileName());
+	return file.openForReading();
 }
 
 Common::WriteStream *OSystem_SDL::openConfigFileForWriting() {
-	Common::DumpFile *confFile = new Common::DumpFile();
-	assert(confFile);
-	if (!confFile->open(getDefaultConfigFileName())) {
-		delete confFile;
-		confFile = 0;
-	}
-	return confFile;
+	FilesystemNode file(getDefaultConfigFileName());
+	return file.openForWriting();
 }
 
 void OSystem_SDL::setWindowCaption(const char *caption) {


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