summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Fix bootstrap applications crashing when QT_MESSAGE_PATTERN contains ↵Olivier Goffart2016-09-211-0/+1
| | | | | | | | | | | | %{backtrace} tokens[i] was left uninitialized. This could cause a crash when moc produces a qWarning. Task-number: QTBUG-56045 Change-Id: I6fba933005edd29756f0d6b1cfe53243254ac7b2 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: add macOS example of QAbstractNativeEventFilter implementationSamuel Gaist2016-09-204-2/+124
| | | | | | | | | This patch adds a sample native event filter that can be easily integrated in a project. Task-number: QTBUG-53209 Change-Id: Iedf6df33a3de5b01dc7871cca5e7897a5b485733 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* QAbstractProxyModel: fix sentence structure in apidocFrederik Schwarzer2016-09-191-1/+1
| | | | | Change-Id: Ib3371549ecb80da326260b1df431f20e7a04f07e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Q(Date|Time)+::(to|from)String(): mention relevant QLocale methodsEdward Welbourne2016-09-161-12/+19
| | | | | | | | | | | | The const QString &format variants of these methods lack adequate control over the locale used; the Qt::DateFormat variants give only limited control over the format string. So reference the QLocale methods that provide the general case, in the docs of each. Also made the \sa cross-referencing among these methods a little more coherent. Task-number: QTBUG-55632 Change-Id: Icd0c8548045e74879e941ba089c3bdea78f14e34 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix the GCC version supporting -Wsuggest-overrideLoïc Molinari2016-09-161-1/+1
| | | | | | | | | Q_CC_GNU is (__GNUC__ * 100 + __GNUC_MINOR__), so 510 is 5.10 not 5.1.0. The first GCC 5 release has support for -Wsuggest-override, so it should really be 501. Change-Id: I7b264af087cd4562ce8720c99b70116d7654ea5f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Suppress ICC warning #111 about unreachable code in toWCharArrayThiago Macieira2016-09-151-0/+1
| | | | | | | qstring.h(961): warning #111: statement is unreachable Change-Id: I33dc971f005a4848bb8ffffd14748ae03dadefc9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QLatin1String: Fix UB (nullptr passed) in relational operatorsMarc Mutz2016-09-151-11/+11
| | | | | | | | | | | | | | | | | | Found by UBSan: qstring.h:1160:44: runtime error: null pointer passed as argument 1, which is declared to never be null qstring.h:1160:44: runtime error: null pointer passed as argument 2, which is declared to never be null Fix by avoiding the memcmp() calls if there's a chance that they might be called with nullptr. While at it, also implement !=, >, <=, >= in terms of ==, <, and add a test, because this particular UB was not fingered by any of the QtCore test cases, but by a Qt3D one. Change-Id: I413792dcc8431ef14f0c79f26e89a3e9fab69465 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qcompilerdetection.h: retract Q_COMPILER_DEFAULT_MEMBERS for MSVC < 2015Marc Mutz2016-09-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier versions of the compiler cannot default move special member functions, even though we also define Q_COMPILER_RVALUE_REFS for them. Fix by retracting the less-often-used of the two compiler feature defines. Q_COMPILER_DEFAULT_MEMBERS is not used outside QtBase in neither 5.6 nor 5.7 (5.8 is not released at this time, so wasn't considered). The same is true of the dependent macros Q_COMPILER_DEFAULT_DELETE_MEMBERS and Q_DECL_EQ_DEFAULT. In QtBase, the three uses are: 1. in QAtomic*, where the user also requires Q_COMPILER_CONSTEXPR, which is not defined for any MSVC at this time, 2. for QEnableSharedFromThis, which is a class template with an alternative {} implementa- tion of the default constructor, and uncon- ditional user-defined copy special member functions. 3. The test of the corresponding functionality in tst_compiler, which this commit amends. That means that neither of these two only uses of the macro in Qt libraries are affected by the change. The reason we do this change, then, is that in the future, we want to be able to more easily restore move special member functions for classes for which they are suppressed due to user-defined dtors or copy special member functions. Change-Id: I6f88cad66d6b87a758231f16355c3bddae697b86 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qstrncpy: don't call strncpy_s with invalid parametersMarc Mutz2016-09-031-3/+4
| | | | | | | | | | | | | | | According to https://msdn.microsoft.com/en-us/library/5dae5d43.aspx, strncpy_s' second argument must not be 0: > If strDest or strSource is NULL, *or numberOfElements is 0*, the > invalid parameter handler is invoked. Move the existing check for len > 0 up to protect the strncpy_s call, too. Change-Id: I70d339ea60d4b76f3038b2e4e4756f6590a9bd31 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeType: use default locale rather than system localeDavid Faure2016-08-242-4/+4
| | | | | | | | | | | | | This makes it possible for the application to control which language is used by QMimeType::comment() [ChangeLog][QtCore][QMimeType] QMimeType::comment() now uses the default locale rather than system locale, so that applications can control which language is being used. Task-number: QTBUG-50776 Change-Id: I82623b7c488035a4164fadaf37ebcc79a9fd6173 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMutex: Make freelist() return a real global staticRaphael Kubo da Costa2016-08-231-25/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Since Qt 5.6.0, some applications such as Kate (built with clang, libc++ and libcxxrt) on FreeBSD occasionally crash with the following error message on exit: QMutex::lock(): sem_wait failure: Invalid argument [or pthread_cond_wait in the 5.6 branch] Investigation by Gleb Popov, Thiago Macieira and Olivier Goffart has shown that this is caused by the fact that QDBusConnectionManager is a Q_GLOBAL_STATIC (so it will be destroyed with all the other Q_GLOBAL_STATICs in the reverse order of construction). In the Q_COMPILER_THREADSAFE_STATICS case, freelist() also returns a function-level static that is constructed on first use, so it may be destroyed earlier than the QDBusConnectionManager object, making it impossible to lock a contended mutex. We now make freelist() return a global static, so that it is always destroyed after QDBusConnectionManager and other function-static variables. Change-Id: I210fa7c18dbdf2345863da49141b9a85cffdef52 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix problem with exception reporting in QFuture::waitForResult()Christian Strømme2016-08-231-6/+5
| | | | | | | | | | This fixes a problem that occurs when a task, that is run synchronously, throws an exception. If that happened, then the exception would not be re-thrown, because of an early return. Task-number: QTBUG-54831 Change-Id: Ic70c5b810ec6adce6e62bfd6832ba9f170b13a7f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Revert "QLocale: Actually get the language script for the system locale"Orgad Shaneh2016-08-231-3/+2
| | | | | | | | | | | | | | | | The text direction should *not* be set by the default script, but by the UI direction. For example, if the default script is Hebrew, but the UI is in English, it doesn't make sense to default all the controls to RTL. This should be done only if the UI is RTL. This reverts commit a90869861cbc9927af2bbab5a94630e47b33fd5c. Task-number: QTBUG-53110 Change-Id: I5a6951ac30f24eec86bc0ae2a9fcfe14eb3a8e28 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QJsonValue: use Q_NULLPTR instead of 0 in ctorDyami Caliri2016-08-171-1/+1
| | | | | | | | Use Q_NULLPTR in all public headers Task-number: QTBUG-45291 Change-Id: Ib294deb3c210a9a186448cbf9656af7a09fea2c1 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix documentation of the Windows parts of QSettings::setPath()Friedemann Kleint2016-08-161-10/+14
| | | | | | | | | | Explain in terms of CSIDL_ values and update the sample locations. Task-number: QTBUG-55065 Change-Id: I15ddf32555d43cffae66d98c6ac12d62a98d5e6d Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* QLinkedList: compile with -Wzero-as-null-pointer-constantMarc Mutz2016-08-161-2/+2
| | | | | | | | | The existing header check unfortunately doesn't detect uses of '0' as nullptr in template code. Task-number: QTBUG-45291 Change-Id: Ibe701402d95deca98c5286e2cee5f7118fd7f606 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix typo (word repetition) in documentationFrederik Schwarzer2016-08-121-1/+1
| | | | | Change-Id: I1c8785e39f28f94846126fc45b875e6425a4ce12 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-1221-111/+111
| | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QStringListModel: fix dataChanged's roles parameterMarc Mutz2016-08-121-1/+7
| | | | | | | | | | | | | In QStringListModel, the display and the edit roles are synonyms, so when one is changed, the other changes with it. However, in setData() we only emitted a vector with just the role that was passed in by the user. Fix by always passing both roles, regardless of which one was used to set the data. Change-Id: I498e7cb33796fae266901817b01ad85d861d4bb4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QCommandLineParser: call qCoreApp post routines before ::exit()David Faure2016-08-121-0/+5
| | | | | | | This gives a chance for some cleanups at least. Change-Id: I3a628e32c6fc8c7fa00943769210c517005f2a0a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTimeParser::getAmPmText() use QLocale instead of tr()Edward Welbourne2016-08-111-5/+3
| | | | | | | | | | I am not convinced toUpper/toLower is a generally sound solution here; however, QLocale doesn't make the upper/lower case distinction this parser does and a bug report shows tr() isn't doing an adequate job. Task-number: QTBUG-47815 Change-Id: Iaf654d1d76d4c38d74fc647e168d50debb924a8f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMap: remove statement about STL support during Qt's own configurationGiuseppe D'Angelo2016-08-071-6/+0
| | | | | | | | Since STL support is mandatory in Qt 5, the sentence is a tautology and can be removed. Change-Id: I8676368cc917aa00a85b1113ed2a47694427b2ce Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix permissions on lock files on UnixSimon Hausmann2016-08-051-2/+2
| | | | | | | | | | | | | | We should create the files with 0666 and let the umask take care of adjusting to the final permissions in the file system. [ChangeLog][QtCore][QLockFile] Fixed permissions on lock files on Unix to allow for adjustments via umask. Change-Id: Iee6a6ac3920d0ffd4465f54ac6e955f7fe087173 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* QUrl::resolved: keep treating file:name.txt as relative for nowDavid Faure2016-08-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | 8a33077 made QUrl::resolved() follow its documentation ("If relative is not a relative URL, this function will return relative directly.", where relative means scheme is empty). However there is much code out there (e.g. qtdeclarative) which relies on QUrl::fromLocalFile("fileName.txt") to be treated as relative, so for now, we still allow this (in Qt 5.6.x). For Qt 5.8, this commit will be reverted. [ChangeLog][QtCore][QUrl] [EDITORIAL: replaces 8a33077] QUrl::resolved() no longer treats a URL with a scheme as a relative URL if it matches this URL's scheme. For now it still treats "file:name.txt" as relative for compatibility, but be warned that in Qt 5.8 it will no longer consider those to be relative. Both isRelative() and RFC 3986 say that such URLs are not relative, so starting from Qt 5.8, resolved() will return them as is. Change-Id: Iff01e5b470319f6c46526086d765187e2259bdf5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QString: fix append(const QStringRef &str)Anton Kudryavtsev2016-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | Use QStringRef::isNull instead of QStringRef::string() for validation. Non-NULL str.string() may yet leave us with a useless str.unicode(), which is the actual problem here; whereas !str.isNull() does really confirm that str.unicode() is sensible. Such test prevents situation like: const QString a; QString b; b.append(a); // b.isNull() == true b.append(QStringRef(&a)); // b.isNull() == false Auto test updated: create QStringRef from QString directly, without any condition. Change-Id: I082cd58ef656d8a53e3c1223aca01feea82fffb9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QStringListModel: begin/endResetModel() are no signalsMarc Mutz2016-08-031-2/+2
| | | | | | | | | ... so don't use emit on them. Just confuses readers. Change-Id: I24365fc533b5b35f8942d6014dbc68387aa23e22 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fixed Bug in QVariant comparison when containing QStringListsClemens Sielaff2016-08-031-0/+2
| | | | | | | | | | | | | | | | | As it were, QStringLists were not handled explicitly when comparing QVariants. If both QStringLists contained only a single entry, they were treated as QStrings - if both QStringLists were empty, there were equal (correctly so) - but if one of the QStringLists had more than one entry, the compare function fell through to returning always 1. As discussed here: https://stackoverflow.com/a/38492467/3444217 Added rich comparison tests for all non-numerical, non-recursive QVariants that support them (except QModelIndex and QPersistentModelIndex) Task-number: QTBUG-54893 Change-Id: Icc5480d9ba056ee5efe83da566c5829caa1509d7 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* QTzTimeZonePrivate: skip redundant check, tidy upEdward Welbourne2016-08-021-11/+10
| | | | | | | | | | Various transition functions checked on m_tranTimes.size() > 0 inside a block which was conditioned on this already; simplify the code by knowing this is true already. Tidied up an initializer at the same time. Change-Id: I3e933a69e1b71b94bfd4451e4d761844da669d33 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSortFilterProxyModel: Don't forward the hint from source's layoutChanged signalOlivier Goffart2016-08-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can't forward a VerticalSortHint or HorizontalSortHint hint, because we might be filtering extra items. The documentation of QAbstractItemModel::LayoutChangeHint states: Note that VerticalSortHint and HorizontalSortHint carry the meaning that items are being moved within the same parent, not moved to a different parent in the model, and not filtered out or in. And some of the views rely on this assumption (QQmlDelegateModel for example) What happens in the test is the following: - 'model' emit the dataChanged signal when its data is changed. - 'proxi1' QSortFilterProxyModelPrivate::_q_sourceDataChanged does not forward the dataChanged signal imediatly, it will instead first re-sort the model and call layoutAboutToBeChanged / layouChanged with the VerticalSortHint - 'proxy2' would forward the layoutAboutToBeChanged with the hint, but in QSortFilterProxyModelPrivate::_q_sourceLayoutChanged, it will redo the mapping which will cause the changed data to be filtered. So proxy2 can't forward the VerticalSortHint as it removed rows in the process. Change-Id: I20b6983e9d18bf7509fe6144c74f37d24e4a18c2 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Docs changed to reflect that valueName is required with value parsingKonstantin Shegunov2016-07-291-2/+2
| | | | | | | | | | | When the option expects a value the valueName parameter of the constructor isn't optional; it must be set. This requirement is made explicit in the documentation. Task-number: QTBUG-54855 Change-Id: I190884aff2fa8e96bc5c5e82cdfed85be761d6e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* QUrl: fix resolved() for data URLsDavid Faure2016-07-291-2/+1
| | | | | | | | | | | | | | They look relative because the path doesn't start with a '/' but they have a scheme so they shouldn't be combined as if it was one absolute and one relative URL. [ChangeLog][QtCore][QUrl] QUrl::resolved() no longer treats a URL with a scheme as a relative URL if it matches this URL's scheme. This special casing was incompatible with RFC 3986 and broke resolving data: URLs, for instance. Change-Id: I3758d3a2141cea7c6d13514243eb8dee5d510dd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix for race condition in signal activationDenis Kormalev2016-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a race condition between QObject::disconnect() and QMetaObject::activate() which can occur if there are multiple BlockingQueued connections to one signal from different threads and they connect/disconnect their connections often. What can happen in this case is: T1 is in activate() method and T2 is in disconnect() method T1 T2 locks sender mutex selects next connection unlocks sender mutex locks sender mutex sets isSlotObject to false creates QMetaCallEvent derefs connection posts event Two things can happen here: 1. Connection can still be valid, but it will have isSlotObject==false and callFunction will be used instead of slotObj 2. Connection can already be invalid To fix it mutex unlock should be moved after QMetaCallEvent creation. Also there is another case, when we don't disconnect but delete the receiver object. In this case it can already be invalid during postEvent, so we need to move mutex unlock after postEvent. Change-Id: I8103798324140ee11de5b4e10906562ba878ff8b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix gcc -Wsuggest-override warning on Q_OBJECTDavid Faure2016-07-281-0/+2
| | | | | | | | Same reasoning as commit 3092bd5 (which was for Clang), but for gcc >= 5.1. Change-Id: I123b17670c1a64876b01fd39fb11648fa4e8b1fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QVector: fix crash on reserve(0)David Faure2016-07-281-1/+5
| | | | | | | | | | It crashed when d was equal to Data::unsharableEmpty(). Task-number: QTBUG-51758 Change-Id: If9f2a7d11892507135f4dc0aeef909f59b7478fc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Fix grammar error in QFlags documentationMitch Curtis2016-07-261-1/+1
| | | | | Change-Id: I1c5d2be402f7e194eaa2e6f646aa5edad1bfd9d9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Work around ICC bug about shadowing declarations that aren't shadowingThiago Macieira2016-07-242-8/+8
| | | | | | | | | | | | | Known ICC bug, still present in version 17 beta. qdatetime.h(126): error #3280: declaration hides member "QDate::jd" (declared at line 136) Obviously a parameter to static function or to a function in a nested class can't shadow an NSDM. Intel issue IDs: 0000698329 / DPD200245740 Change-Id: I149e0540c00745fe8119fffd1463c679a3a9c8c3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Windows: Fix truncation in QFSFileEnginePrivate::nativeWrite()Friedemann Kleint2016-07-211-4/+2
| | | | | | | | | | The number of bytes to write was converted to a 32bit unsigned value, causing losses. Change the type to qint64 and adapt the code determining the block size. Task-number: QTBUG-54870 Change-Id: I294da5bfe97c7e60f67228399e1244a1aba4c89c Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Make sure JNI_OnLoad is not called more than onceBogDan Vatra2016-07-201-0/+5
| | | | | | | | | | | | | | | | | | Since Android 5.0 Google introduce a nasty bug[1] which calls JNI_OnLoad more than once. Basically every time when a library is loaded JNI_OnLoad is called if found, but it calls *again* JNI_OnLoad of its .so dependencies! So, JNI_OnLoad of libQt5Core.so gets called may times, this is not a problem as long as it's called from Qt's java delegate class loader. The problem is that the application .so file *must* be called from default class loader to allow the user to find his custom Activity/Service stuff. [1] Workaround https://code.google.com/p/android/issues/detail?id=215069 Change-Id: Ia71209658ef56056b560018597608acf7cb0f9ea Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix QTemporaryDir to handle Unicode characters on WindowsFriedemann Kleint2016-07-201-22/+30
| | | | | | | | | | | | | | | | | | For platforms not providing mkdtemp(), QTemporaryDir relied on an implementation of q_mkdtemp() operating on char *, converting back and forth using QFile::encodeName()/decodeName() when passing the name to QFileSystemEngine. This caused failures on Windows (which uses "System"/Latin1 encoding) for names containing characters outside the Latin1 space. Reimplement q_mkdtemp() to operate on QString, which avoids the conversions altogether and also enables the use of larger character spaces for the pattern. Add tests. Task-number: QTBUG-54810 Change-Id: Ie4323ad73b5beb8a1b8ab81425f73d03c626d58a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Workaround clang explicit specializations function templates export bugBogDan Vatra2016-07-201-150/+150
| | | | | | | Should be reverted when https://github.com/android-ndk/ndk/issues/34 is fixed Change-Id: Ic7fe394412afc25082a9689da59d36cba8b3dade Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Work around Apple defining "check"Thiago Macieira2016-07-201-0/+5
| | | | | | | | The header says they'll stop doing that in the next release. It's been like that since at least the OS X 10.8 SDK... Change-Id: Ib57b52598e2f452985e9fffd14585d4838dc8b09 Reviewed-by: Richard J. Moore <rich@kde.org>
* QTzTimeZonePrivate: missing spaces for readability.Edward Welbourne2016-07-181-3/+3
| | | | | Change-Id: If19669750fab89fbe0ac24d98b89fa1ea597fbb9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUtcTimeZonePrivate::data - skip spurious invalid start state.Edward Welbourne2016-07-181-2/+3
| | | | | | | | | | Most fields were over-written after setting invalid. The two that weren't (not used by QUtcTimeZonePrivate) should be (if only for uniformity with other QTimeZonePrivate variants), so set them to sensible values. Change-Id: I824ca0108d5b6bc322f76a0d1683342f789523b1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: Fix QXmlStreamReader for invalid characters in XML 1.0Luca Bellonda2016-07-171-0/+4
| | | | | | | | | | | | | | | | | The XML parser uses fastScanLiteralContent() to read a block of text. The routine was not checking the range of valid characters as defined in the XML standard: https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char A check has been added to stop reading the bad character. Note that the characters are legal in XML 1.1, but QXmlStreamReader is a well-formed XML 1.0 parser [ChangeLog][QtCore][QXmlStreamReader] Fixed a bug in the XML parser that prevented to load XML that contained invalid characters for XML 1.0. Change-Id: I10aaf84fbf95ccdaf9f6d683ea7c31925efff36d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* FreeBSD: move order of includes for compilingRalf Nolden2016-07-131-3/+3
| | | | | | | | | The previous patch works for FreeBSD 10 but however not for 9 and 11 due to the order of includes. Move <sys/user.h> down to fix those compile issues due to unknown types when user.h is included first. Change-Id: Ica3d3ddf335a543c4a473e8b80d1667cb81667cf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString::replace(): protect sought text and replacementEdward Welbourne2016-07-121-20/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When replacing each copy of one text with a copy of another, we do so in batches of 1024; if we get more than one batch, we need to keep a copy of the sought text and replacement if they're part of the string we're modifying, for use in later batches. Also do the replacements in full batches of 1024, not 1023 (which left the last entry in an array unused); marked some related tests as (un)likely; and move some repeated code out into a pair of little local functions to save duplcation. Those new functions can also serve replace_helper(); and it can shed a const_cast and some conditioning of free() by using them the same way replace() now does. (There was also one place it still used the raw after, rather than the replacement copy; which could have produced errors if memcpy were to exercise its right to assume no overlap in arrays. This error is what prompted me to notice all of the above.) Added tests. The last error proved untestable as my memcpy is in fact as fussy as memmove. The first two tests added were attempts to get a failure out of it. The third did get a failure, but also tripped over the problem in replace() itself. Added to an existing test function and renamed it to generally cover extra tests for replace. Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString::replace(): Commentary clarifications.Edward Welbourne2016-07-121-9/+9
| | | | | | | | Also skip doing a += 0 when we had to test whether the relevant rhs was zero anyway (because we want to ++ there instead of +=ing). Change-Id: Ibd5f21eb9aaf410b09c9db8450b2d61618e628fc Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* QMacTimeZonePrivate - correctly initialize m_nstz data-memberTimur Pocheptsov2016-07-111-0/+1
| | | | | | | | | | | | | | | The default ctor never initializes m_nstz but calls init with [NSTimeZone systemTimeZone].name. Init (re)sets m_nstz _only_ if this ianaId is in [NSTimeZone knownTimeZoneName], which is not guaranteed (a good example is "US/Pacific" that can be returned by systemTimeZoneId() - the similar problem is described in [*]. Set m_nstz to nil in ctor, so if 'init' fails we still have a valid (nil) pointer. [*] http://stackoverflow.com/questions/19819268/convert-ios-localtimezone-to-a-knowntimezone. Task-number: QTBUG-54330 Change-Id: I68917926350aad3158d44a06f06721f25b3fdb74 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QStringBuilderCommon: drop const from resolved() result typeMarc Mutz2016-07-111-1/+1
| | | | | | | | | | | | The const qualification prevented toUpper() etc from calling the rvalue overloads of the corresponding QString functions. Since resolved() always returns a non-shared object, the rvalue overloads can re-use the object's capacity for storing their result, saving up to one memory allocation per QStringBuilderCommon::to*() invocation. Change-Id: Ica97fcd906cdd949ffe56055654578b93407e2d3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: fix incomplete doc of chop()Anton Kudryavtsev2016-07-081-1/+1
| | | | | | Change-Id: I84de848681e793e68e0c290719a7f961aca48f4e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>