summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move text-related code out of corelib/tools/ to corelib/text/Edward Welbourne2019-07-101-12593/+0
| | | | | | | | This includes byte array, string, char, unicode, locale, collation and regular expressions. Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Be less laissez-faire with implicit conversions to QCharMarc Mutz2019-07-091-2/+2
| | | | | | | | | | | | | QChar currently is convertible from nearly every integral type. This is bad code hygiene and should be fixed come Qt 6. The present patch is the result of compile fixes from marking these constructors explicit. As is clear from the distribution of fixes, only low-level string handling code used these implicit conversions, an indication that they're not in widespread use elsewhere. Change-Id: Ief5336f21e6d181e03ab92893b3d13a14adc7cb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-07-011-0/+18
|\ | | | | | | | | | | | | | | Conflicts: src/network/ssl/qsslsocket_openssl.cpp src/platformsupport/vkconvenience/qvkconvenience.cpp Change-Id: I97ce6ed185f7fdad8102cc58d3cfec0119fd7bb4
| * Document OOM conditions in the QArrayData-based containersThiago Macieira2019-06-281-0/+18
| | | | | | | | | | | | | | | | | | | | | | The other containers probably don't handle as well, so I just documented the ones that I know how they work. Fixes: QTBUG-75470 Change-Id: I95ecabe2f50e450c991afffd159a0483aac35a79 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: fix comments for qsizetypeAnton Kudryavtsev2019-06-271-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I445ba61513fbafd24834fa48ade849feae4f1324 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: towards QStringView::arg() pt.4: port QString::arg() to ↵Marc Mutz2019-06-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStringView::arg() This allows us to drop QString::multiArg() from the build as soon as we can break BC, ie. in Qt 6. Change-Id: Ibdfbf9e9586952e0ec125120bb5966eb56c0ce67 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: towards QStringView::arg() pt.3: Long live ↵Marc Mutz2019-06-201-23/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStringView/QLatin1String::arg() This version of arg(), unlike its QString counterpart, transparently accepts views without conversion to QString, and is also extensible to further argument types, say a future QFormattedNumber. [ChangeLog][QtCore][QStringView/QLatin1String] Added arg(), taking arbitrarily many strings. Change-Id: If40ef3c445f63383e32573f3f515fdda84c7fe3a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QStringView, QLatin1String: add lastIndexOf methodsAnton Kudryavtsev2019-06-181-125/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | While touching the code, factor out internal methods to avoid needlees latin1->utf16 conversion. [ChangeLog][QtCore][QLatin1String] Added lastIndexOf(). [ChangeLog][QtCore][QStringView] Added lastIndexOf(). Change-Id: I1c624f00e4ed10111e0d00b86daff7904eeed176 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: towards QStringView::arg() pt.2: port internal machinery to QStringViewMarc Mutz2019-06-061-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This involves replacing the use of QStringRef with QStringView and replacing int indexes and sizes with qsizetype ones. Since we use QStringView now, where mid() is cheap and well-defined, remove the offset and length parameters that used to be Part ctor arguments, and use mid() in the caller. Change-Id: I08f3cd467b7b935f734b73d15eb8564b7deaa87e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: towards QStringView::arg() pt.1: modernize some codeMarc Mutz2019-06-061-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | Replace explicit iterator loops with ranged for loops. Also remove the pointless detach() of the QString result, caused by calling mutable data() instead of using the old trick of const-casting constData(). Change-Id: Ia7e2cb2926dc30b4dba33200b17697fd33d22446 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-5/+5
| | | | | | | | | | | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix a minor grammar glitch in new string / byte-array doc noteEdward Welbourne2019-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends 8845caa057cfcf54f7d46621adb3393c13747ffb. Change-Id: I4bf09b9c1fff52815de58070fbe4ff0c08eff53f Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QLatin1String, QStringView: add containsAnton Kudryavtsev2019-06-041-2/+49
| | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QLatin1String] Added contains(). [ChangeLog][QtCore][QStringView] Added contains(). Change-Id: I19fd2e155180edd8620c520f4e60a1f86f0603ac Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QString/QByteArray: detach immediately in operator[]Giuseppe D'Angelo2019-05-191-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike any other implicitly shared container, QString/QByteArray have a "lazy detach" mechanism: their operator[] returns a special object; assignment into that object will actually detach. In other words: QString a("Hello"); QCharRef c = a[0]; // does not detach c = 'J'; // detach happens here This allows this behavior: QString a("Hello"); QCharRef c = a[0]; QString b = a; c = 'J'; // detach happens here assert(a == "Jello"); assert(b == "Hello"); Note that this happens only with operator[] -- the mutating iterator APIs instead detach immediately, making the above code have visible side effects in b (at the end, b == "Jello"). The reasons for this special behavior seems to have been lost in the dawn of time: this is something present all the way back since Qt 2, maybe even Qt 1. Holding on to a "reference" while taking copies of a container is documented [1] to be a bad idea, so we shouldn't double check that the users don't do it. This patch: 1) adds an immediate detach in operator[], just like all other containers; 2) adds a warning in debug builds in case QByteRef/QCharRef is going to cause a detach; 3) marks operator[] as [[nodiscard]] to warn users not using Clazy about the (unintended) detach now happening in their code. This paves the way for removal of QCharRef/QByteRef, likely in Qt 7. [1] https://doc.qt.io/qt-5/containers.html#implicit-sharing-iterator-problem [ChangeLog][QtCore][QString] QString::operator[] detaches immediately. Previously, the detach was delayed until a modification was made to the string through the returned QCharRef. [ChangeLog][QtCore][QByteArray] QByteArray::operator[] detaches immediately. Previously, the detach was delayed until a modification was made to the byte array through the returned QByteRef. Change-Id: I9f77ae36759d80dc3202426a798f5b1e5fb2c2c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix qdoc warnings for Qt 5.14Friedemann Kleint2019-05-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/corelib/tools/qstring.cpp:9505:clang found diagnostics parsing \fn int QLatin1String::indexOf(QLatin1String l1, int from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QLatin1String' src/corelib/tools/qstringview.cpp:723:clang found diagnostics parsing \fn qsizetype QStringView::indexOf(QLatin1String l1, qsizetype from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QStringView' src/corelib/tools/qstringview.cpp:822:Unknown command '\t' src/corelib/tools/qstringview.cpp:825:Unknown command '\t' src/corelib/tools/qstringview.cpp:826:Unknown command '\t' src/corelib/tools/qstringview.cpp:831:Unknown command '\t' src/corelib/global/qnamespace.qdoc:2448:Undocumented enum item 'MarkdownText' in Qt::TextFormat src/corelib/tools/qstringmatcher.cpp:183:No such parameter 'pattern' in QStringMatcher::QStringMatcher() src/network/ssl/qsslerror.cpp:58:Undocumented enum item 'CertificateStatusUnknown' in QSslError::SslError src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screenOrientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent() src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screen' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent() src/gui/kernel/qevent.cpp:5321:No such parameter 'orientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent() src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockCodeLanguage' in QTextFormat::Property src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockQuoteLevel' in QTextFormat::Property src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockMarker' in QTextFormat::Property src/gui/text/qtextdocument.cpp:3294:Undocumented parameter 'features' in QTextDocument::toMarkdown() src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace1' in QColorSpace::operator!=() src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace2' in QColorSpace::operator!=() src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace1' in QColorSpace::operator!=() src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace2' in QColorSpace::operator!=() examples/widgets/doc/src/icons.qdoc:269:Command '\snippet (//! [43])' failed at end of file 'widgets/icons/iconpreviewarea.cpp' src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogRetryButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogYesToAllButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogIgnoreButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogNoToAllButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogAbortButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_RestoreDefaultsButton' in QStyle::StandardPixmap src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogSaveAllButton' in QStyle::StandardPixmap src/testlib/qtestcase.qdoc:439:Undocumented parameter 'TestClass' in QTest::QTEST_HIGHDPI_SCALING_MAIN src/testlib/qtestcase.qdoc:452:Undocumented parameter 'TestClass' in QTest::QTEST_NO_HIGHDPI_SCALING_MAIN Change-Id: Ib0e9bf81c5caaa6b1fc644ac92085af47c600e0e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | QCharRef/QByteRef: warn when triggering the resizing operator= behaviorGiuseppe D'Angelo2019-05-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The whole reason of QCharRef/QByteRef existence is to have a magic operator=. This operator= delays the actual detach up to the moment something is written into the Ref, thus avoiding spurious detaches to the underlying string/byte array. operator= has also an extra feature, it allows this code to succeed: QString s("abc"); s[10] = 'z'; assert(s == "abc z"); This last behavior is *extremely* surprising. The problem with all of this is that this extra convenience is outweighted by the massive pessimization in the codegen for operator[]; by the maintenance burden (QChar APIs need to be mirrored in QCharRef, etc.), and, for the automatic resize, by the fact that it's an super-niche use case. Cherry on top, std::basic_string does not do that, and no Qt or std container does that. In other words: any other container-like class exhibits UB for out of bounds access. We can't just go and change behavior, though. This is something coming all the way back from Qt 2 (maybe even Qt 1), which means we can't deprecate it at short notice. This patch simply adds a warning in debug builds in case the special resizing behavior is triggered. While at it, removes some code duplication in QByteRef. [ChangeLog][QtCore][QString] The behavior of operator[] to allow implicit resizing of the string has been deprecated, and will be removed in a future version of Qt. [ChangeLog][QtCore][QByteArray] The behavior of operator[] to allow implicit detaching and resizing of the byte array has been deprecated, and will be removed in a future version of Qt. Change-Id: I3b5c5191167f12a606bcf6e513e6f304b220d675 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-05-131-13/+12
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I81dbf90fc936c9bf08197baefa071117bddb1c63
| * Doc: replace even more null/0/nullptr with \nullptr macroChristian Ehrlicher2019-05-081-13/+12
| | | | | | | | | | | | | | | | Try to replace all wordings like '.. to 0' with '.. to \nullptr'. Also checked for 'null pointer' and similar. Change-Id: I73341f59ba51e0798e816a8b1a532c7c7374b74a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QStringView, QLatin1String: add indexOf methodsAnton Kudryavtsev2019-05-101-9/+93
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QLatin1String] Added indexOf(). [ChangeLog][QtCore][QStringView] Added indexOf(). Change-Id: I9f56e5b40030e39b29e50914a46beb58013b537b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Prefix textstream operators with Qt::Lars Knoll2019-05-021-3/+3
| | | | | | | | | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-04-101-0/+4
|\| | | | | | | | | | | | | | | Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/gui/image/qpnghandler.cpp Change-Id: Ied79d02912ffb3a307a99483df7db08c7f9d0cd8
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-061-0/+4
| |\ | | | | | | | | | Change-Id: Iec860bb703f983b7438e67c695b9c454e72b3e0f
| | * Make qt_is_ascii work properly on big endian systemsDmitry Shachnev2019-04-051-0/+4
| | | | | | | | | | | | | | | Change-Id: Ia053fbc854a77e333edadb0be6c2e04826b8fbdb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Remove handling of missing very old compiler feature checkAllan Sandfeld Jensen2019-04-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes handling of missing Q_COMPILER_NULLPTR, Q_COMPILER_AUTODECL, Q_COMPILER_LAMBDA, Q_COMPILER_VARIADIC_MACROS and Q_COMPILER_AUTO_FUNCTION. We haven't supported any compilers without these for a long time. Change-Id: I3df88206516a25763e2c28b083733780f35a8764 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Replace qMove with std::moveAllan Sandfeld Jensen2019-04-061-6/+6
| | | | | | | | | | | | | | | | | | Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-50/+50
| | | | | | | | | | | | | | | | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | qstringalgorithms: add find methodsAnton Kudryavtsev2019-03-221-182/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also add qsizetype support. It's needed to add find methods to QStringView Change-Id: I45eac082924e27778c24eebbb19d694221c28978 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-141-15/+11
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qcollator_win.cpp Change-Id: I6d806d7c58b2057ebde3ad915bb5551f34b700e5
| * | Doc: Unify terminology for '\0'-terminated stringsChristian Ehrlicher2019-03-131-15/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation for QByteArray and QString is using different notations for '\0'-terminated strings. Unify them by using '\0'-terminated everywhere. Change-Id: Ia26ec5c50635bebba1b54b7fe227ff0bcca4f2ad Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* | | Add QStringView::toWCharArray() to match QStringEdward Welbourne2019-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QCollator needs it to add support for QStringView. In any case, it extends the mirror of QString's API. Naturally, we can reimplement QString's version using it. Change-Id: I5a23a3f2a98c7d59597b5e935542a93764b5e350 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | | QString: mark obsolete functions as deprecatedChristian Ehrlicher2019-03-041-0/+4
|/ / | | | | | | | | | | | | | | | | | | Mark obsolete functions in QString as deprecated so they can be removed with Qt6: - QString::sprintf() - QString::vsprintf() Change-Id: I9b7748db95291c34b95ff3ad3e3aabc8215aeaae Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-261-0/+2
|\| | | | | | | Change-Id: Id511850002d9274d17891c063376ac4b3ff939dd
| * Fix build for size with gccKirill Burtsev2019-02-231-0/+2
| | | | | | | | | | | | | | | | Fixes the error: variable 'isDifferent' set but not used Change-Id: Ibd60b17126057da64a41d325b7ef548316f27c4b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QtCore: replace null and nullptr with \nullptr in documentationChristian Ehrlicher2019-02-181-22/+22
| | | | | | | | | | | | | | Replace null and '\c nullptr' with \nullptr in the documentation. Change-Id: Ib9e0cfc2eb2830b213e6523773603d56180b0998 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-041-46/+160
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also blacklist tst_QRawFont::unsupportedWritingSystem() and tst_QGlyphRun::mixedScripts() on windows for now. Conflicts: qmake/generators/makefile.cpp src/corelib/itemmodels/qstringlistmodel.cpp src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp tests/auto/gui/text/qglyphrun/BLACKLIST tests/auto/gui/text/qrawfont/BLACKLIST Task-number: QTBUG-72836 Change-Id: I10fea1493f0ae1a5708e1e48d0a4d7d6b76258b9
| * Doc: Consistently mark QT_XYZ_CAST_FROM_ASCII with \cKai Koehne2018-12-221-7/+89
| | | | | | | | | | | | | | | | | | | | | | Otherwise it gets linkified, which looks inconsistent. Instead, use \sa for functions where QT_NO_CAST_FROM_ASCII or QT_RESTRICTED_CAST_FROM_ASCII is referenced. Change-Id: Ic3933d8c4c81c963215de7f3aac4d0a11e61cbc2 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Martin Smith <martin.smith@qt.io>
| * Add an AVX2 code path to qustrchrThiago Macieira2018-12-181-0/+23
| | | | | | | | | | | | | | The new loop does 32 bytes (16 code units) at a time Change-Id: I8f261579aad648fdb4f0fffd155412a4d77428e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * Merge some code to simplify maintenanceThiago Macieira2018-12-181-40/+49
| | | | | | | | | | | | Change-Id: I8f261579aad648fdb4f0fffd15541369e3625461 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-091-4/+17
|\| | | | | | | Change-Id: I10ae61ec6867b38601d85d6fc34e1f6a6ba0cc11
| * Optimize further the loading of 8 Latin 1 charactersThiago Macieira2018-12-081-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is important when AVX is enabled, which makes the VMOVQ load and the VPMOVZXBW instruction be combined into a single VPMOVZXBW with direct memory access. This is guaranteed to only read 8 bytes, so it's safe even close to the end of a page. Clang and ICC do combine the instructions like we want and I have filed a request for GCC to do so too[1]. AVX was first introduced in 2011, so plenty of computers today would benefit from this. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87317 Change-Id: I8f261579aad648fdb4f0fffd1553e08e90df3171 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-12-041-4/+8
|\| | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
| * Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-11-271-4/+8
| |\ | | | | | | | | | Change-Id: I12bcee17e349edd0dd4fd08da76361d1ffb1a727
| | * Fix toFloat()s between float and double ranges and documentEdward Welbourne2018-11-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised some toFloat()s to be consistent with the matching toDouble()s; previously, they would return infinity if toDouble() did but return 0 if toDouble() got a finite value outside float's range. That also applied to values that underflowed float's range, succeeding and returning 0 as long as they were within double's range but failing if toDouble() underflowed. Now float-underflow also fails. Amended their documentation to reflect this more consistent reality. Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toFloat] QString, QByteArray and QLocale returned an infinity on double-overflow (since 5.7) but returned 0 on a finite double outside float's range, while setting ok to false; this was at odds with their documented behavior of returning 0 on any failure. They also succeeded, returning zero, on underflow of float's range, unless double underflowed, where they failed. Changed the handling of values outside float's range to match that of values outside double's range: fail, returning an infinity on overflow or zero on underflow. The documentation now reflects the revised behavior, which matches toDouble(). Change-Id: Ia168bcacf7def0df924840d45d8edc5f850449d6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Change documentation of some toDouble()s to reflect realityEdward Welbourne2018-11-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They actually return infinity if conversion overflows, while still setting ok to false; they were documented to return 0 on failure, with no mention of this special handling of overflow. Documented reality rather than changing the behavior. Gave underflow as an example of failure other than overflow (toDouble()s do indeed fail on it). Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toDouble] QString, QByteArray and QLocale return an infinity on overflow (since 5.7), while setting ok to false; this was at odds with their documented behavior of returning 0 on failure. The documentation now reflects the actual behavior. Fixes: QTBUG-71256 Change-Id: I8d7e80ba1f06091cf0f1480c341553381103703b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-11-221-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qdir.cpp src/corelib/kernel/qtimer.cpp src/corelib/kernel/qtimer.h Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I683d897760ec06593136d77955f8bc87fdef3f9f
| * | Merge remote-tracking branch 'origin/5.12.0' into 5.12Liang Qi2018-11-161-1/+1
| |\ \ | | | | | | | | | | | | Change-Id: Ic1dd39044e19f50e1068d4ac70dacaad6440e570
| | * | Doc: Fix various documentation warningsTopi Reinio2018-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These include typos, marking functions as \internal, documenting trivial things, and fixing the function signatures passed to the \fn command. Task-number: QTBUG-71502 Change-Id: I24a9e1f7e1cdb39e5c31b99202bdd593c6b789ff Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-11-101-5/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/serialization/qcborcommon.h src/corelib/tools/qlocale_data_p.h tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: Ibed987f6d77a0294f78f67d78625237616082416
| * | | Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-11-091-5/+5
| |\ \ \ | | |/ / | |/| / | | |/ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf qmake/Makefile.unix src/gui/text/qtextdocument.cpp src/gui/text/qtextdocument.h Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
| | * Modernize the "textcodec" featureLiang Qi2018-11-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also clean up QTextCodec usage in qmake build and some includes of qtextcodec.h. Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>