[Scummvm-git-logs] scummvm master -> 6ddfb08b16d326b7c152e2f04b04c1a8d5658a50
digitall
547637+digitall at users.noreply.github.com
Fri Jul 16 00:10:37 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6ddfb08b16 SYMBIAN: Simplify access to file server session.
Commit: 6ddfb08b16d326b7c152e2f04b04c1a8d5658a50
https://github.com/scummvm/scummvm/commit/6ddfb08b16d326b7c152e2f04b04c1a8d5658a50
Author: Fiodar Stryzhniou (fedor_qd at mail.ru)
Date: 2021-07-16T01:10:34+01:00
Commit Message:
SYMBIAN: Simplify access to file server session.
This fixes bug #12728.
Changed paths:
backends/fs/symbian/symbian-fs.cpp
backends/fs/symbian/symbianstream.cpp
backends/platform/symbian/src/SymbianOS.cpp
backends/platform/symbian/src/SymbianOS.h
diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp
index cbebb7c15b..0ce10d328c 100644
--- a/backends/fs/symbian/symbian-fs.cpp
+++ b/backends/fs/symbian/symbian-fs.cpp
@@ -71,7 +71,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) {
TPtrC8 ptr((const unsigned char*)_path.c_str(),_path.size());
fname.Copy(ptr);
- if (dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession().Entry(fname, fileAttribs) == KErrNone) {
+ if (FsSession().Entry(fname, fileAttribs) == KErrNone) {
_isValid = true;
_isDirectory = fileAttribs.IsDir();
} else {
@@ -88,7 +88,7 @@ bool SymbianFilesystemNode::exists() const {
TFileName fname;
TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size());
fname.Copy(ptr);
- bool fileExists = BaflUtils::FileExists(dynamic_cast<OSystem_SDL_Symbian *> (g_system)->FsSession(), fname);
+ bool fileExists = BaflUtils::FileExists(FsSession(), fname);
if (!fileExists) {
TParsePtrC parser(fname);
if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) {
@@ -126,8 +126,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
if (_isPseudoRoot) {
// Drives enumeration
- // TODO: check if can use static_cast in next release
- RFs& fs = dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession();
+ RFs& fs = FsSession();
TInt driveNumber;
TChar driveLetter;
TUint driveLetterValue;
@@ -172,8 +171,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
if (_path.lastChar() != '\\')
fname.Append('\\');
- // TODO: check if can use static_cast in next release
- if (dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession().GetDir(fname, KEntryAttNormal|KEntryAttDir, 0, dirPtr) == KErrNone) {
+ if (FsSession().GetDir(fname, KEntryAttNormal|KEntryAttDir, 0, dirPtr) == KErrNone) {
CleanupStack::PushL(dirPtr);
TInt cnt = dirPtr->Count();
for (TInt loop = 0; loop < cnt; loop++) {
diff --git a/backends/fs/symbian/symbianstream.cpp b/backends/fs/symbian/symbianstream.cpp
index 32c7aa465a..8bdd29e1ec 100644
--- a/backends/fs/symbian/symbianstream.cpp
+++ b/backends/fs/symbian/symbianstream.cpp
@@ -70,22 +70,22 @@ TSymbianFileEntry* CreateSymbianFileEntry(const char* name, const char* mode) {
switch (mode[0]) {
case 'a':
- if (fileEntry->_fileHandle.Open(dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
- if (fileEntry->_fileHandle.Create(dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Open(FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Create(FsSession(), tempFileName, fileMode) != KErrNone) {
delete fileEntry;
fileEntry = NULL;
}
}
break;
case 'r':
- if (fileEntry->_fileHandle.Open(dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Open(FsSession(), tempFileName, fileMode) != KErrNone) {
delete fileEntry;
fileEntry = NULL;
}
break;
case 'w':
- if (fileEntry->_fileHandle.Replace(dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {
+ if (fileEntry->_fileHandle.Replace(FsSession(), tempFileName, fileMode) != KErrNone) {
delete fileEntry;
fileEntry = NULL;
}
diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp
index 73ca203476..8336721a22 100644
--- a/backends/platform/symbian/src/SymbianOS.cpp
+++ b/backends/platform/symbian/src/SymbianOS.cpp
@@ -66,9 +66,7 @@ char *GetExecutablePath() {
////////// OSystem_SDL_Symbian //////////////////////////////////////////
-OSystem_SDL_Symbian::OSystem_SDL_Symbian() {
- _RFs = CEikonEnv::Static()->FsSession();
-}
+OSystem_SDL_Symbian::OSystem_SDL_Symbian() {}
void OSystem_SDL_Symbian::init() {
// Use iconless window: it uses the EScummVM.aif file for the icon.
@@ -92,6 +90,7 @@ void OSystem_SDL_Symbian::initBackend() {
#if !RELEASE_BUILD
_LIT(KDefaultBetaExtraPath,"!:\\DATA\\ScummVM\\BETA\\");
+ RFs _RFs = FsSession();
_RFs.SessionPath(_localpath);
_RFs.SetSessionPath(KDefaultBetaExtraPath);
@@ -110,7 +109,7 @@ void OSystem_SDL_Symbian::initBackend() {
TFileName fname;
TPtrC8 ptr((const unsigned char*)currentPath.c_str(), currentPath.size());
fname.Copy(ptr);
- BaflUtils::EnsurePathExistsL(dynamic_cast<OSystem_SDL_Symbian *>(g_system)->FsSession(), fname);
+ BaflUtils::EnsurePathExistsL(FsSession(), fname);
ConfMan.setBool("FM_high_quality", false);
#if !defined(S60) || defined(S60V3) // S60 has low quality as default
@@ -163,11 +162,6 @@ bool OSystem_SDL_Symbian::hasFeature(Feature f) {
return OSystem_SDL::hasFeature(f);
}
-
-RFs& OSystem_SDL_Symbian::FsSession() {
- return _RFs;
-}
-
Common::KeymapperDefaultBindings *OSystem_SDL_Symbian::getKeymapperDefaultBindings(){
Common::KeymapperDefaultBindings *keymapperDefaultBindings = new Common::KeymapperDefaultBindings();
keymapperDefaultBindings->setDefaultBinding(Common::kGlobalKeymapName, "MENU", "ASTERISK");
@@ -195,4 +189,9 @@ void* scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size
return NULL;
}
+/** Provide access to file server session. Lifetime managed bu UI framework. */
+RFs& FsSession() {
+ return CEikonEnv::Static()->FsSession();
+}
+
extern "C" void __sync_synchronize(){}
diff --git a/backends/platform/symbian/src/SymbianOS.h b/backends/platform/symbian/src/SymbianOS.h
index 2d034da681..f55fde74a0 100644
--- a/backends/platform/symbian/src/SymbianOS.h
+++ b/backends/platform/symbian/src/SymbianOS.h
@@ -37,11 +37,6 @@ public:
virtual Common::String getDefaultConfigFileName() override;
virtual bool hasFeature(Feature f) override;
- /**
- * Returns reference to File session
- */
- RFs& FsSession();
-
void quitWithErrorMsg(const char *msg);
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
@@ -49,8 +44,9 @@ public:
Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() override;
protected:
- RFs &_RFs;
TFileName _localpath;
};
+RFs& FsSession();
+
#endif
More information about the Scummvm-git-logs
mailing list