summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-02-14 15:49:08 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-02-14 15:49:08 +0000
commit7bc1d6effaae8f5aa1bef92cb1094ec3b3f4fb95 (patch)
treecde8deeea717fc25d64640d96cf13a4fd44d9db1 /src/corelib/io
parent2aeb2bcef48d7bca2186c262dde433737956a539 (diff)
parent305dd1b61f657474d751cc3b24f58249ec21b61b (diff)
Merge "Merge remote-tracking branch 'origin/5.9' into 5.11" into refs/staging/5.11
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qloggingregistry.cpp10
-rw-r--r--src/corelib/io/qprocess_win.cpp3
-rw-r--r--src/corelib/io/qsettings.cpp5
-rw-r--r--src/corelib/io/qstandardpaths_android.cpp15
-rw-r--r--src/corelib/io/qurlrecode.cpp4
6 files changed, 33 insertions, 6 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index c6a5973306..d138ab2f00 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -159,7 +159,7 @@ win32 {
} else {
LIBS += -framework MobileCoreServices
}
- } else:android {
+ } else:android:!android-embedded {
SOURCES += \
io/qstandardpaths_android.cpp \
io/qstorageinfo_unix.cpp
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index b5f8e30b80..cd97268d71 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qstandardpaths.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qdir.h>
+#include <QtCore/qcoreapplication.h>
// We can't use the default macros because this would lead to recursion.
// Instead let's define our own one that unconditionally logs...
@@ -255,6 +256,15 @@ void QLoggingSettingsParser::parseNextLine(QStringRef line)
QLoggingRegistry::QLoggingRegistry()
: categoryFilter(defaultCategoryFilter)
{
+#if defined(Q_OS_ANDROID)
+ // Unless QCoreApplication has been constructed we can't be sure that
+ // we are on Qt's main thread. If we did allow logging here, we would
+ // potentially set Qt's main thread to Android's thread 0, which would
+ // confuse Qt later when running main().
+ if (!qApp)
+ return;
+#endif
+
initializeRules(); // Init on first use
}
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 6ab806d9fe..3a62a67e3b 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -101,7 +101,8 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
unsigned int attempts = 1000;
forever {
_snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]),
- L"\\\\.\\pipe\\qt-%X", QRandomGenerator::global()->generate());
+ L"\\\\.\\pipe\\qt-%lX-%X", long(QCoreApplication::applicationPid()),
+ QRandomGenerator::global()->generate());
DWORD dwOpenMode = FILE_FLAG_OVERLAPPED;
DWORD dwOutputBufferSize = 0;
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index bbc66120b5..4b1b9888d8 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2366,6 +2366,11 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
limitations is to store the settings using the IniFormat
instead of the NativeFormat.
+ \li On Windows, when the Windows system registry is used, QSettings
+ does not preserve the original type of the value. Therefore,
+ the type of the value might change when a new value is set. For
+ example, a value with type \c REG_EXPAND_SZ will change to \c REG_SZ.
+
\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.
diff --git a/src/corelib/io/qstandardpaths_android.cpp b/src/corelib/io/qstandardpaths_android.cpp
index 2a44daf8b5..0667d170c7 100644
--- a/src/corelib/io/qstandardpaths_android.cpp
+++ b/src/corelib/io/qstandardpaths_android.cpp
@@ -217,7 +217,16 @@ static QString getFilesDir()
if (!path.isEmpty())
return path;
- return (path = QDir::homePath());
+ QJNIObjectPrivate appCtx = applicationContext();
+ if (!appCtx.isValid())
+ return QString();
+
+ QJNIObjectPrivate file = appCtx.callObjectMethod("getFilesDir",
+ "()Ljava/io/File;");
+ if (!file.isValid())
+ return QString();
+
+ return (path = getAbsolutePath(file));
}
QString QStandardPaths::writableLocation(StandardLocation type)
@@ -319,7 +328,9 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (!ba.isEmpty())
return QStringList((fontLocation = QDir::cleanPath(QString::fromLocal8Bit(ba))));
- return QStringList((fontLocation = QLatin1String("/system/fonts")));
+ // Don't cache the fallback, as we might just have been called before
+ // QT_ANDROID_FONT_LOCATION has been set.
+ return QStringList(QLatin1String("/system/fonts"));
}
return QStringList(writableLocation(type));
diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp
index ce90ab49d3..a9b23babc0 100644
--- a/src/corelib/io/qurlrecode.cpp
+++ b/src/corelib/io/qurlrecode.cpp
@@ -511,7 +511,7 @@ static int decode(QString &appendTo, const ushort *begin, const ushort *end)
if (Q_UNLIKELY(end - input < 3 || !isHex(input[1]) || !isHex(input[2]))) {
// badly-encoded data
appendTo.resize(origSize + (end - begin));
- memcpy(appendTo.begin() + origSize, begin, (end - begin) * sizeof(ushort));
+ memcpy(static_cast<void *>(appendTo.begin() + origSize), static_cast<const void *>(begin), (end - begin) * sizeof(ushort));
return end - begin;
}
@@ -519,7 +519,7 @@ static int decode(QString &appendTo, const ushort *begin, const ushort *end)
// detach
appendTo.resize(origSize + (end - begin));
output = reinterpret_cast<ushort *>(appendTo.begin()) + origSize;
- memcpy(output, begin, (input - begin) * sizeof(ushort));
+ memcpy(static_cast<void *>(output), static_cast<const void *>(begin), (input - begin) * sizeof(ushort));
output += input - begin;
}