diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-10 09:07:19 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-10 09:07:19 (GMT) |
commit | a3256014d6adb31c89b0e5de5b0decc393649b70 (patch) | |
tree | cd315ffdb3e35f4040b268e9dc083244da084b2a /src/corelib | |
parent | b17cc4918bfc4b250293000bdabcb8f2dbdec787 (diff) | |
parent | 2c232cdbce3eba095da26362b964f411a9d3ba80 (diff) | |
download | Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.zip Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.tar.gz Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.tar.bz2 |
Merge branch '4.6'
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qfile.h | 2 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 31 | ||||
-rw-r--r-- | src/corelib/kernel/qtimer.h | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qpluginloader.cpp | 15 | ||||
-rw-r--r-- | src/corelib/tools/qmargins.cpp | 1 |
7 files changed, 51 insertions, 12 deletions
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h index b52780d..f65c845 100644 --- a/src/corelib/io/qfile.h +++ b/src/corelib/io/qfile.h @@ -116,7 +116,7 @@ public: static QByteArray encodeName(const QString &fileName); static QString decodeName(const QByteArray &localFileName); inline static QString decodeName(const char *localFileName) - { return decodeName(QByteArray(localFileName)); }; + { return decodeName(QByteArray(localFileName)); } static void setEncodingFunction(EncoderFn); static void setDecodingFunction(DecoderFn); diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index b779aa3..fb096a7 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -157,7 +157,15 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) #endif separatorPos = tmpPath.indexOf(slash, separatorPos + 1); QString prefix = separatorPos == -1 ? tmpPath : tmpPath.left(separatorPos); - if (!nonSymlinks.contains(prefix)) { + if ( +#ifdef Q_OS_SYMBIAN + // Symbian doesn't support directory symlinks, so do not check for link unless we + // are handling the last path element. This not only slightly improves performance, + // but also saves us from lot of unnecessary platform security check failures + // when dealing with files under *:/private directories. + separatorPos == -1 && +#endif + !nonSymlinks.contains(prefix)) { fi.setFile(prefix); if (fi.isSymLink()) { QString target = fi.symLinkTarget(); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 763589a..898447c 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1954,7 +1954,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, #endif if (handle == INVALID_HANDLE_VALUE) { - q->setError(QFile::UnspecifiedError, QLatin1String("No handle on file")); + q->setError(QFile::PermissionsError, qt_error_string(ERROR_ACCESS_DENIED)); return 0; } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 3dbde3f..51e8d00 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1806,18 +1806,35 @@ QString QCoreApplication::applicationDirPath() RProcess proc; TInt err = proc.Open(proc.Id()); if (err == KErrNone) { + QChar driveChar; #if defined(Q_CC_NOKIAX86) // In emulator, always resolve the private dir on C-drive - appPath.append(QChar('C')); + driveChar = QLatin1Char('C'); #else - appPath.append(QChar((proc.FileName())[0])); + driveChar = QLatin1Char((proc.FileName())[0]); #endif - appPath.append(QLatin1String(":\\private\\")); - QString sid; - sid.setNum(proc.SecureId().iId, 16); - appPath.append(sid); - appPath.append(QLatin1Char('\\')); proc.Close(); + + driveChar = driveChar.toUpper(); + + TFileName privatePath; + RFs& fs = qt_s60GetRFs(); + fs.PrivatePath(privatePath); + appPath = qt_TDesC2QString(privatePath); + appPath.prepend(QLatin1Char(':')).prepend(driveChar); + + // Create the appPath if it doesn't exist. Non-existing appPath will cause + // Platform Security violations later on if the app doesn't have AllFiles capability. + // Can't create appPath for ROM unfortunately, so applications meant for + // ROM should always deploy something to their private dir to ensure appPath exists, + // if the PlatSec violations are an issue. + char driveDiff = QLatin1Char('Z').toLatin1() - driveChar.toLatin1(); + TInt driveId = EDriveZ - static_cast<TInt>(driveDiff); + if (driveId != EDriveZ) { + TInt err = fs.CreatePrivatePath(driveId); + if (err != KErrNone) + qWarning("QCoreApplication::applicationDirPath: Failed to create private path."); + } } QFileInfo fi(appPath); diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index c05c4ef..622e9b6 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -84,7 +84,7 @@ public Q_SLOTS: void stop(); #ifdef QT3_SUPPORT - inline QT_MOC_COMPAT void changeInterval(int msec) { start(msec); }; + inline QT_MOC_COMPAT void changeInterval(int msec) { start(msec); } QT_MOC_COMPAT int start(int msec, bool sshot); #endif diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index b71c8b5..23bb07c 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -48,6 +48,11 @@ #include "qdebug.h" #include "qdir.h" +#if defined(Q_OS_SYMBIAN) +# include <f32file.h> +# include "private/qcore_symbian_p.h" +#endif + #ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE @@ -309,10 +314,18 @@ void QPluginLoader::setFileName(const QString &fileName) if (stubPath.at(1).toAscii() == ':') stubPath.remove(0,2); QFileInfoList driveList(QDir::drives()); + RFs rfs = qt_s60GetRFs(); foreach(const QFileInfo& drive, driveList) { QString testFilePath(drive.absolutePath() + stubPath); testFilePath = QDir::cleanPath(testFilePath); - if (QFile::exists(testFilePath)) { + // Use native Symbian code to check for file existence, because checking + // for file from under non-existent protected dir like E:/private/<uid> using + // QFile::exists causes platform security violations on most apps. + QString nativePath = QDir::toNativeSeparators(testFilePath); + TPtrC ptr(qt_QString2TPtrC(nativePath)); + TUint attributes; + TInt err = rfs.Att(ptr, attributes); + if (err == KErrNone) { fn = testFilePath; break; } diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 2150ccb..f5441a3 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE /*! \class QMargins \ingroup painting + \since 4.6 \brief The QMargins class defines the four margins of a rectangle. |