diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/doc/qtcore.qdocconf | 2 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qdir.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qdir_p.h | 8 | ||||
-rw-r--r-- | src/corelib/io/qfiledevice.cpp | 6 | ||||
-rw-r--r-- | src/corelib/io/qfiledevice_p.h | 13 | ||||
-rw-r--r-- | src/corelib/io/qtextstream_p.h | 63 | ||||
-rw-r--r-- | src/corelib/json/qjsonobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qplugin.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/tools/qalgorithms.qdoc | 8 | ||||
-rw-r--r-- | src/corelib/tools/qeasingcurve.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_blackberry.cpp | 23 | ||||
-rw-r--r-- | src/corelib/tools/qregexp.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qtimeline.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_p.h | 4 |
18 files changed, 104 insertions, 78 deletions
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 9ab66c6645..fa5afb033c 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml +depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake headerdirs += .. diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f72d27c2e5..041b522023 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -76,7 +76,7 @@ #include <CoreServices/CoreServices.h> #endif -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) #include <private/qjni_p.h> #endif @@ -2400,7 +2400,7 @@ typedef uint SeedStorageType; typedef QThreadStorage<SeedStorageType *> SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage; Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) #endif @@ -2436,7 +2436,7 @@ void qsrand(uint seed) //global static object, fallback to srand(seed) srand(seed); } -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) if (randomTLS->hasLocalData()) { randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed)); return; @@ -2492,7 +2492,7 @@ int qrand() //global static object, fallback to rand() return rand(); } -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) AndroidRandomStorage *randomStorage = randomTLS(); if (!randomStorage) return rand(); diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 624f45caaf..a60bcde30d 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -85,10 +85,10 @@ static QString driveSpec(const QString &path) //************* QDirPrivate QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_) : QSharedData() + , fileListsInitialized(false) , nameFilters(nameFilters_) , sort(sort_) , filters(filters_) - , fileListsInitialized(false) { setPath(path.isEmpty() ? QString::fromLatin1(".") : path); @@ -108,10 +108,10 @@ QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, Q QDirPrivate::QDirPrivate(const QDirPrivate ©) : QSharedData(copy) + , fileListsInitialized(false) , nameFilters(copy.nameFilters) , sort(copy.sort) , filters(copy.filters) - , fileListsInitialized(false) , dirEntry(copy.dirEntry) , metaData(copy.metaData) { diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h index efcac439cd..bf7726db2f 100644 --- a/src/corelib/io/qdir_p.h +++ b/src/corelib/io/qdir_p.h @@ -73,16 +73,16 @@ public: void resolveAbsoluteEntry() const; + mutable bool fileListsInitialized; + mutable QStringList files; + mutable QFileInfoList fileInfos; + QStringList nameFilters; QDir::SortFlags sort; QDir::Filters filters; QScopedPointer<QAbstractFileEngine> fileEngine; - mutable bool fileListsInitialized; - mutable QStringList files; - mutable QFileInfoList fileInfos; - QFileSystemEntry dirEntry; mutable QFileSystemEntry absoluteDirEntry; mutable QFileSystemMetaData metaData; diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index f25933816a..d2c8d37d4a 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE static const int QFILE_WRITEBUFFER_SIZE = 16384; QFileDevicePrivate::QFileDevicePrivate() - : fileEngine(0), lastWasWrite(false), - writeBuffer(QFILE_WRITEBUFFER_SIZE), error(QFile::NoError), - cachedSize(0) + : fileEngine(0), + writeBuffer(QFILE_WRITEBUFFER_SIZE), cachedSize(0), + error(QFile::NoError), lastWasWrite(false) { } diff --git a/src/corelib/io/qfiledevice_p.h b/src/corelib/io/qfiledevice_p.h index 4c9cf7b627..79d8427c0d 100644 --- a/src/corelib/io/qfiledevice_p.h +++ b/src/corelib/io/qfiledevice_p.h @@ -70,21 +70,22 @@ protected: virtual QAbstractFileEngine *engine() const; - QFileDevice::FileHandleFlags handleFlags; - - mutable QAbstractFileEngine *fileEngine; - bool lastWasWrite; - QRingBuffer writeBuffer; inline bool ensureFlushed() const; bool putCharHelper(char c); - QFileDevice::FileError error; void setError(QFileDevice::FileError err); void setError(QFileDevice::FileError err, const QString &errorString); void setError(QFileDevice::FileError err, int errNum); + mutable QAbstractFileEngine *fileEngine; + QRingBuffer writeBuffer; mutable qint64 cachedSize; + + QFileDevice::FileHandleFlags handleFlags; + QFileDevice::FileError error; + + bool lastWasWrite; }; inline bool QFileDevicePrivate::ensureFlushed() const diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h index d5d5288426..ac6529e195 100644 --- a/src/corelib/io/qtextstream_p.h +++ b/src/corelib/io/qtextstream_p.h @@ -88,6 +88,21 @@ class QTextStreamPrivate { Q_DECLARE_PUBLIC(QTextStream) public: + // streaming parameters + class Params + { + public: + void reset(); + + int realNumberPrecision; + int integerBase; + int fieldWidth; + QChar padChar; + QTextStream::FieldAlignment fieldAlignment; + QTextStream::RealNumberNotation realNumberNotation; + QTextStream::NumberFlags numberFlags; + }; + QTextStreamPrivate(QTextStream *q_ptr); ~QTextStreamPrivate(); void reset(); @@ -97,7 +112,6 @@ public: #ifndef QT_NO_QOBJECT QDeviceClosedNotifier deviceClosedNotifier; #endif - bool deleteDevice; // string QString *string; @@ -110,6 +124,24 @@ public: QTextCodec::ConverterState readConverterState; QTextCodec::ConverterState writeConverterState; QTextCodec::ConverterState *readConverterSavedState; +#endif + + QString writeBuffer; + QString readBuffer; + int readBufferOffset; + int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer + qint64 readBufferStartDevicePos; + + Params params; + + // status + QTextStream::Status status; + QLocale locale; + QTextStream *q_ptr; + + int lastTokenSize; + bool deleteDevice; +#ifndef QT_NO_TEXTCODEC bool autoDetectUnicode; #endif @@ -128,7 +160,6 @@ public: inline void consume(int nchars); void saveConverterState(qint64 newPos); void restoreToSavedConverterState(); - int lastTokenSize; // Return value type for getNumber() enum NumberParsingStatus { @@ -150,34 +181,6 @@ public: bool fillReadBuffer(qint64 maxBytes = -1); void resetReadBuffer(); void flushWriteBuffer(); - QString writeBuffer; - QString readBuffer; - int readBufferOffset; - int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer - qint64 readBufferStartDevicePos; - - // streaming parameters - class Params - { - public: - void reset(); - - int realNumberPrecision; - int integerBase; - int fieldWidth; - QChar padChar; - QTextStream::FieldAlignment fieldAlignment; - QTextStream::RealNumberNotation realNumberNotation; - QTextStream::NumberFlags numberFlags; - }; - Params params; - - // status - QTextStream::Status status; - - QLocale locale; - - QTextStream *q_ptr; }; QT_END_NAMESPACE diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index afc0d5f71f..27e51cf4ac 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -783,6 +783,8 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const /*! \class QJsonObject::const_iterator \inmodule QtCore + \ingroup json + \since 5.0 \brief The QJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject. QJsonObject::const_iterator allows you to iterate over a QJsonObject. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 29c5a3dd24..50d4583dea 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1949,7 +1949,7 @@ void QObjectPrivate::setParent_helper(QObject *o) } } } - if (!isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) + if (!wasDeleted && !isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) QAbstractDeclarativeData::parentChanged(declarativeData, q, o); } diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index eacfe995ae..0a94077d95 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -109,6 +109,6 @@ the required plugins to your build. For example: \snippet code/doc_src_qplugin.pro 3 + \sa {Static Plugins}, {How to Create Qt Plugins}, {qmake-getting-started}{Getting Started with qmake} - \sa {Static Plugins}, {How to Create Qt Plugins}, {Using qmake} */ diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index cd389470a4..412b9cf3b2 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -49,9 +49,9 @@ iterators they accept. For example, qFill() accepts two \l {forward iterators}. The iterator types required are specified for each algorithm. If an iterator of the wrong type is passed (for - example, if QList::ConstIterator is passed as an \l {output - iterator}), you will always get a compiler error, although not - necessarily a very informative one. + example, if QList::ConstIterator is passed as an + \l {Output Iterators}{output iterator}), you will always get a + compiler error, although not necessarily a very informative one. Some algorithms have special requirements on the value type stored in the containers. For example, @@ -99,7 +99,7 @@ \section2 Output Iterators - An \e{output iterator} is an iterator that can be used for + An output iterator is an iterator that can be used for writing data sequentially to a container or to some output stream. It must provide the following operators: unary \c{*} for writing a value (i.e., \c{*it = val}) and prefix \c{++} for diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 5daf067c71..2708901866 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -432,14 +432,14 @@ struct BezierEase : public QEasingCurveFunction qreal p3x, p3y; }; - bool _init; - bool _valid; QVector<SingleCubicBezier> _curves; - int _curveCount; QVector<qreal> _intervals; + int _curveCount; + bool _init; + bool _valid; BezierEase() - : QEasingCurveFunction(InOut), _init(false), _valid(false), _curves(10), _intervals(10) + : QEasingCurveFunction(InOut), _curves(10), _intervals(10), _init(false), _valid(false) { } void init() diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 48faa73070..c2c3476b0a 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -60,7 +60,7 @@ static const char ppsRegionLocalePath[] = "/pps/services/locale/settings"; static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE"; static const char ppsHourFormatPath[] = "/pps/system/settings"; -static const size_t ppsBufferSize = 256; +static const int MAX_PPS_SIZE = 16000; QBBSystemLocaleData::QBBSystemLocaleData() : languageNotifier(0) @@ -186,9 +186,24 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) if (!ppsObject || ppsFd == -1) return result; - char buffer[ppsBufferSize]; + // PPS objects are of unknown size, but must be read all at once. + // Relying on the file size may not be a good idea since the size may change before reading. + // Let's try with an initial size (512), and if the buffer is too small try with bigger one, + // until we succeed or until other non buffer-size-related error occurs. + // Using QVarLengthArray means the first try (of size == 512) uses a buffer on the stack - no allocation necessary. + // Hopefully that covers most use cases. + int bytes; + QVarLengthArray<char, 512> buffer; + for (;;) { + errno = 0; + bytes = qt_safe_read(ppsFd, buffer.data(), buffer.capacity() - 1); + const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.capacity() < MAX_PPS_SIZE); + if (!bufferIsTooSmall) + break; + + buffer.resize(qMin(buffer.capacity()*2, MAX_PPS_SIZE)); + } - int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1); // This method is called in the ctor(), so do not use qWarning to log warnings // if qt_safe_read fails to read the pps file // since the user code may install a message handler that invokes QLocale API again @@ -202,7 +217,7 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) pps_decoder_t ppsDecoder; pps_decoder_initialize(&ppsDecoder, 0); - if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { + if (pps_decoder_parse_pps_str(&ppsDecoder, buffer.data()) == PPS_DECODER_OK) { pps_decoder_push(&ppsDecoder, 0); const char *ppsBuff; if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) { diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 88499ad9d9..d2b5adc974 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -1045,12 +1045,12 @@ public: #endif private: - uint c; // character classes QVector<QRegExpCharClassRange> r; // character ranges - bool n; // negative? #ifndef QT_NO_REGEXP_OPTIM QVector<int> occ1; // first-occurrence array #endif + uint c; // character classes + bool n; // negative? }; #else struct QRegExpCharClass diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index d5bd1dff00..e1cf82bb8c 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -813,8 +813,9 @@ struct QRegularExpressionPrivate : QSharedData int captureIndexForName(const QString &name) const; - QString pattern; + // sizeof(QSharedData) == 4, so start our members with an enum QRegularExpression::PatternOptions patternOptions; + QString pattern; // *All* of the following members are set managed while holding this mutex, // except for isDirty which is set to true by QRegularExpression setters @@ -889,7 +890,7 @@ QRegularExpression::QRegularExpression(QRegularExpressionPrivate &dd) \internal */ QRegularExpressionPrivate::QRegularExpressionPrivate() - : pattern(), patternOptions(0), + : patternOptions(0), pattern(), mutex(), compiledPattern(0), studyData(0), errorString(0), errorOffset(-1), @@ -919,7 +920,7 @@ QRegularExpressionPrivate::~QRegularExpressionPrivate() */ QRegularExpressionPrivate::QRegularExpressionPrivate(const QRegularExpressionPrivate &other) : QSharedData(other), - pattern(other.pattern), patternOptions(other.patternOptions), + patternOptions(other.patternOptions), pattern(other.pattern), mutex(), compiledPattern(0), studyData(0), errorString(0), diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 976c03aef4..3619c9e986 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -53,13 +53,17 @@ class QTimeLinePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QTimeLine) public: inline QTimeLinePrivate() - : startTime(0), duration(1000), startFrame(0), endFrame(0), + : easingCurve(QEasingCurve::InOutSine), + startTime(0), duration(1000), startFrame(0), endFrame(0), updateInterval(1000 / 25), totalLoopCount(1), currentLoopCount(0), currentTime(0), timerId(0), - direction(QTimeLine::Forward), easingCurve(QEasingCurve::InOutSine), + direction(QTimeLine::Forward), state(QTimeLine::NotRunning) { } + QElapsedTimer timer; + QEasingCurve easingCurve; + int startTime; int duration; int startFrame; @@ -70,10 +74,8 @@ public: int currentTime; int timerId; - QElapsedTimer timer; QTimeLine::Direction direction; - QEasingCurve easingCurve; QTimeLine::State state; inline void setState(QTimeLine::State newState) { diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index 08a5ce0861..ee34469c03 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -596,9 +596,11 @@ QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &zoneId, int offsetSec } QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QUtcTimeZonePrivate &other) - : QTimeZonePrivate(other), m_offsetFromUtc(other.m_offsetFromUtc), m_name(other.m_name), - m_abbreviation(other.m_abbreviation), m_country(other.m_country), - m_comment(other.m_comment) + : QTimeZonePrivate(other), m_name(other.m_name), + m_abbreviation(other.m_abbreviation), + m_comment(other.m_comment), + m_country(other.m_country), + m_offsetFromUtc(other.m_offsetFromUtc) { } diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 108aec2654..4fbb3ff6e0 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -203,11 +203,11 @@ private: const QString &abbreviation, QLocale::Country country, const QString &comment); - int m_offsetFromUtc; QString m_name; QString m_abbreviation; - QLocale::Country m_country; QString m_comment; + QLocale::Country m_country; + int m_offsetFromUtc; }; #ifdef QT_USE_ICU |