summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurlidna.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QUrl IDNA: Update to Unicode 15.1Ievgenii Meshcheriakov2024-02-081-17/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | Unicode 15.1 (more spcifically UTS #46, revision 31) changes how host names are processed. The initial Unicode host name mapping is done without validity checking. That check was used in the past to mark QUrl's invalid. This patch inserts simplified validity check later. This check is similar to one performed before conversion to unicode, but does not include BiDi check to keep names starting with xn-- valid. Additional complication is that U+1E9E LATIN CAPITAL LETTER SHARP S must be mapped to "ss" with transitional processing. It is not possible anymore to predict whether Qt implementation considers a URL valid by using only error codes in the tests vectors file. The test was adjusted to expect an empty string (indicating invalid QUrl) or string matching the entry in vectors file if there are any processing errors specified for that entry. Unblacklist tst_QUrlUts46::idnaTestV2. Task-number: QTBUG-121529 Change-Id: Iad5dadd1a6695fa54b432e35000b350cd6e06341 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QUrl IDNA: Fix typoIevgenii Meshcheriakov2024-01-261-3/+3
| | | | | | Change-Id: I5188e00f515486ef27a38c1181490bcb7c4695ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qurlidna: port some internal functions to QSVAnton Kudryavtsev2023-11-011-4/+4
| | | | | | Change-Id: If9c0090589cd58738165f2fe71701dba6958575c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace {add,sub,mul}_overload with q{Add,Sub,Mul}OverloadMarc Mutz2023-06-121-5/+5
| | | | | | | | | | | | | | | | | | | These APIs started out as private APIs in qnumeric_p.h, but have since been made pseudo-public in qnumeric.h. The qnumeric_p.h versions just forward to the qnumeric.h ones, so just use the latter. This is in preparation of removing the {add,sub,mul}_overflow versions, which, despite being defined in the unnamed namespace, don't sport the q prefix, so potentially clash with global symbols. The change is a simple textual search and replace, manually excluding qnumeric_p.h. Picking to 6.5 to avoid cherry-pick conflicts going forward. Pick-to: 6.6 6.5 Change-Id: Ic0f7c92f7c47923317109e8a9dc06fa66bdff2c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Silence a signed vs unsigned warning when char is signedEdward Welbourne2023-03-171-2/+2
| | | | | Change-Id: I5f706f87f3a15f3723a2d4ce3044b84b924da3e5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace ushort*/uint* with char16_t*/char32_t* in private API [1]Ahmad Samir2023-03-151-2/+2
| | | | | | | Task-number: QTBUG-110403 Pick-to: 6.5 Change-Id: Ie20a831f22212d56659cf3c6940d17134ab5f2c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Apply Q_CONSTINIT across the codebaseMarc Mutz2022-03-291-1/+1
| | | | | | | | | Still not complete. Just grepping for static and thread_local. Task-number: QTBUG-100486 Change-Id: I90ca14e8db3a95590ecde5f89924cf6fcc9755a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: Replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-03-261-1/+1
| | | | | | | Task-number: QTBUG-98434 Change-Id: Ib7c5fc0aaca6ef33b93c7486e99502c555bf20bc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicableSona Kurazyan2022-03-251-9/+11
| | | | | | | | | | | As a drive-by, did also minor refactorings/improvements. Task-number: QTBUG-98434 Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* QUrl: use qOffsetStringArray for idn_whitelistMarc Mutz2022-02-091-10/+10
| | | | | | | | | | | | | | | | | | | | Removes 61 relocations from QtCore: before: $ ~/bin/relinfo.pl libQt6Core.so.6.4.0 libQt6Core.so.6.4.0: 6364 relocations, 5407 relative (84%), 318 PLT entries, 1 for local syms (0%), 0 users after: $ ~/bin/relinfo.pl libQt6Core.so.6.4.0 libQt6Core.so.6.4.0: 6303 relocations, 5346 relative (84%), 318 PLT entries, 1 for local syms (0%), 0 users Pick-to: 6.3 Task-number: QTBUG-100536 Change-Id: I29be3416eaacf7b2049d1e3eec15600d7e7c37c0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* corelib: Fix typos in source code commentsJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Ic78afb67143112468c6f84677ac88f27a74b53aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Change two types in qurlidnaDavid Skoland2021-09-091-2/+2
| | | | | | | | | To avoid comparison between signed and unsigned integers, and the compiler warnings that come with it. Change-Id: I1028a980dfde68acc338f0e480fdeec42ed81ffb Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* unicode: Regenerate qunicodetables{.cpp,_p.h}Ievgenii Meshcheriakov2021-09-031-5/+3
| | | | | | | | | | Run unicode utility to regenerate the Unicode tables. This reduces size of the IDNA mapping tables. Adjust the QUrl client code to use the new API. Task-number: QTBUG-85323 Change-Id: Iaa8d6932e611f7aa4009a3fae2972de87b875cf8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QUrl: Implement UTS #46Ievgenii Meshcheriakov2021-08-261-2222/+513
| | | | | | | | | | | | | | | | UTS #46 (https://unicode.org/reports/tr46/) is a successor to IDNA 2003/2008 standards from Unicode. The current implementation uses nontransitional processing by default. An optional argument is added to QUrl::toAce() and QUrl::fromAce() to allow using transitional processing and to ignore the IDN whitelist. [ChangeLog][QtCore][QUrl] ACE processing is now performed according to the UTS #46 standard based on IDNA 2008 instead of IDNA 2003. Task-number: QTBUG-85371 Change-Id: I46b2e86792bc9699cb6961bae8e283fbff72f874 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qurlinternal: Remove nameprep and STD3 rules testsIevgenii Meshcheriakov2021-08-251-2/+2
| | | | | | | | | | | | IDNA 2008/UTS #46 do not use nameprep anymore and have different validity rules. Unexport qt_nameprep() and qt_check_std3rules() because they are not used by any tests anymore. Task-number: QTBUG-85323 Change-Id: I38c0dbae9a6bd108fbcfac350767aa7e757e786f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Improve Punycode overflow handlingIevgenii Meshcheriakov2021-08-161-22/+54
| | | | | | | | | | | | | | | | | | | | Add more overflow checks from the sample code in RFC 3492. Also check if a code point to be inserted into output is in the allowable range for Unicode. Rewrite all overflow checks to use {add,mul}_overflow() functions. Do not try to process any inputs that are too long to be part of a valid domain name label. This fixes a test in tst_qurlinternal. Fixes: QTBUG-95689 Pick-to: 6.2 Change-Id: Ice0b3cd640d8a688b63a791192ef2fa2f13444be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QUrl: Make Punycode encoding code less surprisingIevgenii Meshcheriakov2021-08-161-7/+7
| | | | | | | | | | | | | | | Move the code that modifies the encoding loop variables from appendEncode() back to qt_punycodeEncoder() instead of passing the variables by reference. This gives better overview of how those variables change. Remove comment claiming overflow detection inside appendEncode() where no overflow detection is done. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: I8830e75370646f0c9b78cae883f778a12e32919d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Fix handling of invalid sequences starting with xn--Ievgenii Meshcheriakov2021-08-111-3/+6
| | | | | | | | | | | | | | Return ASCII sequences that start with xn-- but fail Punycode decoding as is when converting URLs to Unicode. This is consistent with handling of sequences that do decode successfully but fail other validity checks. This fixes one test in tst_qurlinternal. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: I63d7197f25102c96f5dc21d9fecec5e015c531cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Fix Punycode handling for non-BMP codepointsIevgenii Meshcheriakov2021-08-101-14/+39
| | | | | | | | | | | | | | | | | Iterate over Unicode codepoints instead of UTF-16 characters when converting to/from Punycode as described in the specification. Additionally reject strings with invalid surrogate pairs when encoding to Punycode, reject strings with any encoded surrogates when decoding. Remove expected failure marking from the test for this issue in tst_qurlinternal. Fixes: QTBUG-95577 Pick-to: 6.2 Change-Id: I3dd68f95ada6d652e2fa5c0c3118dcfa0a5f4c4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix typo in function nameIevgenii Meshcheriakov2021-07-261-2/+2
| | | | | | | | Fix typo: containsProhibitedOuptut -> containsProhibitedOutput. Pick-to: 6.2 Change-Id: I4eb8be4c7ceb2e96ac129ef7c64215558f7b308e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Try to workaround bogus compiler warning in gcc 9 for ARMv7Lars Knoll2020-07-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | ../../src/corelib/io/qurlidna.cpp: In function ‘QString qt_ACE_do(QStringView, AceOperation, AceLeadingDot)’: ../../src/corelib/io/qurlidna.cpp:2543:23: error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’ reading 8 bytes from a region of size 2 [-Werror=stringop-overflow=] if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0) ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors In function ‘bool operator==(const QByteArray&, const QByteArray&)’, inlined from ‘virtual void (* QLinuxFbIntegration::platformFunction(const QByteArray&) const)()’ at ../../src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp:185:18: include/QtCore/../../../../src/corelib/text/qbytearray.h:571:45: error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’ reading 17 bytes from a region of size 1 [-Werror=stringop-overflow=] The warnings/errors are bogus. Fix them by using QStringView::sliced() and de-inlining the comparison operator for QByteArray. Change-Id: I24956fe74a7989e75cd03d717570b8fca493ab23 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port QString to qsizetypeLars Knoll2020-07-061-1/+1
| | | | | | Change-Id: Id9477ccfabadd578546bb265a9483f128efb6736 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a note to qurlidna.cpp about IDNA's Unicode version being frozenEdward Welbourne2020-07-021-0/+9
| | | | | | | | | | | | It looked a lot like it needed an update to its Unicode data (in tables and functions) but Thiago tells me this would be misguided, although we do need an upgrade to IDNA 2008, at some point. So document why this doesn't get updated along with UCD. Task-number: QTBUG-85371 Task-number: QTBUG-85323 Change-Id: I764667db9c24bf05371e8a3c2601ccbf48f99711 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QUrl: do not retest if a codepoint is less than 0xFFFFGiuseppe D'Angelo2020-06-301-1/+1
| | | | | | | It's already tested in the surrounding if. Change-Id: I37e13406cfd4865731ce06ed097c03294a75c592 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlIdna: port containsProhibitedOutput() to QStringIteratorMarc Mutz2020-05-131-21/+22
| | | | | | | | | | | | | | | | | | Also Extract Method isProhibitedOutput(), which, in order to preserve history, is placed in the unnamed namespace and violates the indentation rules. But this code is delicate enough to be left undisturbed. At least for now. By said Extract Method, we can static_assert on the invalidity of the QStringIterator::next() argument, which we assume will be rejected, so that we continue to reject malformed surrogate pairs. Also fix a comment that suggested the function would actively remove ("strip") malformed content, when in fact it only detects it. Change-Id: I4185cbac71fb147e2f2036dbaf052af20bd1003f Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlIdna: port NameprepCaseFoldingEntry from int-ish to char-ishMarc Mutz2020-05-131-4/+4
| | | | | Change-Id: I43171aae8188cc68d9c03716451c6427486cc55c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrlIdna: replace manual pointer handling with std::begin()/end()Marc Mutz2020-05-131-6/+4
| | | | | | | This is more readable, because it follows usual iterator patterns. Change-Id: I56900286ddbca57a86aa499020f175e8add17fd9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port qt_punycodeEncoder() to QStringViewMarc Mutz2020-05-131-15/+13
| | | | | Change-Id: I264e67bc08413f8a39e2d16c774bfd2c76c320ac Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port qt_check_std3rules() to QStringViewMarc Mutz2020-05-131-12/+14
| | | | | | | Also port its callees. These functions scream to the QStringView-ified... Change-Id: I13c95d65941eb8d02223306d80efd1437b4bd9b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrlIdna: QChar(0x2d) → QLatin1Char('-')Marc Mutz2020-05-121-2/+2
| | | | | | | | A reader of the code shoudn't need to know ASCII code points by heart, so don't force them to. Change-Id: I2c44fcf4a948b85dfbc02ac8b5b7b934e87b41a7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Cache QUrl::idnWhiteList() absent user_idn_whitelistMarc Mutz2020-05-121-7/+10
| | | | | | | | | | | | Instead of creating a QStringList from a static array anew for each call, cache the result in a static variable. If we have to pay for the overhead of implicitly-shared classes, we should at least reap the benefits, too. Use IILE to gain automatic thread-safety (thread-safe statics). Change-Id: Ib92dd9cb85f84e013f98ca81565cc392bb39e76b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrlIdna: simplify a loop using QStringView::mid()Marc Mutz2020-05-051-6/+4
| | | | | | Change-Id: I0f33a29b3104ceac4c5dfb9db2bfdcd896bb95d1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QUrlIdna: avoid QString creationMarc Mutz2020-05-021-3/+2
| | | | | | | Change-Id: Id05eecfcb1e170920c05fb0c7f17e46f039b4dee Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlIdna: port qt_ACE_do() to QStringViewMarc Mutz2020-05-021-3/+3
| | | | | | | Change-Id: I29abc17576ceb72dd678e3ca59456e6220acd0a6 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlIdna: port nextDotDelimiter() to QStringViewMarc Mutz2020-05-021-7/+6
| | | | | Change-Id: I4fec88be2dacadcbb72927b973a51e1ead178c88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrlIdna: port qt_is_idn_enabed() to QStringViewMarc Mutz2020-04-241-3/+3
| | | | | | Change-Id: I3cd8a1da47f660f79760bbde88560693ab505823 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QUrlIdna: re-enable NRVOMarc Mutz2020-04-241-2/+2
| | | | | Change-Id: Id4f9b14f4255c661a0313ca18b0c5af5c55880e7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Be less laissez-faire with implicit conversions to QCharMarc Mutz2019-07-091-3/+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>
* Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-3/+3
| | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: Make sure we do reject URLs for which IDNA nameprep failedThiago Macieira2018-08-161-6/+11
| | | | | | | | | | | | | | qt_nameprep() already reset the string to its original length to indicate failure, but we didn't handle that in qt_ACE_do(). So make it have a return value whcih makes it easier to handle that case and do handle it. [ChangeLog][QtCore][QUrl] Fixed a bug that caused URLs whose hostnames contained unassigned or prohibited Unicode codepoints to report isValid() = true, despite clearing the hostname. Change-Id: I41e7b3bced5944239f41fffd1545b7274c4b419d Reviewed-by: David Faure <david.faure@kdab.com>
* QtCore: Raise minimum supported MSVC version to 2015Friedemann Kleint2018-01-081-5/+0
| | | | | | | | Remove code for older versions and streamline #ifdefs. Task-number: QTBUG-51673 Change-Id: I211703189ff12f827d94914093369736b6e65d4a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: fix IDN conversion when the ACE form is invalidThiago Macieira2017-04-251-9/+36
| | | | | | | | | | | | | | | | We guarded against the Unicode form being invalid and did not produce an encoded form. But we did not guard against proper Punycode sequences that decode to forms that had not passed the proper Nameprep stage. So check for that and, if it fails, just keep the label in the form we found it in (it's valid STD3 anyway). [ChangeLog][QtCore][QUrl] Fixed a bug that caused certain domain names that look like Internationalized Domain Names to become corrupt in decoded forms of QUrl, notably toString() and toDisplayString(). Task-number: QTBUG-60364 Change-Id: Iadfecb6f28984634979dfffd14b833142cca8d0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrl: fix IDN whitelist checking when the TLD is in UnicodeThiago Macieira2017-04-241-2/+2
| | | | | | | | | | The whitelist is kept in ACE form, so if the TLD came in Unicode, we need to run ToASCII before we can check the whitelist. This is slightly inefficient because we'll run the same operation later in this domain. Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
* Use QStringLiteral more judiciouslyAnton Kudryavtsev2016-07-081-1/+1
| | | | | | | | | | | | | | | Replace it with QL1S in QStringBuilder expressions and in overloaded functions. Replace patterns 'QString::number() + QStringLiteral' and 'QStringLiteral + QString::number()' with QString::asprintf. Saves some text size. Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix some -Wcast-qual warningsThiago Macieira2015-09-221-1/+1
| | | | | | | | | | | This is happening in code I don't usually test (32-bit, non-ICU, etc.) KeccakF-1600-opt32.c:481:22: error: cast from type 'const unsigned char*' to type 'UINT32* {aka unsigned int*}' casts away qualifiers [-Werror=cast-qual] KeccakF-1600-opt32.c:217:62: note: in definition of macro 'extractLanes' Change-Id: I42e7ef1a481840699a8dffff140209823301a07a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Richard J. Moore <rich@kde.org>