summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-08-071-2/+2
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| | * QString: Fix documentation for toDouble() and toFloat()Andre Hartmann2018-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The character 'g' is only a valid format when converting numbers to strings, but not other way round. Change-Id: Ie772886e7a45a5067c0a3e4eaa3a6ccef8e69426 Reviewed-by: Martin Smith <martin.smith@qt.io>
* | | Fix possible heap-buffer-overflow in qt_string_normalizeErik Verbruggen2018-08-071-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When starting further into the string than index 0, do correct the length too. This shows up in tst_qurl and tst_qurlinternal. Kindly pointed out by ASAN: ==5513==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600002bf27 at pc 0x000100654de3 bp 0x7ffeefbfad10 sp 0x7ffeefbfad08 READ of size 16 at 0x60600002bf27 thread T0 #0 0x100654de2 in QtNS::simdTestMask(char const*&, char const*, unsigned int) qstring.cpp:395 #1 0x1005f9777 in QtNS::isAscii(QtNS::QChar const*&, QtNS::QChar const*) qstring.cpp:491 #2 0x100638642 in QtNS::qt_string_normalize(QtNS::QString*, QtNS::QString::NormalizationForm, QtNS::QChar::UnicodeVersion, int) qstring.cpp:7999 Change-Id: I44ad65b47eb98c6085c77b56dc2da50ef5659d25 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QUrl: Add qustrchr() and use it to speed up the fast URL full decodingThiago Macieira2018-08-031-57/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | The character search in the findChar() static function in qstring.cpp is more efficient than what we had in qurlrecode.cpp and there's no point in duplicating it. It also has a Neon implementation. So make the implementation available for use in QtPrivate::qustrchr(). This also simplifies the implementation. Change-Id: Ib48364abee9f464c96c6fffd152eedd0cd8ad7f8 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-1/+1
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbintegration.cpp Conflicts git missed: src/plugins/platforms/qnx/qqnxglcontext.cpp Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
| * Doc: Remove reference to Unicode 4.0Kai Koehne2018-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's unclear when the reference to Unicode 4.0 standard got added - it certainly predates the qt 4 git repository. Anyhow, nowadays we're using later versions, and it doesn't make much sense to highlight one specific version here. Instead, use the correct technical term - UTF-16 code unit. Also I added a 'correspond _to_', which sounds more common to me. Task-number: QTBUG-56699 Change-Id: I4bdcd9060cb2b11521638019c15ef7ab67aa768b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Fix Windows+ICU buildThiago Macieira2018-07-141-12/+13
| | | | | | | | | | | | | | qstring.cpp(6655): error C2065: 'lhs': undeclared identifier Change-Id: Id59bdd8f1a804b809e22fffd15405ed7607bdaca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix QString::localeAwareCompare with composed/decomposed strings on macOSSimon Hausmann2018-07-061-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to commit cd64a96b31f57e522ab8d29c8357acf384012ebe we also need to normalize the strings before comparison in order to be compliant with the ECMAScript test suite. This patch also adds the remaining test cases from built-ins/String/prototype/localeCompare/15.5.4.9_CE. Since the same tests are also failing with strcoll/qt_compare_strings, this simplifies the code to always normalize except when using ICU (which gets it right by default). Change-Id: I16b32da7fc70dc7e6725c49f66fe9941d0bf3a47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Add qbswap for a memory regionThiago Macieira2018-07-041-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | The compiler was generating some vectorized code for qresource.cpp but it wasn't very efficient. So improve upon it and make use in other places where we read UTF-16BE strings. [ChangeLog][QtCore] Added an overload of q{To,From}{Big,Little}Endian that operates on a memory region. Change-Id: I6a540578e810472bb455fffd1531fa2f1d724dfc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-021-50/+59
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
| * QLocale/QString/QByteArray: Use nullptr in documentationAndre Hartmann2018-06-221-40/+42
| | | | | | | | | | | | | | | | While at it, fix some more issues in the sentences to harmonize the description between the different classes. Change-Id: Iee1c3ffe6fd71e82504bfb003d927c4db3b2a065 Reviewed-by: Martin Smith <martin.smith@qt.io>
| * QString: Harmonize the toFloat() and toDouble() documentationAndre Hartmann2018-06-221-3/+12
| | | | | | | | | | | | | | | | Both use QLocale::toDouble behind the scenes, so the same limitations apply. Document them for toFloat() also. Change-Id: I954362a0db203630685c034df6a921fa6447a509 Reviewed-by: Martin Smith <martin.smith@qt.io>
| * Make QString's formatting of doubles be consistent with other placesEdward Welbourne2018-06-141-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString::sprintf(), like the C printf-family, always includes two digits in any exponent it outputs. Up to 5.6, number() and arg() taking a double did the same; but changes at 5.7 to enable opting out of the leading zero this implies for a single-digit exponent accidentally opted out of it in args() and number(). This commit fixes number() and arg() to include QLocaleData::ZeroPadExponent in the flags they pass down to the C locale's doubleToString(), restoring the prior behavior, including consistency with sprintf(). [ChangeLog][QtCore][QString] Formatting of doubles with single-digit exponent, by number() or args(), now includes a leading zero in that exponent, consistently with sprintf(), as it did up to 5.6. Task-number: QTBUG-63620 Change-Id: I10c491902b8556e9f19e605177ead8d9fd32abd9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Fix QString::localeAwareCompare with composed/decomposed strings on WindowsSimon Hausmann2018-06-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With ICU and on macOS it appears that the comparison is done on a canonical form, while CompareString(Ex) does not do that, as the added test verifies. Explicit normalization fixes that. As a bonus, this also unifies the code path between regular Windows and UWP by unconditionally using CompareStringEx (which requires Vista or later). This issue surfaced while running the ECMASCript 6 Conformance Test Suite in QtQml. This re-uses the existing test for localeAwareCompare, which was disabled on Windows, macOS and Linux with ICU (the common case). Change-Id: I52440fce60b54745ead1eff005ec51e98e2a79ec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QByteArray: add compare() with case sensitivity optionsThiago Macieira2018-06-221-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Need to do the same for startsWith() and endsWith(). indexOf() is a lot harder. [ChangeLog][QtCore][QByteArray] Added compare(), which takes Qt::CaseSensitivity as one of the parameters. This function is more efficient than using toLower() or toUpper() and then comparing. Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Fix build with SSE 4.1 but not AVX2Thiago Macieira2018-06-161-1/+1
| | | | | | | | | | | | | | | | | | Failed on my Sandybridge Mac with -march=native: qstring.cpp:363:19: error: redefinition of 'mask' with a different type: 'const __m128i' Change-Id: I6efb28c3145047559ec0fffd15386aeb8d36d681 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Remove unused QString::toLatin1_helper overloadThiago Macieira2018-06-161-5/+0
| | | | | | | | | | | | | | | | | | Commit 5dc1e08c8c602738f6a827cea0de44683c7bbd0b changed QString::toLocal8Bit_helper to use qt_convert_to_latin1 so it became unused. It was never used in inline functions in the headers. Change-Id: I6efb28c3145047559ec0fffd15382f9d08efdfeb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-241-20/+69
|\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt_common.prf src/corelib/tools/qstring.cpp src/plugins/platforms/windows/qwindowsmousehandler.cpp src/widgets/widgets/qmainwindowlayout_p.h Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
| * qt_is_ascii: improve isAscii a little further (QUrl, QLatin1String)Thiago Macieira2018-05-201-5/+12
| | | | | | | | | | | | | | | | | | Turns out that the non-AVX2 code was beating the performance of the AVX2 because the simdTestMask function did a little too much. So just use the same VPMOVMSKB technique for it. Change-Id: I0825ff5b5f6f4c85939ffffd152f3b636ab998db Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * ucstrncmp: refactor with 32- and 8-byte loadsThiago Macieira2018-05-151-16/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, this removes the UB that used to try and calculate the distance between the two strings. That's a valid technique in assembly, but dangerous in C++ and totally unnecessary. The compiler is perfectly able to generate loops with a single induction variable all on its own. Second, this commit makes the main loop use 32-byte comparisons (16 characters at a time), which is a reasonable size for strings. We use AVX2 if that's available, or an unrolled pair of 16-byte loads otherwise. After the existing 16-byte comparison, this commit inserts an 8-byte (4-character) comparison and then reduces the final, unrolled comparison to just 3 characters. Change-Id: Ib48364abee9f464c96c6fffd152e474b39e1f293 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QString::toLatin1: make the 32-byte loop to a single 32-btye loadThiago Macieira2018-05-161-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | Instead of two 16-byte loads, if AVX2 is present. Otherwise, it's exactly the same. Because of the way the SIMD instructions were extended to 256-bit in AVX2, we gain nothing doing two 32-byte loads, aside from the loop unrolling. Change-Id: Ib48364abee9f464c96c6fffd152e531925814ac2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QString::toLatin1: stop using PCMPESTRMThiago Macieira2018-05-161-53/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | This instruction is somewhat slow and requires a lot of inputs to be correctly set. Instead, use the PMIN trick, which does have unsigned comparison support. This commit moves the helper function to a lambda inside qt_to_latin1, to make it easier to reuse the constants in the next commit and to avoid warnings of unused static functions. Change-Id: Ib48364abee9f464c96c6fffd152e9e84f4ad3ae8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QString: add a method to do a conversion to Latin1 without checkingThiago Macieira2018-05-151-11/+36
| | | | | | | | | | | | | | | | | | | | | | If the input is already known to be Latin 1, we don't need to check and merge in question marks. QJsonObject already needed this code, now we can make it more efficient. I'll need the same code in CBOR. Change-Id: Ib48364abee9f464c96c6fffd152e508f078404e5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QString: insert a number of 8-character SIMD loopsThiago Macieira2018-05-151-18/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | We don't have _mm_cvtsi64_si128() (the REX.W expansion of MOVD [0F 6E]), but we do have _mm_loadl_epi64(), the SSE2 expansion of the MMX MOVQ at opcode 0F 7E. Ditto for _mm_cvtsi128_si64() and _mm_storel_epi64(). And those work even in 32-bit mode. By doing this, we can reduce the tail unrolled loops by half, reducing code size. I'm not adding these new SIMD sections to -Os builds. Change-Id: Ib48364abee9f464c96c6fffd152e405310ef67be Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QUrl: use the SIMD ASCII-checking code from the last commitThiago Macieira2018-05-151-6/+19
| | | | | | | | | | | | | | | | | | Improves performance a little. This is just because I can and the function is right there for the taking, as this qt_urlRecodeByteArray function is only used in deprecated QUrl code. Change-Id: I5d0ee9389a794d80983efffd152d290e570af387 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | QString::normalized: Replace the initial US-ASCII loop with SIMDThiago Macieira2018-05-151-34/+61
| | | | | | | | | | | | | | | | We can just reuse the code I added for QtPrivate::isAscii(), adding the update to the ptr parameter in the failed case. Change-Id: I5d0ee9389a794d80983efffd152d277e2adf444d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-141-4/+4
|\| | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt_module_headers.prf tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qwidget/BLACKLIST Change-Id: I2a08952d28d1d0e3d73f521a3d44700ce79ff16c
| * QString: fix off-by-one errorThiago Macieira2018-05-101-4/+4
| | | | | | | | | | | | | | | | | | The check for having N valid characters is ptr + N <= end, because ptr + N == end indicates that we have exactly N characters in the string. Change-Id: I5d0ee9389a794d80983efffd152d28d5aa485ce4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-211-18/+12
|\| | | | | | | Change-Id: I35a6555e3885e489f88aa9b4b0142e1017f7a959
| * Modernize the "regularexpression" featureUlf Hermann2018-03-201-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-211-9/+0
|\| | | | | | | Change-Id: I9c90d71fde002544fd97df7e8a2690953cf9f817
| * Merge remote-tracking branch 'origin/5.10.1' into 5.11Liang Qi2018-02-191-9/+0
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/sqldrivers/psql/qsql_psql.cpp Change-Id: I070b455078b41e75c46562fcea5676d6218cd00c
| | * QString: fix comparisons to null strings in ucstricmpThiago Macieira2018-02-041-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 8f52ad9fe084eee26869e4a94a678076845a6f58 ("ucstricmp: compare null and empty strings equal") made sure empties and nulls would compare equally, but may have broken the null vs non-empty comparison (which was not tested). The commit message also said that it expected all callers to handle null before calling into those functions, but that's not the case for QStringView created from a null QString: the incoming "a" pointer was null. So just remove the checks for null pointers and rely on the size checks doing the right thing. [ChangeLog][QtCore][QString] Fixed a regression from 5.9 that caused comparing default-constructed QStrings to be sorted after non-empty strings. Task-number: QTBUG-65939 Change-Id: I56b444f9d6274221a3b7fffd150c83ad46c599b6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-161-6/+35
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/tools.pri Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
| * | Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-151-1/+26
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/corelib.pro src/corelib/global/qrandom.cpp src/network/access/qhttpnetworkrequest_p.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoansmenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/offscreen/qoffscreenintegration.h src/widgets/kernel/qaction.cpp src/widgets/widgets.pro Done-with: Andy Shaw <andy.shaw@qt.io> Change-Id: Ib01547cf4184023f19858ccf0ce7fb824fed2a8d
| | * | QString: Add whitespace handling note to number conversion functionsAndre Hartmann2018-02-051-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Copied from QLocale::toFloat and companions. Change-Id: Ic3a13a87cfc1ce34de9dd7d7e7b303ef103c384a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | QString: Wrap extra-long comment lineAndre Hartmann2018-02-051-1/+4
| | |/ | | | | | | | | | | | | Change-Id: I77c95e99fd23eb914d7e86ee003d7f487c57f0f0 Reviewed-by: Martin Smith <martin.smith@qt.io>
| | * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-241-1/+5
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qrandom.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: Icc10543a1f2db5d640d01796bfec70a63517a6b2
| * | \ Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-5/+9
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| | * | | Silence GCC 8 warnings in QStringVille Voutilainen2018-02-141-4/+4
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/tools/qstring.cpp:3539:67: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class QChar’ from an array of ‘short unsigned int’ [-Werror=class-memaccess] memcpy(uc, d->data() + copystart, size * sizeof(QChar)); Change-Id: Ic601bed1a1f9e1b6f0ac1f9e58f1dcadb50ad724 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * | Doc: make a note about use of QStringLiteral with non-ASCII charsThiago Macieira2018-01-221-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both ICC and MSVC have bugs concatenating strings and that's despite the standard giving an example ([lex.string] table 9) that says that u"a" "b" is the same as u"ab" We can't change to preprocessor concatenation (u ## STR) because that fails when QStringLiteral is used with a macro instead of an actual string literal. Task-number: QTBUG-65479 Change-Id: I39332e0a867442d58082fffd1504a0a868c291ef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | | QString: Add functions isUpper and isLowerAndre Hartmann2018-02-111-0/+44
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QString] Added the functions QString::isUpper and QString::isLower to check if a string contains only uppercase or only lowercase letters. Change-Id: I12d3a47d4605eb4514842071e80a9ba0723d4e01 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QString:: add remove() overload taking QLatin1StringAnton Kudryavtsev2018-02-021-10/+36
| | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QString] Added remove() overload taking QLatin1String Change-Id: I11ddb8b8603144effe44f89d0d02e131a255122c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QString: optimize remove()Anton Kudryavtsev2018-02-021-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In remove(const QString &str, Qt::CaseSensitivity cs) call remove(QChar c, Qt::CaseSensitivity cs) if str.size() is equal 1. It prevents quadratic behavior for that case. Change-Id: I9a7ab3019c580343533c8c6c6a04b6b0c8c1fb55 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add a few methods to check if a string is US-ASCII or Latin1Thiago Macieira2018-01-271-1/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | isLatin1(QLatin1String) is provided for completeness sake, in case some generic code operates on both QLatin1String and QString/QStringView. Change-Id: I5e421e32396d44e4b39efffd150b99a18eedf648 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | doc: Correct remaining qdoc warnings in qstring.cppMartin Smith2018-01-051-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added missing template clause to \fn commands required by clang-qdoc. Removed several obsolete \sa targets. Added a few missing return types to \fn commands. Also changed a } to ] in a \fn command in qrandom.cpp. Change-Id: I0f004a1e57507ff5fb035e822ca8b1baa7faad9b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Update QString::isRightToLeft() to take directional hints into accountLars Knoll2018-01-031-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure we properly handle both directional embeddings as well as directional isolates to determine the direction of the string. According to the latest version of the Unicode bidi algorithm, parts of the string contained inside an directional isolate is to be ignored when determining the paragraph direction. Embedding markers themselves are to be ignored as well, but not the characters inside an explicit directional embedding or override. This is also some required pre-work to get our BiDi algorithm updated to the latest version of the standard. Move the implementation to QStringView and implement the methods in QString and QStringRef through that implementation. Task-number: QTBUG-57743 Change-Id: I7f24e09198e22d6359c6534c9ae40a904e94c46e Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-41/+45
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-12-301-12/+20
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/win32-g++/qmake.conf src/corelib/global/qglobal_p.h src/corelib/global/qoperatingsystemversion_p.h src/corelib/io/qfilesystemengine_win.cpp src/network/bearer/qbearerengine.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetwindow.cpp src/widgets/styles/qfusionstyle.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8