diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-11-29 13:55:18 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-11-30 11:55:56 (GMT) |
commit | cd3e03f5e70fa6d973949516f50ea05f201aac20 (patch) | |
tree | dcd7028de8ec07ca1df58f3a80ca06ff5147994f /src/corelib/io | |
parent | 9120864d7263cd1ed288770314e387de95d14bf3 (diff) | |
download | Qt-cd3e03f5e70fa6d973949516f50ea05f201aac20.zip Qt-cd3e03f5e70fa6d973949516f50ea05f201aac20.tar.gz Qt-cd3e03f5e70fa6d973949516f50ea05f201aac20.tar.bz2 |
Fix buffered/unbuffered mode issues on symbian
Due to a bug in the symbian file server, files in /resource can't be
opened for unbuffered read, only for default mode read. (it doesn't mask
the cache control flags when doing the security check)
So read will always be done in default mode.
Symptom of this was that QML plugin loading failed as the plugin description
in /resource could not be read.
Buffered or unbuffered writes (i.e. whether the cache should be write
through or write behind) are controlled by the QIODevice::Unbuffered
flag, therefore it needs to be passed through to the file engine.
An optimisation for unix and windows to force unbuffered mode in the file
engine is inappropriate (as that is referring to buffering in the standard
library, which is bypassed entirely by using the low level RFile to open
files on symbian)
Reviewed-by: joao
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfile.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index fac4ac6..85e78a6 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -993,8 +993,14 @@ bool QFile::open(OpenMode mode) return false; } +#ifdef Q_OS_SYMBIAN + // For symbian, the unbuffered flag is used to control write-behind cache behaviour + if (fileEngine()->open(mode)) +#else // QIODevice provides the buffering, so there's no need to request it from the file engine. - if (fileEngine()->open(mode | QIODevice::Unbuffered)) { + if (fileEngine()->open(mode | QIODevice::Unbuffered)) +#endif + { QIODevice::open(mode); if (mode & Append) seek(size()); diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 55388e6..1e1b35b 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -196,8 +196,8 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) if (openMode & QFile::Unbuffered) { if (openMode & QIODevice::WriteOnly) symbianMode |= 0x00001000; //EFileWriteDirectIO; - if (openMode & QIODevice::ReadOnly) - symbianMode |= 0x00004000; //EFileReadDirectIO; + // ### Unbuffered read is not used, because it prevents file open in /resource + // ### and has no obvious benefits } else { if (openMode & QIODevice::WriteOnly) symbianMode |= 0x00000800; //EFileWriteBuffered; |