diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qtranslator.cpp | 33 | ||||
-rw-r--r-- | src/corelib/tools/qsimd.cpp | 3 | ||||
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 8 | ||||
-rw-r--r-- | src/gui/text/qtextformat.cpp | 25 | ||||
-rw-r--r-- | src/gui/text/qtextformat.h | 6 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_qt.cpp | 24 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qformlayout.cpp | 10 | ||||
-rw-r--r-- | src/widgets/widgets/qmdiarea.cpp | 6 |
9 files changed, 71 insertions, 47 deletions
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 744bbfbff5..dc39490ab0 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -61,14 +61,8 @@ #if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY) #define QT_USE_MMAP #include "private/qcore_unix_p.h" -#endif - -// most of the headers below are already included in qplatformdefs.h -// also this lacks Large File support but that's probably irrelevant -#if defined(QT_USE_MMAP) // for mmap #include <sys/mman.h> -#include <errno.h> #endif #include <stdlib.h> @@ -302,7 +296,7 @@ public: bool used_mmap : 1; #endif char *unmapPointer; // used memory (mmap, new or resource file) - quint32 unmapLength; + qsizetype unmapLength; // The resource object in case we loaded the translations from a resource QResource *resource; @@ -322,7 +316,7 @@ public: uint numerusRulesLength; bool do_load(const QString &filename, const QString &directory); - bool do_load(const uchar *data, int len, const QString &directory); + bool do_load(const uchar *data, qsizetype len, const QString &directory); QString do_translate(const char *context, const char *sourceText, const char *comment, int n) const; void clear(); @@ -553,7 +547,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo return false; qint64 fileSize = file.size(); - if (fileSize < MagicLength || quint32(-1) <= fileSize) + if (fileSize < MagicLength || fileSize > std::numeric_limits<qsizetype>::max()) return false; { @@ -563,7 +557,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo return false; } - d->unmapLength = quint32(fileSize); + d->unmapLength = qsizetype(fileSize); #ifdef QT_USE_MMAP @@ -571,21 +565,20 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo #define MAP_FILE 0 #endif #ifndef MAP_FAILED -#define MAP_FAILED -1 +#define MAP_FAILED reinterpret_cast<void *>(-1) #endif int fd = file.handle(); if (fd >= 0) { - char *ptr; - ptr = reinterpret_cast<char *>( - mmap(0, d->unmapLength, // any address, whole file - PROT_READ, // read-only memory - MAP_FILE | MAP_PRIVATE, // swap-backed map from file - fd, 0)); // from offset 0 of fd - if (ptr && ptr != reinterpret_cast<char *>(MAP_FAILED)) { + int protection = PROT_READ; // read-only memory + int flags = MAP_FILE | MAP_PRIVATE; // swap-backed map from file + void *ptr = QT_MMAP(nullptr, d->unmapLength,// any address, whole file + protection, flags, + fd, 0); // from offset 0 of fd + if (ptr != MAP_FAILED) { file.close(); d->used_mmap = true; - d->unmapPointer = ptr; + d->unmapPointer = static_cast<char *>(ptr); ok = true; } } @@ -815,7 +808,7 @@ static quint32 read32(const uchar *data) return qFromBigEndian<quint32>(data); } -bool QTranslatorPrivate::do_load(const uchar *data, int len, const QString &directory) +bool QTranslatorPrivate::do_load(const uchar *data, qsizetype len, const QString &directory) { bool ok = true; const uchar *end = data + len; diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 07a8b022bc..4a44cf02e0 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -529,7 +529,7 @@ Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1] = { Q_BASIC_ATOMIC Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2] = { Q_BASIC_ATOMIC_INITIALIZER(0), Q_BASIC_ATOMIC_INITIALIZER(0) }; #endif -void qDetectCpuFeatures() +quint64 qDetectCpuFeatures() { quint64 f = detectProcessorFeatures(); QByteArray disable = qgetenv("QT_NO_CPU_FEATURE"); @@ -563,6 +563,7 @@ void qDetectCpuFeatures() #ifndef Q_ATOMIC_INT64_IS_SUPPORTED qt_cpu_features[1].store(f >> 32); #endif + return f; } void qDumpCPUFeatures() diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 9f1321df94..c36e1e484f 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -344,7 +344,7 @@ extern Q_CORE_EXPORT QBasicAtomicInteger<quint64> qt_cpu_features[1]; #else extern Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2]; #endif -Q_CORE_EXPORT void qDetectCpuFeatures(); +Q_CORE_EXPORT quint64 qDetectCpuFeatures(); static inline quint64 qCpuFeatures() { @@ -353,11 +353,7 @@ static inline quint64 qCpuFeatures() features |= quint64(qt_cpu_features[1].load()) << 32; #endif if (Q_UNLIKELY(features == 0)) { - qDetectCpuFeatures(); - features = qt_cpu_features[0].load(); -#ifndef Q_ATOMIC_INT64_IS_SUPPORTED - features |= quint64(qt_cpu_features[1].load()) << 32; -#endif + features = qDetectCpuFeatures(); Q_ASSUME(features != 0); } return features; diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index e814f4f718..136e7dc140 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -364,6 +364,9 @@ void QTextFormatPrivate::recalcFont() const case QTextFormat::FontFamilies: f.setFamilies(props.at(i).value.toStringList()); break; + case QTextFormat::FontStyleName: + f.setStyleName(props.at(i).value.toString()); + break; case QTextFormat::FontPointSize: f.setPointSizeF(props.at(i).value.toReal()); break; @@ -566,6 +569,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) \value FontFamily \value FontFamilies + \value FontStyleName \value FontPointSize \value FontPixelSize \value FontSizeAdjustment Specifies the change in size given to the fontsize already set using @@ -1412,6 +1416,25 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt) \sa font() */ + +/*! + \fn void QTextCharFormat::setFontStyleName(const QString &styleName) + \since 5.13 + + Sets the text format's font \a style name. + + \sa setFont(), QFont::setStyleName() +*/ + +/*! + \fn QStringList QTextCharFormat::fontStyleName() const + \since 5.13 + + Returns the text format's font style name. + + \sa font(), QFont::styleName() +*/ + /*! \fn void QTextCharFormat::setFontPointSize(qreal size) @@ -1942,6 +1965,8 @@ void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavi setFontFamily(font.family()); if (mask & QFont::FamiliesResolved) setFontFamilies(font.families()); + if (mask & QFont::StyleNameResolved) + setFontStyleName(font.styleName()); if (mask & QFont::SizeResolved) { const qreal pointSize = font.pointSizeF(); diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index d27d2e7f17..f292feabe8 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -189,6 +189,7 @@ public: FontKerning = 0x1FE5, FontHintingPreference = 0x1FE6, FontFamilies = 0x1FE7, + FontStyleName = 0x1FE8, FontFamily = 0x2000, FontPointSize = 0x2001, FontSizeAdjustment = 0x2002, @@ -434,6 +435,11 @@ public: inline QVariant fontFamilies() const { return property(FontFamilies); } + inline void setFontStyleName(const QString &styleName) + { setProperty(FontStyleName, styleName); } + inline QVariant fontStyleName() const + { return property(FontStyleName); } + inline void setFontPointSize(qreal size) { setProperty(FontPointSize, size); } inline qreal fontPointSize() const diff --git a/src/network/ssl/qsslsocket_qt.cpp b/src/network/ssl/qsslsocket_qt.cpp index 2c78f0f4e7..b0fb60ea76 100644 --- a/src/network/ssl/qsslsocket_qt.cpp +++ b/src/network/ssl/qsslsocket_qt.cpp @@ -92,14 +92,12 @@ static QByteArray _q_PKCS12_keygen(char id, const QByteArray &salt, const QStrin QByteArray S, P; const int sSize = v * ((salt.size() + v - 1) / v); S.resize(sSize); - for (int i = 0; i < sSize; ++i) { + for (int i = 0; i < sSize; ++i) S[i] = salt[i % salt.size()]; - } const int pSize = v * ((passUnicode.size() + v - 1) / v); P.resize(pSize); - for (int i = 0; i < pSize; ++i) { + for (int i = 0; i < pSize; ++i) P[i] = passUnicode[i % passUnicode.size()]; - } QByteArray I = S + P; // apply hashing @@ -117,16 +115,15 @@ static QByteArray _q_PKCS12_keygen(char id, const QByteArray &salt, const QStrin Ai = hash.result(); } - for (int j = 0; j < v; ++j) { + for (int j = 0; j < v; ++j) B[j] = Ai[j % u]; - } // modify I as Ij = (Ij + B + 1) modulo 2^v for (int p = 0; p < I.size(); p += v) { quint8 carry = 1; for (int j = v - 1; j >= 0; --j) { - quint16 v = quint8(I[p+j]) + quint8(B[j]) + carry; - I[p+j] = v & 0xff; + quint16 v = quint8(I[p + j]) + quint8(B[j]) + carry; + I[p + j] = v & 0xff; carry = (v & 0xff00) >> 8; } } @@ -139,9 +136,8 @@ static QByteArray _q_PKCS12_salt() { QByteArray salt; salt.resize(8); - for (int i = 0; i < salt.size(); ++i) { + for (int i = 0; i < salt.size(); ++i) salt[i] = (qrand() & 0xff); - } return salt; } @@ -203,7 +199,7 @@ static QByteArray _q_PKCS12_shroudedKeyBag(const QSslKey &key, const QString &pa QDataStream plainStream(&plain, QIODevice::WriteOnly); _q_PKCS12_key(key).write(plainStream); QByteArray crypted = QSslKeyPrivate::encrypt(QSslKeyPrivate::DesEde3Cbc, - plain, cKey, cIv); + plain, cKey, cIv); QVector<QAsn1Element> items; items << QAsn1Element::fromObjectId("1.2.840.113549.1.12.10.1.2"); @@ -246,8 +242,10 @@ static QByteArray _q_PKCS12_bag(const QList<QSslCertificate> &certs, const QSslK items << _q_PKCS7_data(_q_PKCS12_certBag(certs[i])); // key - const QByteArray localKeyId = certs.first().digest(QCryptographicHash::Sha1); - items << _q_PKCS7_data(_q_PKCS12_shroudedKeyBag(key, passPhrase, localKeyId)); + if (!key.isNull()) { + const QByteArray localKeyId = certs.first().digest(QCryptographicHash::Sha1); + items << _q_PKCS7_data(_q_PKCS12_shroudedKeyBag(key, passPhrase, localKeyId)); + } // dump QAsn1Element root = QAsn1Element::fromVector(items); diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp index af969b346d..8b4861bf45 100644 --- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp +++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp @@ -51,8 +51,7 @@ QGraphicsLayoutStyleInfo::QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate : m_layout(layout), m_style(0) { m_widget = new QWidget; // pixelMetric might need a widget ptr - if (m_widget) - m_styleOption.initFrom(m_widget); + m_styleOption.initFrom(m_widget); m_isWindow = m_styleOption.state & QStyle::State_Window; } diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 66e8858e21..101ce8b64c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -419,13 +419,15 @@ void QFormLayoutPrivate::updateSizes() if (label) { maxMinLblWidth = qMax(maxMinLblWidth, label->minSize.width()); maxShLblWidth = qMax(maxShLblWidth, label->sizeHint.width()); - if (field) { + } + if (field) { + if (field->fullRow) { + maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width()); + maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width()); + } else { maxMinFldWidth = qMax(maxMinFldWidth, field->minSize.width() + field->sbsHSpace); maxShFldWidth = qMax(maxShFldWidth, field->sizeHint.width() + field->sbsHSpace); } - } else if (field) { - maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width()); - maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width()); } prevLbl = label; diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index c1817060dd..cdc1291511 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -1296,7 +1296,11 @@ QRect QMdiAreaPrivate::resizeToMinimumTileSize(const QSize &minSubWindowSize, in minAreaHeight += 2 * frame; } const QSize diff = QSize(minAreaWidth, minAreaHeight).expandedTo(q->size()) - q->size(); - topLevel->resize(topLevel->size() + diff); + // Only resize topLevel widget if scroll bars are disabled. + if (hbarpolicy == Qt::ScrollBarAlwaysOff) + topLevel->resize(topLevel->size().width() + diff.width(), topLevel->size().height()); + if (vbarpolicy == Qt::ScrollBarAlwaysOff) + topLevel->resize(topLevel->size().width(), topLevel->size().height() + diff.height()); } QRect domain = viewport->rect(); |