summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-08-13 09:46:17 +0200
committerLiang Qi <liang.qi@qt.io>2019-08-13 09:46:17 +0200
commit1dade1bd8ad13a16152aff36351ac570b5b9fdf6 (patch)
treeeafed5710b34c327a98381ca15fe1985a6487b10 /src/corelib
parentd45908e24292a41ff7838366b34be7340bf9fda5 (diff)
parentfb703aea697b12de4810deec9f8605fd062208bd (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/corelib/tools/qlist.h src/gui/painting/qcompositionfunctions.cpp src/gui/painting/qtriangulator_p.h src/gui/text/qfontengine_p.h src/network/kernel/qhostinfo_p.h src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: Ib8a0308cf77224c4fbdcf56778fdac4a43e37798
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp4
-rw-r--r--src/corelib/global/qoperatingsystemversion.cpp8
-rw-r--r--src/corelib/global/qoperatingsystemversion.h1
-rw-r--r--src/corelib/global/qsystemdetection.h14
-rw-r--r--src/corelib/serialization/qjsonvalue.h4
-rw-r--r--src/corelib/thread/qthread_win.cpp2
-rw-r--r--src/corelib/tools/qbitarray.cpp20
-rw-r--r--src/corelib/tools/qcryptographichash.cpp8
-rw-r--r--src/corelib/tools/qlist.h4
9 files changed, 42 insertions, 23 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp b/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp
index 79af776ce4..e3c3005c33 100644
--- a/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp
@@ -183,7 +183,7 @@ QUrl url("http://qt-project.org/support/file.html");
//! [19]
//! [20]
- qDebug() << QUrl("file:file.txt").toLocalFile(); // "file:file.txt"
- qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "file:///home/user/file.txt"
+ qDebug() << QUrl("file:file.txt").toLocalFile(); // "file.txt"
+ qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "/home/user/file.txt"
qDebug() << QUrl("file.txt").toLocalFile(); // ""; wasn't a local file as it had no scheme
//! [20]
diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp
index 9084ad933c..ded86cbc4e 100644
--- a/src/corelib/global/qoperatingsystemversion.cpp
+++ b/src/corelib/global/qoperatingsystemversion.cpp
@@ -444,6 +444,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave =
QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14);
/*!
+ \variable QOperatingSystemVersion::MacOSCatalina
+ \brief a version corresponding to macOS Catalina (version 10.15).
+ \since 5.12.5
+ */
+const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina =
+ QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15);
+
+/*!
\variable QOperatingSystemVersion::AndroidJellyBean
\brief a version corresponding to Android Jelly Bean (version 4.1, API level 16).
\since 5.9
diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h
index 75c54b60df..879bd379b0 100644
--- a/src/corelib/global/qoperatingsystemversion.h
+++ b/src/corelib/global/qoperatingsystemversion.h
@@ -72,6 +72,7 @@ public:
static const QOperatingSystemVersion MacOSSierra;
static const QOperatingSystemVersion MacOSHighSierra;
static const QOperatingSystemVersion MacOSMojave;
+ static const QOperatingSystemVersion MacOSCatalina;
static const QOperatingSystemVersion AndroidJellyBean;
static const QOperatingSystemVersion AndroidJellyBean_MR1;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 4ebbe16ead..a020788b11 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -240,17 +240,23 @@
# if !defined(__MAC_10_14)
# define __MAC_10_14 101400
# endif
+# if !defined(__MAC_10_15)
+# define __MAC_10_15 101500
+# endif
# if !defined(MAC_OS_X_VERSION_10_11)
-# define MAC_OS_X_VERSION_10_11 101100
+# define MAC_OS_X_VERSION_10_11 __MAC_10_11
# endif
# if !defined(MAC_OS_X_VERSION_10_12)
-# define MAC_OS_X_VERSION_10_12 101200
+# define MAC_OS_X_VERSION_10_12 __MAC_10_12
# endif
# if !defined(MAC_OS_X_VERSION_10_13)
-# define MAC_OS_X_VERSION_10_13 101300
+# define MAC_OS_X_VERSION_10_13 __MAC_10_13
# endif
# if !defined(MAC_OS_X_VERSION_10_14)
-# define MAC_OS_X_VERSION_10_14 101400
+# define MAC_OS_X_VERSION_10_14 __MAC_10_14
+# endif
+# if !defined(MAC_OS_X_VERSION_10_15)
+# define MAC_OS_X_VERSION_10_15 __MAC_10_15
# endif
#
# if !defined(__IPHONE_10_0)
diff --git a/src/corelib/serialization/qjsonvalue.h b/src/corelib/serialization/qjsonvalue.h
index 430fa06c0f..8ade18509b 100644
--- a/src/corelib/serialization/qjsonvalue.h
+++ b/src/corelib/serialization/qjsonvalue.h
@@ -177,9 +177,9 @@ class Q_CORE_EXPORT QJsonValueRef
{
public:
QJsonValueRef(QJsonArray *array, int idx)
- : a(array), is_object(false), index(idx) {}
+ : a(array), is_object(false), index(static_cast<uint>(idx)) {}
QJsonValueRef(QJsonObject *object, int idx)
- : o(object), is_object(true), index(idx) {}
+ : o(object), is_object(true), index(static_cast<uint>(idx)) {}
inline operator QJsonValue() const { return toValue(); }
QJsonValueRef &operator = (const QJsonValue &val);
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index f8a0b0abaa..a72df2fc40 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -99,6 +99,8 @@ void qt_create_tls()
return;
static QBasicMutex mutex;
QMutexLocker locker(&mutex);
+ if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES)
+ return;
qt_current_thread_data_tls_index = TlsAlloc();
}
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index 4e8e3c241e..f0b81cce66 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -132,12 +132,12 @@ QT_BEGIN_NAMESPACE
* We overallocate the byte array by 1 byte. The first user bit is at
* d.data()[1]. On the extra first byte, we store the difference between the
* number of bits in the byte array (including this byte) and the number of
- * bits in the bit array. Therefore, it's always a number between 8 and 15.
+ * bits in the bit array. Therefore, for a non-empty QBitArray, it's always a
+ * number between 8 and 15. For the empty one, d is the an empty QByteArray and
+ * *d.constData() is the QByteArray's terminating NUL (0) byte.
*
* This allows for fast calculation of the bit array size:
* inline int size() const { return (d.size() << 3) - *d.constData(); }
- *
- * Note: for an array of zero size, *d.constData() is the QByteArray implicit NUL.
*/
/*!
@@ -154,8 +154,8 @@ QBitArray::QBitArray(int size, bool value)
uchar* c = reinterpret_cast<uchar*>(d.data());
memset(c + 1, value ? 0xff : 0, d.size() - 1);
*c = d.size()*8 - size;
- if (value && size && size % 8)
- *(c+1+size/8) &= (1 << (size%8)) - 1;
+ if (value && size && size & 7)
+ *(c+1+size/8) &= (1 << (size & 7)) - 1;
}
/*! \fn int QBitArray::size() const
@@ -227,8 +227,8 @@ void QBitArray::resize(int size)
uchar* c = reinterpret_cast<uchar*>(d.data());
if (size > (s << 3))
memset(c + s, 0, d.size() - s);
- else if ( size % 8)
- *(c+1+size/8) &= (1 << (size%8)) - 1;
+ else if (size & 7)
+ *(c+1+size/8) &= (1 << (size & 7)) - 1;
*c = d.size()*8 - size;
}
}
@@ -326,6 +326,8 @@ void QBitArray::fill(bool value, int begin, int end)
QBitArray QBitArray::fromBits(const char *data, qsizetype size)
{
QBitArray result;
+ if (size == 0)
+ return result;
qsizetype nbytes = (size + 7) / 8;
result.d = QByteArray(nbytes + 1, Qt::Uninitialized);
@@ -334,7 +336,7 @@ QBitArray QBitArray::fromBits(const char *data, qsizetype size)
// clear any unused bits from the last byte
if (size & 7)
- bits[nbytes] &= 0xffU >> (size & 7);
+ bits[nbytes] &= 0xffU >> (8 - (size & 7));
*bits = result.d.size() * 8 - size;
return result;
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index ee7657789c..fa8d21e07a 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -391,19 +391,19 @@ void QCryptographicHash::addData(const char *data, int length)
break;
case RealSha3_224:
case Keccak_224:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
break;
case RealSha3_256:
case Keccak_256:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
break;
case RealSha3_384:
case Keccak_384:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
break;
case RealSha3_512:
case Keccak_512:
- sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), length*8);
+ sha3Update(&d->sha3Context, reinterpret_cast<const BitSequence *>(data), quint64(length) * 8);
break;
#endif
}
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 471e16886f..be987c359b 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -112,7 +112,7 @@ struct Q_CORE_EXPORT QListData {
void remove(int i);
void remove(int i, int n);
void move(int from, int to);
- inline int size() const noexcept { return d->end - d->begin; }
+ inline int size() const noexcept { return int(d->end - d->begin); } // q6sizetype
inline bool isEmpty() const noexcept { return d->end == d->begin; }
inline void **at(int i) const noexcept { return d->array + d->begin + i; }
inline void **begin() const noexcept { return d->array + d->begin; }
@@ -1051,7 +1051,7 @@ int lastIndexOf(const QList<T> &list, const U &u, int from)
Node *n = reinterpret_cast<Node *>(list.p.at(from + 1));
while (n-- != b) {
if (n->t() == u)
- return n - b;
+ return typename QList<T>::difference_type(n - b);
}
}
return -1;