summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QString: add missing char8_t* constructor / fromUtf8 overloadsGiuseppe D'Angelo2021-04-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we support: QString s = QString::fromUtf(u8"foo", 3); But we don't support QString s = QString::fromUtf8(u8"foo"); QString s(u8"foo"); There's no reason not to have these two functions. Guess what, we've actually got code _in Qt_ that tries to build a QString out of a char8_t; that code stops compiling under C++20 (which is supported, but not CI-tested at the moment, it seems). Re-add the missing constructor and fromUtf8 overloads. [ChangeLog][QtCore][QString] Added a constructor and a fromUtf8() overload taking a `const char8_t *` argument. Task-number: QTQAINFRA-4117 Task-number: QTQAINFRA-4242 Change-Id: I1f0ae658b3490b9e092941cabcc7fb8fc4c51aa3 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit b322bfcc14845a4b6a6eef85ef359b1e4591a5ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't access moved-from objectVolker Hilsheimer2021-03-041-7/+6
| | | | | | | | | | | | | | | | | | | | Clang's static analyzer tooling warns about this access-after-move [1]. While the comment above the function indicated that this was deliberate and relying on a moved-from QString being valid, it is still bad practice. Since 'str' is empty in moved-from state if - and only if - it was a non-const reference, make a compile-time check of the constness of type T instead. [1] https://testresults.qt.io/codechecker/daily_analyses/qtbase/dev/qtbase-dev-20210301-e14ccf0553/qstring.cpp_clang-tidy_b0545db57a2cc5dac67a56f76322ffd0.plist.html#reportHash=209ee3db0b17d21919326a1ad6635318 Change-Id: Iac1813b61b6a3c2ef4053b911a4043c5382f85e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 49113c905d5868e6b76bb6b7b3e0a20b0c56a23a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Minor tidy-up: two sizetype fixes, two \nullptr usesEdward Welbourne2021-01-081-2/+2
| | | | | Change-Id: I6c4a1296350ecaf9a661dba22670fbb2ad23bd77 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: update documentationIvan Solovev2020-12-151-117/+212
| | | | | | | | | | | | | | The QString documentation is aligned with QList regarding common wording and ideas: - Extend general class description - Revise description of several methods - Fix examples to use qsizetype instead of int - Wrap descriptions at 80 characters Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: I7d5a7e829ce8b98a0a1a7fae6b7ae0dec4effbae Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QStringView: add some QRegularExpression-related overloadsGiuseppe D'Angelo2020-12-101-0/+78
| | | | | | | | | [ChangeLog][QtCore][QStringView] Added the indexOf(), contains(), lastIndexOf() and count() methods taking a QRegularExpression. Fixes: QTBUG-89050 Change-Id: Ic726754f67e06b3764302d2fad252e0378a77afc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString::lastIndexOf: fix off-by-one for zero length matchesGiuseppe D'Angelo2020-12-101-2/+2
| | | | | | | | | | | Otherwise, it would report that lastIndexOf of an empty pattern in an empty string doesn't exist. Next commit adds extensive autotests; for now, disable a broken autotest (which already features a comment about why it's broken). Change-Id: I9a0e5c0142007f81f5cf93e356c8bd82f00066f7 Pick-to: 5.15 6.0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: fix count(QRegularExpression)Giuseppe D'Angelo2020-12-091-3/+9
| | | | | | | | | | | | | | | | | There is an off by one in the implementation of count(): a match must be attempted even at the very end of the string, because a 0-length match can happen there. While at it, improve the documentation on the counter-intuitive behavior of count(), which doesn't merely count how many times a regexp matches into a string using ordinary global matching. [ChangeLog][QtCore][QString] Fixed a corner case when using QString::count(QRegularExpression), causing an empty in the last position not to be accounted for in the returned result. Change-Id: I064497839a96979abfbac2d0a96546ce160bbc46 Pick-to: 5.15 6.0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: improve lastIndexOf(QRegularExpression) docsGiuseppe D'Angelo2020-12-091-0/+4
| | | | | | | | | | | Due to how regex matching works, lastIndexOf has to be implemented by matching from the string's beginning until the from position is reached. This might not be obvious for users, so document that. Task-number: QTBUG-89050 Pick-to: 5.15 6.0 Change-Id: I4b69ea753e7d417d980031926f1e01d77e58720d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix MSVC warning C4267 in qstring.cppKai Koehne2020-12-081-2/+4
| | | | | | | | | | | | | | | | Fix warnings qstring.cpp(9650): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data qstring.cpp(9654): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data QDataStream::writeBytes expects an uint as second parameter, not size_t. This reverts parts of 744e55b85a96b37a, where the explicit cast to size_t was introduced. Pick-to: 6.0 Change-Id: I2750a6f48fc09730aa9fa21dcc31f82e33b48b8b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString/QByteArray: add missing Q_CHECK_PTRThiago Macieira2020-12-041-0/+8
| | | | | | | | | | | | | | So these two classes throw when trying to allocate silly sizes or in OOM conditions. We probably want to move these Q_CHECK_POINTER into QTypedArrayData but I didn't want to do that in this commit. Task-number: QTBUG-88256 Task-number: QTBUG-88253 Change-Id: Ifc61bb80b9bf48a386abfffd1648176111770174 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLatin1String: documentation updatesIvan Solovev2020-12-021-61/+246
| | | | | | | | | | | | | | | Some updates for QLatin1String documentation: - Update signatures of some methods - Update outdated description for several methods - Add missing docs for friend operators - Wrap descriptions at 80 characters Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: I1c3c5ce2a6f4f57f92ab503a734c8244fe7cd7c5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString/QByteArray: add erase/erase_ifGiuseppe D'Angelo2020-12-011-0/+33
| | | | | | | | | | | | | [ChangeLog][QtCore][QString] Added erase() and erase_if() for consistent container erasure. [ChangeLog][QtCore][QByteArray] Added erase() and erase_if() for consistent container erasure. Change-Id: I23e8565d39044c1f1d756500589c1f2b65e1a88f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-1/+1
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Doc: Consistently use book style capitalization for QStringKai Koehne2020-11-271-2/+2
| | | | | | Pick-to: 5.15 6.0 Change-Id: I2ab64fe58ad737b23f0829ed91591efaa0c22c6f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Linkify all mentionings of QT_NO_CAST_TO_ASCIIKai Koehne2020-11-271-134/+66
| | | | | | | | | This way the user can directly click the link, instead of looking at the 'see also' section. Pick-to: 6.0 Change-Id: I50b62fe0b376a3f6462c11abc46a001c334ba82a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Improve *_CAST_FROM_ASCII documentationKai Koehne2020-11-271-14/+9
| | | | | | Pick-to: 5.15 6.0 Change-Id: Iba73c0a38e2c4add740aab20036aa39c56eb4d98 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QString/QByteArray: add erase() for iteratorsGiuseppe D'Angelo2020-11-261-0/+15
| | | | | | | | | | | | | Otherwise they're not usable with iterator-based algorithms that e.g. remove, partition and the like. [ChangeLog][QtCore][QString] Added erase(). [ChangeLog][QtCore][QByteArray] Added erase(). Change-Id: I78829b1a5365dd53b6b6423ceedbc52edeafbc63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix logic error in QString::replace(ch, after, cs)Andreas Buhr2020-11-191-1/+1
| | | | | | | | | | Coverage analysis showed that an if-branch marked "Q_LIKELY" was never taken. It turns out the code was incorrect, but behaved correctly. This patch fixes the logic and adds a unit test. Pick-to: 5.15 Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Remove wrong \obsolete doc commentsKarsten Heimrich2020-11-191-6/+12
| | | | | Change-Id: I541f12fab128493235716fb73d65f4ab0a62bb82 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix signature of QArrayDataOps::erase()Lars Knoll2020-11-171-1/+1
| | | | | | | | | | | | Bring it in line with the other methods that also take a pointer and a size. Also use truncate() in removeAll() as that's more efficient for the use case. Change-Id: Ib1073b7c048ceb96fb6391b308ef8feb77896866 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-2/+2
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* QChar: make construction from integral explicitGiuseppe D'Angelo2020-11-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QChar should not be convertible from any integral type except from char16_t, short and possibly char (since it's a direct superset). David provided the perfect example: if (str == 123) { ~~~ } compiles, with 123 implicitly converted to QChar (str == "123" was meant instead). But similarly one can construct other scenarios where QString(123) gets accidentally used (instead of QString::number(123)), like QString s; s += 123;. Add a macro to revert to the implicit constructors, for backwards compatibility. The breaks are mostly in tests that "abuse" of integers (arithmetic, etc.). Maybe it's time for user-defined literals for QChar/QString, but that is left for another commit. [ChangeLog][Potentially Source-Incompatible Changes][QChar] QChar constructors from integral types are now by default explicit. It is recommended to use explicit conversions, QLatin1Char, QChar::fromUcs4 instead of implicit conversions. The old behavior can be restored by defining the QT_IMPLICIT_QCHAR_CONSTRUCTION macro. Change-Id: I6175f6ab9bcf1956f6f97ab0c9d9d5aaf777296d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Clean realloc() related bits in QString/QBA and Q*ArrayOpsAndrei Golubev2020-11-121-5/+4
| | | | | | | | | | | | | | | Fixed misleading naming of "slowReallocatePath". It's no longer "slow", it's downright dangerous now to reallocate under certain conditions Added several asserts which should've been there already as our code would run into a UB/crash anyhow - let's at least get extra checks that are closer to the trouble causing places Bring back the (slightly modified) code-cleaning changes from 504972f838761f79a170c22225add496e7e5af6a Change-Id: Ie1358aebc619062d3991a78049e366dc0e8c267e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Update/scrub QString documentationKarsten Heimrich2020-11-111-14/+13
| | | | | | | Fixes: QTBUG-86554 Change-Id: I3d40295115207c430ec30bbac6fb241bf897e5fa Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Revert "Refine {QString, QBA}::reallocData() logic"Volker Hilsheimer2020-11-081-4/+5
| | | | | | | | | | This reverts commit 504972f838761f79a170c22225add496e7e5af6a. Introduced realloc failures in qdoc. Task-number: QTBUG-88258 Change-Id: I953e8d3933085022c75068af357ec9a44ab7e984 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Refine {QString, QBA}::reallocData() logicAndrei Golubev2020-11-061-5/+4
| | | | | | | | | | | | Fixed misleading naming of "slowReallocatePath". It's no longer "slow", it's downright dangerous now to reallocate under certain conditions While at it, added extra assert to QArrayData::reallocateUnaligned() and cleaned up that function a bit Change-Id: I05921fb5058eb563997e66107566c87fb4ea5599 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Always use fast path in QString::append(QLatin1String)Andrei Golubev2020-11-041-7/+4
| | | | | | | | | | | | This must be possible with a new set of changes and the way QString reallocates Task-number: QTBUG-86583 Change-Id: I513f51d7c6e984ae4e81fc344138687c791037c4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename AllocationPosition enum and its membersLars Knoll2020-11-041-2/+2
| | | | | | | Use GrowsAt* and GrowthPosition as that is clearer. Change-Id: I3c173797dec3620f508156efc0c51b4d2cd3e142 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move insert() operation into QArrayDataOpsLars Knoll2020-11-041-26/+22
| | | | | | | | | This allows us to unify and simplify the code base between QList, QString and QByteArray. Change-Id: Idc8f360d78f508a68f38eb3ef0ed6e5d37f90574 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clean up out allocation handlingLars Knoll2020-11-041-9/+9
| | | | | | | | | | Get rid of the allocation options inside the flags field of QArrayData, they are really a completely separate thing. Change-Id: I823750ab9e4ca85642a0bd0e471ee79c9cde43fb Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup QArrayDataOps::reallocate() and relatedLars Knoll2020-11-041-2/+2
| | | | | | | | | | Don't use QArrayData::GrowsForward/Backward anymore and replace it with a simple 'bool grow'. Change-Id: Ifddfef3ae860b11dda4c40854c71ef2aeb29df34 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't move data in QArrayDataOps::reallocate()Lars Knoll2020-11-041-2/+2
| | | | | | | | | reallocate() should only ever call realloc(), and only be used to create more space at the end of the data. Change-Id: I2ac4dbc90d2afaa571bb620108d7984356712cb2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Avoid expensive iterator calculations in append()Lars Knoll2020-11-041-62/+40
| | | | | | | | | | | | | Avoid moving data inside the array to create free space at one end. This is a performance bottleneck, as it required quite a lot of calculations for every insert. Rather reallocate and grow in this case, so we only need to do expensive work when we reallocate the array. Change-Id: Ifc955fbcf9967c3b66aa2600e0627aac15f0c917 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QArrayDataPointer: redesign (and simplify) growth policyAndrei Golubev2020-11-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | It looks like we can drastically simplify the way QADP grows without sacrificing much: 1. append-only use cases should have the same performance as before 2. prepend-only use cases should (with the help of other commits) get additional performance speedup 3. mid-insertion is harder to reason about, but it is either unchanged or benefits a bit as there's some free space at both ends now 4. mixed prepend/append cases are weird and would keep excess free space around but this is less critical and overall less used AFAIK Now, QList would actually start to feel like a double-ended container instead of "it's QVector but with faster prepend". This commit should help close the performance gap between 6.0 and 5.15 as well As a drawback, we will most likely have more space allocated in mixed and mid-insert cases. This needs to be checked Task-number: QTBUG-86583 Change-Id: I7c6ede896144920fe01862b9fe789c8fdfc11f80 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make remaining String binary comparisons hidden friendsAllan Sandfeld Jensen2020-10-261-13/+7
| | | | | | | | | Also forced the introduction of explicit comparisons with char16_t* and std::nullptr_t. Change-Id: I8e32c14a1d3aeec234ee070b9fefc6af06db0fda Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QString/QLatin1String comparisons hidden friendsAllan Sandfeld Jensen2020-10-261-111/+86
| | | | | | | Leaving most member comparisons untouched though. Change-Id: I8267f85927ec8315d511ac38757bc8d8aaaa5672 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix documentation for hidden friend operatorsVolker Hilsheimer2020-10-231-9/+4
| | | | | | | | At least for qdoc, hidden friends are class members. Change-Id: I6eaa21565937cd49c0905ee47b8b82b0c1765bc1 Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Smaller code cleanupLars Knoll2020-10-071-104/+55
| | | | | | | | | remove the static qt_compare_string methods and inline the code into the public ones. Change-Id: Id6f4c85a21df63875fd9816a368358f3f750617b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Optimize equality operators for string classesLars Knoll2020-10-071-0/+57
| | | | | | | | | | | | | Using compare() for those operators is not a good idea, as we can't shortcut comparisons if the string sizes are different. This alone made our HTML parser in QtGui around 15% slower. Don't go through QAnyStringView to implement compare() for QUtf8StringView, use QtPrivate::compareStrings() directly instead. Task-number: QTBUG-86354 Change-Id: I04869c29c9918161990dc1baf8e943b3a264ff3c Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Convert a couple of APIs to use viewsLars Knoll2020-10-061-10/+10
| | | | | | | | | | | Try to get rid of APIs that use raw 'const {char, QChar} *, length' pairs. Instead, use QByteArrayView or QStringView. As QStringConverter is a new class, simply change the API to what we'd like to have. Also adjust hidden API in QStringBuilder and friends. Change-Id: I897d47f63a7b965f5574a1e51da64147f9e981f6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change QString::fromLatin1 and friends to use QByteArrayViewLars Knoll2020-10-051-28/+47
| | | | | | | | | | | | Also adjust the QString constructor from QByteArray to ignore \0 characters in the string (and not terminate conversion there). [ChangeLog][QtCore][QString] Constructing a QString from a QByteArray will not stop at intermediate '\0' (null) characters in the string as in Qt 5, but will convert all characters in the byte array. Change-Id: I1f6bfefe76dfa9072b165903fec7aa4af1abd882 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Reference proper SplitBehaviour enum in docsNicolas Fella2020-10-021-1/+1
| | | | | | | | | QString::SkipEmptyParts is Qt::SkipEmptyParts now. Pick-to: 5.15 Change-Id: Ie351bbe9d2350e771f821a9f0bc9f581be5b0022 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Eliminate compilation warningsXie Chuan2020-09-301-1/+1
| | | | | | | | When converting a const variable to a non-const variable, use the conversion operator  Change-Id: Ib1c8f3defbf9ccce1af5c90e7e9c508bc8c039d0 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix qdoc warnings from Q(Latin1)StringVolker Hilsheimer2020-09-281-101/+5
| | | | | | | | | | | | | arg() is now a variadic template, already documented in qstringview.cpp, so document that and remove the documentation for the removed overloads. QString has no member subString, so remove that as well. Fix return type in QLatin1String member function documentation. Change-Id: I32e7bcba770bcee77ae4a07c06ac61228ffa93a6 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix some qdoc warnings for QString/View/TokenizerVolker Hilsheimer2020-09-261-2/+2
| | | | | | | | | | | | | | | | | Use correct member function prototype, which requires the template declaration. Remove see-alsos that don't exist. Document parameters for qTokenize. Still lots of warnings from QStringTokenizer, due to the inheritance structure of that template class and the declarations of nested types in undocumented base classes. Also, qdoc doesn't seem to recognize training this-lvalue/this-rvalue declarations for overloads, and considers the second toContainer documentations to override the first. Change-Id: Iadf967d3328ddda52b6f66786836853bddeda79b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Fix -Wmaybe-uninitialized warningsJulien Schueller2020-09-261-1/+1
| | | | | | | | | Fixes few of these, for example: qurlrecode.cpp:308:19: warning: 'ucs4' may be used uninitialized in this function [-Wmaybe-uninitialized] *output++ = ucs4; Change-Id: Iaf09fa854102c76b51e6e18556c5ef20212e57cf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Update QString documentation relevant to prepend optimizationAndrei Golubev2020-09-151-0/+27
| | | | | | | | | [ChangeLog][QtCore][QString] QString is a prepend optimized container similar to QList. Task-number: QTBUG-84320 Change-Id: Id035aac859a6f404e389f2eeaf20f9eee5bff20c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QString: use QCommonArrayOps::erase instead of custom logicAndrei Golubev2020-09-141-4/+2
| | | | | | | | | | With 6e8985e3576a4439bd66c0767f9912d1e124682c merged we can now use generic erase logic provided by array operations. This commit aligns QString with QList/QByteArray Task-number: QTBUG-84320 Change-Id: I83e9349e2461afd98737df25613aa2d0fd817a71 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString/QBA: change realloc*Data signatures to use qsizetypeAndrei Golubev2020-09-101-10/+10
| | | | | | | | | | Changed reallocData, reallocGrowData signatures to use qsizetype instead of size_t Change-Id: Iebe7def5430d3d3f4660e19cb6c12612543c5abc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove '\0' space reservation logic in QStringAndrei Golubev2020-09-101-19/+31
| | | | | | | | | Changed QString to use implicit element reserved by QArrayData Task-number: QTBUG-84320 Change-Id: If517500b3f0e71bb8d2989c64815a634aa8dd554 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>