summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-24 13:19:38 +0100
committerLiang Qi <liang.qi@qt.io>2018-01-24 13:38:25 +0100
commitc97eb3e18ec0326a469ef37997f6368cf029c766 (patch)
treebe89410d14c1042f469257f0bdb6448027231413 /src/corelib
parente39a9de3309f84be4101da839a0bacf69090706f (diff)
parent1d9547c9a4b58cadc1105521df27e40ff5945259 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qrandom.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: Icc10543a1f2db5d640d01796bfec70a63517a6b2
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qglobal.cpp6
-rw-r--r--src/corelib/global/qlogging.cpp4
-rw-r--r--src/corelib/global/qoperatingsystemversion.cpp4
-rw-r--r--src/corelib/global/qrandom.cpp8
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/kernel/kernel.pri2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp6
-rw-r--r--src/corelib/plugin/qlibrary.cpp29
-rw-r--r--src/corelib/tools/qsimd_p.h2
-rw-r--r--src/corelib/tools/qstring.cpp6
-rw-r--r--src/corelib/tools/qtimezone.cpp8
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h6
-rw-r--r--src/corelib/tools/tools.pri2
13 files changed, 51 insertions, 34 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 0444926df5..87b79531ed 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -80,7 +80,7 @@
# include <envLib.h>
#endif
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <private/qjni_p.h>
#endif
@@ -2358,7 +2358,7 @@ static bool findUnixOsVersion(QUnixOSVersion &v)
# endif // USE_ETC_OS_RELEASE
#endif // Q_OS_UNIX
-#ifdef Q_OS_ANDROID
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
static const char *osVer_helper(QOperatingSystemVersion)
{
/* Data:
@@ -2839,7 +2839,7 @@ QString QSysInfo::productVersion()
*/
QString QSysInfo::prettyProductName()
{
-#if defined(Q_OS_ANDROID) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN)
+#if (defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)) || defined(Q_OS_DARWIN) || defined(Q_OS_WIN)
const auto version = QOperatingSystemVersion::current();
const char *name = osVer_helper(version);
if (name)
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 0861763492..3206a43599 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1572,7 +1572,7 @@ static void syslog_default_message_handler(QtMsgType type, const char *message)
}
#endif
-#ifdef Q_OS_ANDROID
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
static void android_default_message_handler(QtMsgType type,
const QMessageLogContext &context,
const QString &message)
@@ -1620,7 +1620,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
#elif QT_CONFIG(syslog)
syslog_default_message_handler(type, logMessage.toUtf8().constData());
return;
-#elif defined(Q_OS_ANDROID)
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
android_default_message_handler(type, context, logMessage);
return;
#endif
diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp
index 682c9bab61..4d267e328d 100644
--- a/src/corelib/global/qoperatingsystemversion.cpp
+++ b/src/corelib/global/qoperatingsystemversion.cpp
@@ -45,7 +45,7 @@
#include <qversionnumber.h>
#include <qdebug.h>
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <private/qjni_p.h>
#endif
@@ -163,7 +163,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current()
{
QOperatingSystemVersion version;
version.m_os = currentType();
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#ifndef QT_BOOTSTRAPPED
const QVersionNumber v = QVersionNumber::fromString(QJNIObjectPrivate::getStaticObjectField(
"android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString());
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 0ee6ac9f38..72ba299280 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -74,7 +74,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
}
#endif
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
# include <private/qjni_p.h>
#endif
@@ -1285,7 +1285,7 @@ void QRandomGenerator::_fillRange(void *buffer, void *bufferEnd)
std::generate(begin, end, [this]() { return storage.engine()(); });
}
-#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21)
typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage;
Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
@@ -1314,7 +1314,7 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
*/
void qsrand(uint seed)
{
-#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21)
if (randomTLS->hasLocalData()) {
randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed));
return;
@@ -1370,7 +1370,7 @@ void qsrand(uint seed)
*/
int qrand()
{
-#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) && (__ANDROID_API__ < 21)
AndroidRandomStorage *randomStorage = randomTLS();
if (!randomStorage)
return rand();
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 4614fe2a6b..24f27f6b24 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -165,7 +165,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/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 2336278b17..ca8bd30698 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -200,7 +200,7 @@ qnx:qtConfig(qqnx_pps) {
kernel/qppsobjectprivate_p.h
}
-android {
+android:!android-embedded {
SOURCES += \
kernel/qjnionload.cpp \
kernel/qjnihelpers.cpp \
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 7fd6ab5551..9ec8262bf9 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -95,7 +95,7 @@
#endif
#endif // QT_NO_QOBJECT
-#if defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
# include <private/qjni_p.h>
# include <private/qjnihelpers_p.h>
#endif
@@ -180,7 +180,7 @@ QString QCoreApplicationPrivate::appVersion() const
#ifndef QT_BOOTSTRAPPED
# ifdef Q_OS_DARWIN
applicationVersion = infoDictionaryStringProperty(QStringLiteral("CFBundleVersion"));
-# elif defined(Q_OS_ANDROID)
+# elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QJNIObjectPrivate context(QtAndroidPrivate::context());
if (context.isValid()) {
QJNIObjectPrivate pm = context.callObjectMethod(
@@ -2236,7 +2236,7 @@ QString QCoreApplication::applicationFilePath()
}
#endif
#if defined( Q_OS_UNIX )
-# if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
+# if defined(Q_OS_LINUX) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED))
// Try looking for a /proc/<pid>/exe symlink first which points to
// the absolute path of the executable
QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid()));
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index ebad7f1751..9e6e70756f 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -237,21 +237,34 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
if (lib)
lib->errorString = file.errorString();
if (qt_debug_component()) {
- qWarning("%s: %s", (const char*) QFile::encodeName(library),
+ qWarning("%s: %s", QFile::encodeName(library).constData(),
qPrintable(QSystemError::stdString()));
}
return false;
}
QByteArray data;
- const char *filedata = 0;
ulong fdlen = file.size();
- filedata = (char *) file.map(0, fdlen);
+ const char *filedata = reinterpret_cast<char *>(file.map(0, fdlen));
+
if (filedata == 0) {
- // try reading the data into memory instead
- data = file.readAll();
- filedata = data.constData();
- fdlen = data.size();
+ if (uchar *mapdata = file.map(0, 1)) {
+ file.unmap(mapdata);
+ // Mapping is supported, but failed for the entire file, likely due to OOM.
+ // Return false, as readAll() would cause a bad_alloc and terminate the process.
+ if (lib)
+ lib->errorString = QLibrary::tr("Out of memory while loading plugin '%1'.").arg(library);
+ if (qt_debug_component()) {
+ qWarning("%s: %s", QFile::encodeName(library).constData(),
+ qPrintable(QSystemError::stdString(ENOMEM)));
+ }
+ return false;
+ } else {
+ // Try reading the data into memory instead.
+ data = file.readAll();
+ filedata = data.constData();
+ fdlen = data.size();
+ }
}
/*
@@ -745,7 +758,7 @@ void QLibraryPrivate::updatePluginState()
if (qt_debug_component()) {
qWarning("In %s:\n"
" Plugin uses incompatible Qt library (%d.%d.%d) [%s]",
- (const char*) QFile::encodeName(fileName),
+ QFile::encodeName(fileName).constData(),
(qt_version&0xff0000) >> 16, (qt_version&0xff00) >> 8, qt_version&0xff,
debug ? "debug" : "release");
}
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 181da4f7de..e315bc7f4e 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -198,7 +198,7 @@
// SSE intrinsics
#if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
-#if defined(QT_LINUXBASE)
+#if defined(QT_LINUXBASE) || defined(Q_OS_ANDROID_EMBEDDED)
/// this is an evil hack - the posix_memalign declaration in LSB
/// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431
# define posix_memalign _lsb_hack_posix_memalign
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index e63f1ce253..30f8948eec 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -11626,7 +11626,7 @@ QString QString::toHtmlEscaped() const
This cost can be avoided by using QStringLiteral instead:
\code
- if (node.hasAttribute(QStringLiteral("http-contents-length"))) //...
+ if (node.hasAttribute(QStringLiteral(u"http-contents-length"))) //...
\endcode
In this case, QString's internal data will be generated at compile time; no
@@ -11646,6 +11646,10 @@ QString QString::toHtmlEscaped() const
if (attribute.name() == QLatin1String("http-contents-length")) //...
\endcode
+ \note Some compilers have bugs encoding strings containing characters outside
+ the US-ASCII character set. Make sure you prefix your string with \c{u} in
+ those cases. It is optional otherwise.
+
\sa QByteArrayLiteral
*/
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index 6a26993549..3b41e7670c 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -62,9 +62,9 @@ static QTimeZonePrivate *newBackendTimeZone()
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate();
-#elif defined Q_OS_ANDROID
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
return new QAndroidTimeZonePrivate();
-#elif defined Q_OS_UNIX
+#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED)
return new QTzTimeZonePrivate();
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
@@ -89,9 +89,9 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate(ianaId);
-#elif defined Q_OS_ANDROID
+#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
return new QAndroidTimeZonePrivate(ianaId);
-#elif defined Q_OS_UNIX
+#elif defined(Q_OS_UNIX) || defined(Q_OS_ANDROID_EMBEDDED)
return new QTzTimeZonePrivate(ianaId);
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index 74b79dce16..83e06ffcb0 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -68,7 +68,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone);
#include <qt_windows.h>
#endif // Q_OS_WIN
-#ifdef Q_OS_ANDROID
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
#include <QtCore/private/qjni_p.h>
#endif
@@ -266,7 +266,7 @@ private:
};
#endif
-#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED))
struct QTzTransitionTime
{
qint64 atMSecsSinceEpoch;
@@ -443,7 +443,7 @@ private:
};
#endif // Q_OS_WIN
-#ifdef Q_OS_ANDROID
+#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
class QAndroidTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
{
public:
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 2c609098ea..f214d34d08 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -161,7 +161,7 @@ qtConfig(timezone) {
tools/qtimezoneprivate.cpp
!nacl:darwin: \
SOURCES += tools/qtimezoneprivate_mac.mm
- else: android: \
+ else: android:!android-embedded: \
SOURCES += tools/qtimezoneprivate_android.cpp
else: unix: \
SOURCES += tools/qtimezoneprivate_tz.cpp