summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp48
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp14
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify.cpp9
-rw-r--r--src/corelib/io/qloggingregistry.cpp11
-rw-r--r--src/corelib/io/qloggingregistry_p.h1
-rw-r--r--src/corelib/io/qprocess.cpp6
-rw-r--r--src/corelib/io/qprocess_p.h5
-rw-r--r--src/corelib/io/qprocess_unix.cpp85
-rw-r--r--src/corelib/io/qsettings.cpp13
-rw-r--r--src/corelib/io/qstandardpaths_winrt.cpp1
11 files changed, 101 insertions, 94 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 989e4644c7..f651860e08 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -148,7 +148,7 @@ win32 {
}
} else:blackberry {
SOURCES += io/qstandardpaths_blackberry.cpp
- } else:android {
+ } else:android:!android-no-sdk {
SOURCES += io/qstandardpaths_android.cpp
} else {
SOURCES += io/qstandardpaths_unix.cpp
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index ea3a3ca13d..6c0f31fb55 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>>
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -89,35 +89,23 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
QFileInfo info(entry.filePath());
QString suffix = info.suffix();
- // First step: is the extenstion known ?
- if (suffix == QLatin1String("app")
- || suffix == QLatin1String("debug")
- || suffix == QLatin1String("profile")
- || suffix == QLatin1String("bundle")
- || suffix == QLatin1String("pkg")) {
- return true;
- }
-
- // Second step: check if an application knows the package type
- const QByteArray &native = entry.nativeFilePath();
- const char *nativeFilePath = native.constData();
- int nativeFilePathLength = native.size();
-
- QCFType<CFStringRef> path = CFStringCreateWithBytes(0,
- reinterpret_cast<const UInt8*>(nativeFilePath),
- nativeFilePathLength,
- kCFStringEncodingUTF8,
- false);
-
- QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
-
- UInt32 type, creator;
- // Well created packages have the PkgInfo file
- if (CFBundleGetPackageInfoInDirectory(url, &type, &creator))
- return true;
-
- // Find if an application other than Finder claims to know how to handle the package
if (suffix.length() > 0) {
+ // First step: is the extension known ?
+ CFStringRef extensionRef = QCFString::toCFStringRef(suffix);
+ CFStringRef uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
+ if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
+ return true;
+
+ // Second step: check if an application knows the package type
+ CFStringRef path = QCFString::toCFStringRef(entry.filePath());
+ QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
+
+ UInt32 type, creator;
+ // Well created packages have the PkgInfo file
+ if (CFBundleGetPackageInfoInDirectory(url, &type, &creator))
+ return true;
+
+ // Find if an application other than Finder claims to know how to handle the package
QCFType<CFURLRef> application;
LSGetApplicationForURL(url,
kLSRolesEditor|kLSRolesViewer|kLSRolesViewer,
@@ -134,7 +122,7 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
// Third step: check if the directory has the package bit set
FSRef packageRef;
- FSPathMakeRef((UInt8 *)nativeFilePath, &packageRef, NULL);
+ FSPathMakeRef((UInt8 *)entry.nativeFilePath().constData(), &packageRef, NULL);
FSCatalogInfo catalogInfo;
FSGetCatalogInfo(&packageRef,
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index dbc6d28846..7741eb4c1e 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -74,6 +74,8 @@
# define SECURITY_WIN32
# include <security.h>
#else // !Q_OS_WINRT
+# include "qstandardpaths.h"
+# include "qthreadstorage.h"
# include <wrl.h>
# include <windows.foundation.h>
# include <windows.storage.h>
@@ -1151,6 +1153,18 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
bool existed = false;
if (isDirPath(chunk, &existed) && existed)
continue;
+#ifdef Q_OS_WINRT
+ static QThreadStorage<QString> dataLocation;
+ if (!dataLocation.hasLocalData())
+ dataLocation.setLocalData(QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DataLocation)));
+ static QThreadStorage<QString> tempLocation;
+ if (!tempLocation.hasLocalData())
+ tempLocation.setLocalData(QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::TempLocation)));
+ // We try to create something outside the sandbox, which is forbidden
+ // However we could still try to pass into the sandbox
+ if (dataLocation.localData().startsWith(chunk) || tempLocation.localData().startsWith(chunk))
+ continue;
+#endif
}
return false;
}
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 5fd20c6d74..3031c7a27e 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -138,6 +138,11 @@
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
# define __NR_inotify_init1 328
+#elif defined (__aarch64__)
+# define __NR_inotify_init1 26
+# define __NR_inotify_add_watch 27
+# define __NR_inotify_rm_watch 28
+// no inotify_init for aarch64
#else
# error "This architecture is not supported. Please see http://www.qt-project.org/"
#endif
@@ -155,7 +160,11 @@ static inline int syscall(...) { return -1; }
static inline int inotify_init()
{
+#ifdef __NR_inotify_init
return syscall(__NR_inotify_init);
+#else
+ return syscall(__NR_inotify_init1, 0);
+#endif
}
static inline int inotify_add_watch(int fd, const char *name, __u32 mask)
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 23f1ffbd16..7e6883fd14 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -62,7 +62,6 @@ Q_GLOBAL_STATIC(QLoggingRegistry, qtLoggingRegistry)
Constructs a logging rule with default values.
*/
QLoggingRule::QLoggingRule() :
- flags(Invalid),
enabled(false)
{
}
@@ -73,7 +72,6 @@ QLoggingRule::QLoggingRule() :
*/
QLoggingRule::QLoggingRule(const QStringRef &pattern, bool enabled) :
messageType(-1),
- flags(Invalid),
enabled(enabled)
{
parse(pattern);
@@ -147,7 +145,6 @@ void QLoggingRule::parse(const QStringRef &pattern)
p = pattern;
}
- flags = Invalid;
if (!p.contains(QLatin1Char('*'))) {
flags = FullText;
} else {
@@ -160,7 +157,7 @@ void QLoggingRule::parse(const QStringRef &pattern)
p = QStringRef(p.string(), p.position() + 1, p.length() - 1);
}
if (p.contains(QLatin1Char('*'))) // '*' only supported at start/end
- flags = Invalid;
+ flags = 0;
}
category = p.toString();
@@ -224,7 +221,11 @@ void QLoggingSettingsParser::setContent(QTextStream &stream)
const QStringRef value = line.midRef(equalPos + 1);
bool enabled = (value.compare(QLatin1String("true"),
Qt::CaseInsensitive) == 0);
- _rules.append(QLoggingRule(pattern, enabled));
+ QLoggingRule rule(pattern, enabled);
+ if (rule.flags != 0)
+ _rules.append(rule);
+ else
+ warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData());
}
}
}
diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index 21896bb268..48804cfc2b 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -72,7 +72,6 @@ public:
int pass(const QString &categoryName, QtMsgType type) const;
enum PatternFlag {
- Invalid = 0x0,
FullText = 0x1,
LeftFilter = 0x2,
RightFilter = 0x4,
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 3b78351809..18391703da 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -165,7 +165,7 @@ QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list
QStringList::ConstIterator it = list.constBegin(),
end = list.constEnd();
for ( ; it != end; ++it) {
- int pos = it->indexOf(QLatin1Char('='));
+ int pos = it->indexOf(QLatin1Char('='), 1);
if (pos < 1)
continue;
@@ -2227,6 +2227,8 @@ void QProcess::start(const QString &command, OpenMode mode)
}
/*!
+ \since 5.0
+
Returns the program the process was last started with.
\sa start()
@@ -2256,6 +2258,8 @@ void QProcess::setProgram(const QString &program)
}
/*!
+ \since 5.0
+
Returns the command line arguments the process was last started with.
\sa start()
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 219bdf8200..5d65b2a068 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -390,6 +390,11 @@ public:
qint64 writeToStdin(const char *data, qint64 maxlen);
void cleanup();
+
+#ifdef Q_OS_BLACKBERRY
+ QList<QSocketNotifier *> defaultNotifiers() const;
+#endif // Q_OS_BLACKBERRY
+
#ifdef Q_OS_UNIX
static void initializeProcessManager();
#endif
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 0e917ef438..8674371baa 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1042,17 +1042,6 @@ void QProcessPrivate::killProcess()
::kill(pid_t(pid), SIGKILL);
}
-static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
-{
- if (timeout < 0)
- return qt_safe_select(nfds, fdread, fdwrite, 0, 0);
-
- struct timespec tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_nsec = (timeout % 1000) * 1000 * 1000;
- return qt_safe_select(nfds, fdread, fdwrite, 0, &tv);
-}
-
/*
Returns the difference between msecs and elapsed. If msecs is -1,
however, -1 is returned.
@@ -1066,41 +1055,6 @@ static int qt_timeout_value(int msecs, int elapsed)
return timeout < 0 ? 0 : timeout;
}
-#ifdef Q_OS_BLACKBERRY
-// The BlackBerry event dispatcher uses bps_get_event. Unfortunately, already registered
-// socket notifiers are disabled by a call to select. This is to rearm the standard streams.
-static int bb_select(QProcessPrivate *process, int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
-{
- bool stdoutEnabled = false;
- bool stderrEnabled = false;
- bool stdinEnabled = false;
-
- if (process->stdoutChannel.notifier && process->stdoutChannel.notifier->isEnabled()) {
- stdoutEnabled = true;
- process->stdoutChannel.notifier->setEnabled(false);
- }
- if (process->stderrChannel.notifier && process->stderrChannel.notifier->isEnabled()) {
- stderrEnabled = true;
- process->stderrChannel.notifier->setEnabled(false);
- }
- if (process->stdinChannel.notifier && process->stdinChannel.notifier->isEnabled()) {
- stdinEnabled = true;
- process->stdinChannel.notifier->setEnabled(false);
- }
-
- const int ret = select_msecs(nfds, fdread, fdwrite, timeout);
-
- if (stdoutEnabled)
- process->stdoutChannel.notifier->setEnabled(true);
- if (stderrEnabled)
- process->stderrChannel.notifier->setEnabled(true);
- if (stdinEnabled)
- process->stdinChannel.notifier->setEnabled(true);
-
- return ret;
-}
-#endif // Q_OS_BLACKBERRY
-
bool QProcessPrivate::waitForStarted(int msecs)
{
Q_Q(QProcess);
@@ -1113,7 +1067,7 @@ bool QProcessPrivate::waitForStarted(int msecs)
fd_set fds;
FD_ZERO(&fds);
FD_SET(childStartedPipe[0], &fds);
- if (select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
+ if (qt_select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
processError = QProcess::Timedout;
q->setErrorString(QProcess::tr("Process operation timed out"));
#if defined (QPROCESS_DEBUG)
@@ -1129,6 +1083,17 @@ bool QProcessPrivate::waitForStarted(int msecs)
return startedEmitted;
}
+#ifdef Q_OS_BLACKBERRY
+QList<QSocketNotifier *> QProcessPrivate::defaultNotifiers() const
+{
+ QList<QSocketNotifier *> notifiers;
+ notifiers << stdoutChannel.notifier
+ << stderrChannel.notifier
+ << stdinChannel.notifier;
+ return notifiers;
+}
+#endif // Q_OS_BLACKBERRY
+
bool QProcessPrivate::waitForReadyRead(int msecs)
{
Q_Q(QProcess);
@@ -1139,6 +1104,10 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
+#ifdef Q_OS_BLACKBERRY
+ QList<QSocketNotifier *> notifiers = defaultNotifiers();
+#endif
+
forever {
fd_set fdread;
fd_set fdwrite;
@@ -1162,9 +1131,9 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
#ifdef Q_OS_BLACKBERRY
- int ret = bb_select(this, nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout);
#else
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = qt_select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
#endif
if (ret < 0) {
break;
@@ -1215,6 +1184,10 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
+#ifdef Q_OS_BLACKBERRY
+ QList<QSocketNotifier *> notifiers = defaultNotifiers();
+#endif
+
while (!writeBuffer.isEmpty()) {
fd_set fdread;
fd_set fdwrite;
@@ -1239,9 +1212,9 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
#ifdef Q_OS_BLACKBERRY
- int ret = bb_select(this, nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout);
#else
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = qt_select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
#endif
if (ret < 0) {
break;
@@ -1286,6 +1259,10 @@ bool QProcessPrivate::waitForFinished(int msecs)
QElapsedTimer stopWatch;
stopWatch.start();
+#ifdef Q_OS_BLACKBERRY
+ QList<QSocketNotifier *> notifiers = defaultNotifiers();
+#endif
+
forever {
fd_set fdread;
fd_set fdwrite;
@@ -1310,9 +1287,9 @@ bool QProcessPrivate::waitForFinished(int msecs)
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
#ifdef Q_OS_BLACKBERRY
- int ret = bb_select(this, nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout);
#else
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
+ int ret = qt_select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
#endif
if (ret < 0) {
break;
@@ -1349,7 +1326,7 @@ bool QProcessPrivate::waitForWrite(int msecs)
fd_set fdwrite;
FD_ZERO(&fdwrite);
FD_SET(stdinChannel.pipe[1], &fdwrite);
- return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
+ return qt_select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
}
void QProcessPrivate::findExitCode()
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index a3727a6a4b..0406aeb501 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2369,6 +2369,10 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
stored in the following registry path:
\c{HKEY_LOCAL_MACHINE\Software\WOW6432node}.
+ On BlackBerry only a single file is used (see \l{Platform Limitations}).
+ If the file format is NativeFormat, this is "Settings/MySoft/Star Runner.conf"
+ in the application's home directory.
+
If the file format is IniFormat, the following files are
used on Unix and Mac OS X:
@@ -2393,8 +2397,12 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
%COMMON_APPDATA% path is usually \tt{C:\\Documents and
Settings\\All Users\\Application Data}.
+ On BlackBerry only a single file is used (see \l{Platform Limitations}).
+ If the file format is IniFormat, this is "Settings/MySoft/Star Runner.ini"
+ in the application's home directory.
+
The paths for the \c .ini and \c .conf files can be changed using
- setPath(). On Unix and Mac OS X, the user can override them by by
+ setPath(). On Unix and Mac OS X, the user can override them by
setting the \c XDG_CONFIG_HOME environment variable; see
setPath() for details.
@@ -2498,7 +2506,8 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
allowed to read or write outside of this sandbox. This involves the
following limitations:
\list
- \li As there is only a single scope the scope is simply ignored.
+ \li As there is only a single scope the scope is simply ignored,
+ i.e. there is no difference between SystemScope and UserScope.
\li The \l{Fallback Mechanism} is not applied, i.e. only a single
location is considered.
\li It is advised against setting and using custom file paths.
diff --git a/src/corelib/io/qstandardpaths_winrt.cpp b/src/corelib/io/qstandardpaths_winrt.cpp
index 9b6a088a30..bd72de11bb 100644
--- a/src/corelib/io/qstandardpaths_winrt.cpp
+++ b/src/corelib/io/qstandardpaths_winrt.cpp
@@ -74,6 +74,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
switch (type) {
case ConfigLocation: // same as DataLocation, on Windows
+ case GenericConfigLocation: // same as GenericDataLocation, on Windows
case DataLocation:
case GenericDataLocation: {
ComPtr<IApplicationDataStatics> applicationDataStatics;