summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-22 11:30:00 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-22 11:30:01 +0200
commitd314819fc02139e05e16c56657898c704f7fb48f (patch)
treea61ba968233634948401c8339f9613844de1c2b5 /src/corelib/io
parent9f888d2fde9c5413e5519e0914e9b13638760985 (diff)
parente0e9e196a72ffe5457034894eaaadc90ed0d34ef (diff)
Merge dev into 5.8
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri4
-rw-r--r--src/corelib/io/qabstractfileengine.cpp2
-rw-r--r--src/corelib/io/qdebug.h4
-rw-r--r--src/corelib/io/qfileinfo.cpp8
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp2
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qlockfile_unix.cpp6
-rw-r--r--src/corelib/io/qloggingcategory.cpp2
-rw-r--r--src/corelib/io/qprocess.cpp8
-rw-r--r--src/corelib/io/qsettings.cpp44
-rw-r--r--src/corelib/io/qstandardpaths.cpp4
-rw-r--r--src/corelib/io/qstandardpaths.h7
-rw-r--r--src/corelib/io/qstorageinfo.cpp2
-rw-r--r--src/corelib/io/qurl.cpp26
14 files changed, 68 insertions, 53 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index ab345e9aae..0414ae966a 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -135,7 +135,7 @@ win32 {
io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp
- !integrity:!tvos {
+ !integrity:!uikit {
SOURCES += io/forkfd_qt.cpp
HEADERS += \
../3rdparty/forkfd/forkfd.h
@@ -169,7 +169,7 @@ win32 {
io/qstorageinfo_unix.cpp
}
- linux|if(qnx:contains(QT_CONFIG, inotify)) {
+ linux|if(qnx:qtConfig(inotify)) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
}
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp
index 7e64035b30..9606ec68e9 100644
--- a/src/corelib/io/qabstractfileengine.cpp
+++ b/src/corelib/io/qabstractfileengine.cpp
@@ -305,7 +305,7 @@ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName)
the file system (i.e. not a file or directory).
\value FileType The file is a regular file to the file system
(i.e. not a link or directory)
- \value BundleType OS X and iOS: the file is a bundle; implies DirectoryType
+ \value BundleType \macos and iOS: the file is a bundle; implies DirectoryType
\value DirectoryType The file is a directory in the file system
(i.e. not a link or file).
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 8021f29e16..abc2abeaec 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -438,8 +438,8 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
#define QT_FORWARD_DECLARE_CF_TYPE(type) Q_FORWARD_DECLARE_CF_TYPE(type);
#define QT_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type);
-#define QT_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
-#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
+#define QT_FORWARD_DECLARE_CG_TYPE(type) Q_FORWARD_DECLARE_CG_TYPE(type);
+#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type);
QT_END_NAMESPACE
Q_FORWARD_DECLARE_CF_TYPE(CFString);
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 6366c5120c..8b9efb638a 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -240,7 +240,7 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
isSymLink(). The symLinkTarget() function provides the name of the file
the symlink points to.
- On Unix (including OS X and iOS), the symlink has the same size() has
+ On Unix (including \macos and iOS), the symlink has the same size() has
the file it points to, because Unix handles symlinks
transparently; similarly, opening a symlink using QFile
effectively opens the link's target. For example:
@@ -760,7 +760,7 @@ QString QFileInfo::fileName() const
\since 4.3
Returns the name of the bundle.
- On OS X and iOS this returns the proper localized name for a bundle if the
+ On \macos and iOS this returns the proper localized name for a bundle if the
path isBundle(). On all other platforms an empty QString is returned.
Example:
@@ -1042,7 +1042,7 @@ bool QFileInfo::isDir() const
/*!
\since 4.3
Returns \c true if this object points to a bundle or to a symbolic
- link to a bundle on OS X and iOS; otherwise returns \c false.
+ link to a bundle on \macos and iOS; otherwise returns \c false.
\sa isDir(), isSymLink(), isFile()
*/
@@ -1063,7 +1063,7 @@ bool QFileInfo::isBundle() const
Returns \c true if this object points to a symbolic link (or to a
shortcut on Windows); otherwise returns \c false.
- On Unix (including OS X and iOS), opening a symlink effectively opens
+ On Unix (including \macos and iOS), opening a symlink effectively opens
the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c
.lnk file itself.
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 55f4bddd17..d3aef27296 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -191,7 +191,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re
the file system monitor. Also note that your process may have
other file descriptors open in addition to the ones for files
being monitored, and these other open descriptors also count in
- the total. OS X uses a different backend and does not
+ the total. \macos uses a different backend and does not
suffer from this issue.
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index fbee1a223f..c560bc7a03 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -907,7 +907,7 @@ void QIODevicePrivate::seekBuffer(qint64 newPos)
For some devices, atEnd() can return true even though there is more data
to read. This special case only applies to devices that generate data in
direct response to you calling read() (e.g., \c /dev or \c /proc files on
- Unix and OS X, or console input / \c stdin on all platforms).
+ Unix and \macos, or console input / \c stdin on all platforms).
\sa bytesAvailable(), read(), isSequential()
*/
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 924d2e7214..82beb15912 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -141,7 +141,7 @@ static QBasicMutex fcntlLock;
/*!
\internal
Checks that the OS isn't using POSIX locks to emulate flock().
- OS X is one of those.
+ \macos is one of those.
*/
static bool fcntlWorksAfterFlock(const QString &fn)
{
@@ -188,7 +188,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
% localHostName() % '\n';
const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
+ const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd < 0) {
switch (errno) {
case EEXIST:
@@ -229,7 +229,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
bool QLockFilePrivate::removeStaleLock()
{
const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0644);
+ const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0666);
if (fd < 0) // gone already?
return false;
bool success = setNativeLocks(fileName, fd) && (::unlink(lockFileName) == 0);
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index afdf0d0312..967a614a2d 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -183,7 +183,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
by QStandardPaths::GenericConfigLocation, e.g.
\list
- \li on OS X and iOS: \c ~/Library/Preferences
+ \li on \macos and iOS: \c ~/Library/Preferences
\li on Unix: \c ~/.config, \c /etc/xdg
\li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%,
\l QCoreApplication::applicationDirPath(),
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ebafd6b524..f9b3b9fb00 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1948,7 +1948,7 @@ void QProcess::setProcessState(ProcessState state)
/*!
This function is called in the child process context just before the
- program is executed on Unix or OS X (i.e., after \c fork(), but before
+ program is executed on Unix or \macos (i.e., after \c fork(), but before
\c execve()). Reimplement this function to do last minute initialization
of the child process. Example:
@@ -1959,7 +1959,7 @@ void QProcess::setProcessState(ProcessState state)
execution, your workaround is to emit finished() and then call
exit().
- \warning This function is called by QProcess on Unix and OS X
+ \warning This function is called by QProcess on Unix and \macos
only. On Windows and QNX, it is not called.
*/
void QProcess::setupChildProcess()
@@ -2350,7 +2350,7 @@ void QProcess::setArguments(const QStringList &arguments)
On Windows, terminate() posts a WM_CLOSE message to all top-level windows
of the process and then to the main thread of the process itself. On Unix
- and OS X the \c SIGTERM signal is sent.
+ and \macos the \c SIGTERM signal is sent.
Console applications on Windows that do not run an event loop, or whose
event loop does not handle the WM_CLOSE message, can only be terminated by
@@ -2367,7 +2367,7 @@ void QProcess::terminate()
/*!
Kills the current process, causing it to exit immediately.
- On Windows, kill() uses TerminateProcess, and on Unix and OS X, the
+ On Windows, kill() uses TerminateProcess, and on Unix and \macos, the
SIGKILL signal is sent to the process.
\sa terminate()
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 11f201344e..ffcb2e2d72 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1917,7 +1917,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
Users normally expect an application to remember its settings
(window sizes and positions, options, etc.) across sessions. This
information is often stored in the system registry on Windows,
- and in property list files on OS X and iOS. On Unix systems, in the
+ and in property list files on \macos and iOS. On Unix systems, in the
absence of a standard, many applications (including the KDE
applications) use INI text files.
@@ -1962,8 +1962,8 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\snippet settings/settings.cpp 4
(Here, we also specify the organization's Internet domain. When
- the Internet domain is set, it is used on OS X and iOS instead of the
- organization name, since OS X and iOS applications conventionally use
+ the Internet domain is set, it is used on \macos and iOS instead of the
+ organization name, since \macos and iOS applications conventionally use
Internet domains to identify themselves. If no domain is set, a
fake domain is derived from the organization name. See the
\l{Platform-Specific Notes} below for details.)
@@ -2021,7 +2021,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
Setting keys can contain any Unicode characters. The Windows
registry and INI files use case-insensitive keys, whereas the
- CFPreferences API on OS X and iOS uses case-sensitive keys. To
+ CFPreferences API on \macos and iOS uses case-sensitive keys. To
avoid portability problems, follow these simple rules:
\list 1
@@ -2195,7 +2195,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\li \c{/etc/xdg/MySoft.conf}
\endlist
- On Mac OS X versions 10.2 and 10.3, these files are used by
+ On \macos versions 10.2 and 10.3, these files are used by
default:
\list 1
@@ -2223,7 +2223,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
in the application's home directory.
If the file format is IniFormat, the following files are
- used on Unix, OS X, and iOS:
+ used on Unix, \macos, and iOS:
\list 1
\li \c{$HOME/.config/MySoft/Star Runner.ini} (Qt for Embedded Linux: \c{$HOME/Settings/MySoft/Star Runner.ini})
@@ -2250,7 +2250,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
in the application's home directory.
The paths for the \c .ini and \c .conf files can be changed using
- setPath(). On Unix, OS X, and iOS the user can override them by
+ setPath(). On Unix, \macos, and iOS the user can override them by
setting the \c XDG_CONFIG_HOME environment variable; see
setPath() for details.
@@ -2267,7 +2267,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
You can then use the QSettings object to read and write settings
in the file.
- On OS X and iOS, you can access property list \c .plist files by passing
+ On \macos and iOS, you can access property list \c .plist files by passing
QSettings::NativeFormat as second argument. For example:
\snippet code/src_corelib_io_qsettings.cpp 3
@@ -2321,13 +2321,13 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
limitations is to store the settings using the IniFormat
instead of the NativeFormat.
- \li On OS X and iOS, allKeys() will return some extra keys for global
+ \li On \macos and iOS, allKeys() will return some extra keys for global
settings that apply to all applications. These keys can be
read using value() but cannot be changed, only shadowed.
Calling setFallbacksEnabled(false) will hide these global
settings.
- \li On OS X and iOS, the CFPreferences API used by QSettings expects
+ \li On \macos and iOS, the CFPreferences API used by QSettings expects
Internet domain names rather than organization names. To
provide a uniform API, QSettings derives a fake domain name
from the organization name (unless the organization name
@@ -2344,7 +2344,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\snippet code/src_corelib_io_qsettings.cpp 7
- \li On OS X, permissions to access settings not belonging to the
+ \li On \macos, permissions to access settings not belonging to the
current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to
that version, users having admin rights could access these. For 10.7 and
10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
@@ -2373,7 +2373,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\value NativeFormat Store the settings using the most
appropriate storage format for the platform.
On Windows, this means the system registry;
- on OS X and iOS, this means the CFPreferences
+ on \macos and iOS, this means the CFPreferences
API; on Unix, this means textual
configuration files in INI format.
\value Registry32Format Windows only: Explicitly access the 32-bit system registry
@@ -2546,7 +2546,7 @@ QSettings::QSettings(Format format, Scope scope, const QString &organization,
If \a format is QSettings::NativeFormat, the meaning of \a
fileName depends on the platform. On Unix, \a fileName is the
- name of an INI file. On OS X and iOS, \a fileName is the name of a
+ name of an INI file. On \macos and iOS, \a fileName is the name of a
\c .plist file. On Windows, \a fileName is a path in the system
registry.
@@ -2599,7 +2599,7 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent)
called, the QSettings object will not be able to read or write
any settings, and status() will return AccessError.
- On OS X and iOS, if both a name and an Internet domain are specified
+ On \macos and iOS, if both a name and an Internet domain are specified
for the organization, the domain is preferred over the name. On
other platforms, the name is preferred over the domain.
@@ -3115,7 +3115,7 @@ bool QSettings::isWritable() const
exists, the previous value is overwritten.
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3154,7 +3154,7 @@ void QSettings::setValue(const QString &key, const QVariant &value)
\snippet code/src_corelib_io_qsettings.cpp 25
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3189,7 +3189,7 @@ void QSettings::remove(const QString &key)
relative to that group.
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3251,7 +3251,7 @@ bool QSettings::event(QEvent *event)
returned.
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3354,18 +3354,18 @@ void QSettings::setUserIniPath(const QString &dir)
\row \li SystemScope \li \c /etc/xdg
\row \li{1,2} Qt for Embedded Linux \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/Settings
\row \li SystemScope \li \c /etc/xdg
- \row \li{1,2} OS X and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config
+ \row \li{1,2} \macos and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config
\row \li SystemScope \li \c /etc/xdg
\endtable
- The default UserScope paths on Unix, OS X, and iOS (\c
+ The default UserScope paths on Unix, \macos, and iOS (\c
$HOME/.config or $HOME/Settings) can be overridden by the user by setting the
\c XDG_CONFIG_HOME environment variable. The default SystemScope
- paths on Unix, OS X, and iOS (\c /etc/xdg) can be overridden when
+ paths on Unix, \macos, and iOS (\c /etc/xdg) can be overridden when
building the Qt library using the \c configure script's \c
-sysconfdir flag (see QLibraryInfo for details).
- Setting the NativeFormat paths on Windows, OS X, and iOS has no
+ Setting the NativeFormat paths on Windows, \macos, and iOS has no
effect.
\warning This function doesn't affect existing QSettings objects.
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 02318d427a..4cf3a3e9bd 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -153,7 +153,7 @@ QT_BEGIN_NAMESPACE
paths, if any, represent non-writable locations.
\table
- \header \li Path type \li OS X \li Windows
+ \header \li Path type \li \macos \li Windows
\row \li DesktopLocation
\li "~/Desktop"
\li "C:/Users/<USER>/Desktop"
@@ -609,7 +609,7 @@ QString QStandardPaths::displayName(StandardLocation type)
On Unix, \c XDG_DATA_HOME is set to \e ~/.qttest/share, \c XDG_CONFIG_HOME is
set to \e ~/.qttest/config, and \c XDG_CACHE_HOME is set to \e ~/.qttest/cache.
- On OS X, data goes to \e ~/.qttest/Application Support, cache goes to
+ On \macos, data goes to \e ~/.qttest/Application Support, cache goes to
\e ~/.qttest/Cache, and config goes to \e ~/.qttest/Preferences.
On Windows, everything goes to a "qttest" directory under Application Data.
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index fff1a29bf3..df76d73eae 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -41,6 +41,7 @@
#define QSTANDARDPATHS_H
#include <QtCore/qstringlist.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -49,6 +50,8 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QStandardPaths
{
+ Q_GADGET
+
public:
// Do not re-order, must match QDesktopServices
enum StandardLocation {
@@ -73,6 +76,7 @@ public:
AppConfigLocation,
AppLocalDataLocation = DataLocation
};
+ Q_ENUM(StandardLocation)
static QString writableLocation(StandardLocation type);
static QStringList standardLocations(StandardLocation type);
@@ -82,6 +86,7 @@ public:
LocateDirectory = 0x1
};
Q_DECLARE_FLAGS(LocateOptions, LocateOption)
+ Q_FLAG(LocateOptions)
static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
@@ -103,6 +108,8 @@ private:
~QStandardPaths();
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions)
+
#endif // QT_NO_STANDARDPATHS
QT_END_NAMESPACE
diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp
index 6faa197491..3773b72606 100644
--- a/src/corelib/io/qstorageinfo.cpp
+++ b/src/corelib/io/qstorageinfo.cpp
@@ -256,7 +256,7 @@ QByteArray QStorageInfo::fileSystemType() const
/*!
Returns the device for this volume.
- For example, on Unix filesystems (including OS X), this returns the
+ For example, on Unix filesystems (including \macos), this returns the
devpath like \c /dev/sda0 for local storages. On Windows, it returns the UNC
path starting with \c \\\\?\\ for local storages (in other words, the volume GUID).
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 71a0228eeb..42a742213b 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -833,7 +833,7 @@ recodeFromUser(const QString &input, const ushort *actions, int from, int to)
// appendXXXX functions: copy from the internal form to the external, user form.
// the internal value is stored in its PrettyDecoded form, so that case is easy.
-static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+static inline void appendToUser(QString &appendTo, const QStringRef &value, QUrl::FormattingOptions options,
const ushort *actions)
{
if (options == QUrl::PrettyDecoded) {
@@ -841,10 +841,17 @@ static inline void appendToUser(QString &appendTo, const QString &value, QUrl::F
return;
}
- if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))
+ if (!qt_urlRecode(appendTo, value.data(), value.end(), options, actions))
appendTo += value;
}
+static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+ const ushort *actions)
+{
+ appendToUser(appendTo, QStringRef(&value), options, actions);
+}
+
+
inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
@@ -924,21 +931,22 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o
if (options & QUrl::NormalizePathSegments) {
thePath = qt_normalizePathSegments(path, false);
}
+
+ QStringRef thePathRef(&thePath);
if (options & QUrl::RemoveFilename) {
const int slash = path.lastIndexOf(QLatin1Char('/'));
if (slash == -1)
return;
- thePath = path.left(slash+1);
+ thePathRef = path.leftRef(slash + 1);
}
// check if we need to remove trailing slashes
if (options & QUrl::StripTrailingSlash) {
- while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/')))
- thePath.chop(1);
+ while (thePathRef.length() > 1 && thePathRef.endsWith(QLatin1Char('/')))
+ thePathRef.chop(1);
}
- appendToUser(appendTo, thePath, options,
+ appendToUser(appendTo, thePathRef, options,
appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? pathInUrl : pathInIsolation);
-
}
inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
@@ -3169,8 +3177,8 @@ QUrl QUrl::resolved(const QUrl &relative) const
if (!relative.d) return *this;
QUrl t;
- // be non strict and allow scheme in relative url
- if (!relative.d->scheme.isEmpty() && relative.d->scheme != d->scheme) {
+ // Compatibility hack (mostly for qtdeclarative) : treat "file:relative.txt" as relative even though QUrl::isRelative() says false
+ if (!relative.d->scheme.isEmpty() && (!relative.isLocalFile() || QDir::isAbsolutePath(relative.d->path))) {
t = relative;
t.detach();
} else {