When matching the locale's correct exponent separator, QLocale was
doing a case-insensitive match; but the Cyrillic fall-back was
matching case-sensitively, so failed to catch the case of lower-case e
and its Cyrillic equivalent, when used in a Cyrillic font in place of
the upper-case form of the other, where that's the locale's official
separator. So make this comparison case-insensitive.
Added some test-cases for the lower-case exponential separator.
Pick-to: 6.5
Fixes: QTBUG-113443
Change-Id: I18e22d7b3451fbb61e87d5b93661eadff3c7356e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The correct time to clear titleString and linkString is at the start
of the item element, to avoid not only the left-overs from a previous
item but also any stray titles and links that don't belong to any
item. The channel element, that contains the items, may also have
title and link elements. This, indeed, lead to the first entry in the
displayed table having a "Qt Blog" prefix on its blog-post's title.
Fortunately the link was already being set, usually to empty, due to
the lack of rss:about attributes on item elements.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I16647e2498b58caaafa6e88ef73f0d934a1f8396
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Group related things together, improve the logical flow of the code.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: If3eb577b74128b305ca5fb3074168280ec2d4db8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
It felt more natural that the RSSListing class would be agnostic about
the default URL, so let it be a constructor parameter. In the process,
update the URL to what the old one now redirects to (thanks to Ivan
Solovev for spotting that) and make the constructor explcit (thaks to
Ievgenii Meshcheriakov for suggesting this).
Task-number: QTBUG-111228
Pick-to: 6.5
Change-Id: I9f4c0d126e0872bb4ec6e6bb41add7e9d2a9537f
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Replace one #include with a forward-declaration - in rsslisting.h QUrl
is only passed by reference to a function. Shuffle order of existing
forward declarations to be alphabetic, in the process.
Shuffle #include order in sources so that this example's own headers
appear before the Qt ones.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I69a9e091c77f9d3190c0217c8bd9262e056f66fc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Remove space after *, insert space after comma.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I7525715dede20b45241efaf3f9540c896b1455c7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Replace the check in qxmlstream.h with a QT_REQUIRE_CONFIG since the
code that includes this header does no checking, whether on the define
or the feature, so is better off getting told about the missing
feature at the point of include than complaining about an undefined
type despite its header being overtly included.
For the rest, just do the usual transformation to QT_CONFIG(),
flipping the ones that were #ifdef rather than #ifndef, so the
condition is positive. Shifted a couple of open-braces of classes to
the next line, where they belong, in the process.
Change-Id: If9c496082f0489b0f9f4070364cbf840e603fce1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The options included by --help-all, although they are "specific to
Qt", are "specific" to all Qt applications, so - in the present
context, of QCommandLineParser - not specific at all. It's the options
described by -h that are specific, to the present command; the Qt
options are generic (in the present context).
So rework the help string for --help-all itself and the documentation
of the function. It had, in any case, an overly-complex first line,
that descended into too much detail. Updated test to match.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I06da0af41be60e6e1b7616984001ddb9ca33aad6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
The documentation talked about using CBOR to keep folk from reading,
where (of course) it merely makes it more obscure (and compact). Make
clear that this just makes it less easy and mention the tool that
makes it easy again.
Task-number: QTBUG-111228
Pick-to: 6.5
Change-Id: I472acda4b7533db41ab0e78b694e0256b34d2b40
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
There's no separate category for {de,}serialization, so I've put them
in Input/Output; and at least some of them are relevant to
transmission over the network, so include that as a tag, so that
someone writing a network application that wants to use what they
illustrate gets a chance of being lead to it.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ie9f6dbaf85aed852e9f64eba05ec8c5fe0a7382d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The QTzTimeZoneCache created one cache entry for every time zone
which was looked up, even if the code was invalid. This uses some
memory for each time zone code queried and thus allows DOS attacks
if user supplied time zone codes are parsed.
This patch prevents the creation of QTimeZonePrivate objects for
invalid time zone IDs.
Change-Id: I22007f6681bea54fa08639f4f786e1a49d10f920
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, QTzTimeZonePrivate::availableTimeZoneIds() only reported
the zones listed in the zone.tab file, which maps territories to
zones. It thus omitted several zones that are provided by the IANA DB,
but not the primary zones for any territory. This meant that it was
possible to pass a zone name to the constructor successfully, despite
isTimeZoneIdAvailable() claiming it isn't available.
Pick-to: 6.5
Change-Id: I9e4eb7f4cfe578204951b995f0ad9ffd7eed5f9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tst_QDate::startOfDay_endOfDay() and its _data() were in danger of
growing a lot of ugly #if-ery to work round the known limitations of
MS's time-zone API and the backend built on them. Replace the #if-ery
with a flags enum indicating which parts we need to ignore on MS and
limit the #if-ery to how those flags get exercised.
Change-Id: I8657b4fba75f1aef1f3f9374e05f60354dc25e34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Q_ENUMS() is deprecated in favor of Q_ENUM().
Pick-to: 6.5
Task-number: QTBUG-113229
Change-Id: I29cc23c87b1d6e8eeb49dd1d3ddaf4ca7d2cf8c2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The constructor that doesn't explicitly initialize the content of the
array can be useful in some cases.
Pick-to: 6.5
Fixes: QTBUG-111582
Change-Id: Icc4bd753f1944a91be70316a7303bb822f79d472
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Rewrite the whole macro as a function and use QVersionNumber instead
of manual parsing to make it more modern and more readable.
Change-Id: I25498320ef6cd9f19be9267421e2727cd28cfd7c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Similar test with link-local server on the same network:
$ $objdir/tests/manual/qdnslookup/qdnslookup.exe @fe80::1e1b:dff:fee2:49e6%Ethernet
; <<>> QDnsLookup 6.6.0 <<>> qdnslookup @fe80::1e1b:dff:fee2:49e6%Ethernet
;; status: NoError
;; QUESTION:
;qt-project.org IN A
;; ANSWER:
qt-project.org 3532 IN A 52.18.144.254
;; Query time: 17 ms
;; SERVER: fe80::1e1b:dff:fee2:49e6%Ethernet#53
Server's dnsmasq log shows it was queried.
We don't know why we must set the port to 0. It works for me the regular
way, but not for everyone who tested this patch.
[ChangeLog][QtNetwork][QDnsLookup] setNameserver() now supports IPv6
servers with on Apple systems, AIX, FreeBSD, NetBSD, Solaris, and
Windows.
(AIX, NetBSD and Solaris not directly tested, but their docs online show
they have res_setservers())
Change-Id: I3e3bfef633af4130a03afffd175d5bfd4e7922b9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This API is found on FreeBSD, Darwin, Solaris, AIX, and Android Bionic.
That means we complement IPv6 support for most platforms.
Test on macOS:
$ $objdir/tests/manual/qdnslookup/qdnslookup @fe80::1e1b:dff:fee2:49e6%en0
; <<>> QDnsLookup 6.6.0
;; status: NoError
;; QUESTION:
;qt-project.org IN A
;; ANSWER:
qt-project.org 3336 IN A 52.18.144.254
;; Query time: 2 ms
;; SERVER: fe80::1e1b:dff:fee2:49e6%en0#53
Dnsmasq log on the server confirms it was queried.
Change-Id: I3e3bfef633af4130a03afffd175d59c67faa463f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Instead of using #if, this now uses SFINAE to detect the presence of the
glibc extensions to set IPv6 nameserver addresses. It's also possible
that this fixes some bugs that have always been there, but never checked
because we don't have a way to unit-test explicit name servers.
To that effect, this commit adds a manual unit test that mimics the BIND
tool "dig". When running:
./qdnslookup qt-project.org any @dns.google
it printed for me:
; <<>> QDnsLookup 6.6.0
;; status: NoError
;; QUESTION:
;qt-project.org IN ANY
;; ANSWER:
qt-project.org 3600 IN MX 10 mx.qt-project.org
qt-project.org 3600 IN NS ns14.cloudns.net
qt-project.org 3600 IN NS ns11.cloudns.net
qt-project.org 3600 IN NS ns12.cloudns.net
qt-project.org 3600 IN NS ns13.cloudns.net
qt-project.org 3600 IN A 52.18.144.254
qt-project.org 3600 IN TXT "v=spf1 mx ip4:193.209.87.4 include:spf.protection.outlook.com ~all"
;; Query time: 241 ms
;; SERVER: 2001:4860:4860::8844#53
strace confirms the DNS queries were sent to the correct address.
Change-Id: I3e3bfef633af4130a03afffd175d56a92371ed16
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
There's no need to say it's getting skipped on Windows. moc *can* parse
the #ifdefs these days.
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d95c709ff6a74
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This means we have more system calls (2 more in the parent), but we
can now detect non-existent or inaccessible directories before fork().
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d1003581bff59
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Qt 5 and earlier versions used to share this member with Windows, where
we needed to store a pointer. We had the Q_PID public type, which was
removed in commit b73d5a0511 (6.0). That
commit made the QProcess::processId() public API use qint64, which is
fine. But we don't need to store more bits than the OS actually
requires.
This further reduces QProcessPrivate's size to 688 bytes on 64-bit Unix,
with 5 bytes of tail padding.
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d3fa9345872c0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This reverts commit d6bf71123d and the
docs from commit 82b75570f0
("QProcess/Linux: fix file descriptor leak in case of failed child
start").
Despite the title of the commit being reverted, the actual consequence
is slightly different: we always use the forkfd() function, but we
change whether we force the use of the fork() library function by use of
the FFD_USE_FORK flag.
Commit 97645478de (5.15) first added the
FFD_USE_FORK flag with a hack to detect whether the setupChild() virtual
might have been overwritten. A configure-time feature to force the flag
was added in commit 2ed99ff5ca (6.0).
Before the 6.0 release, commit d6bf71123d
removed the conditional use of FFD_USE_FORK, with the changelog message
saying "pthread_atfork() callbacks are consistently not invoked".
We've also since added vfork()-like behavior. We tried it for Qt 5.15
and reverted shortly afterwards because we had got the memory semantics
wrong. Commit e1a787a76e (6.5) finally got
it right, for Linux, which revealed another set of problems with
functions used in the child process modifier.
Therefore, we're going to make vfork() and clone() usage opt-in if the
child process modifier is active. This commit is the first part:
disabling their use by default. The flag to opt in will come in Qt 6.6.
[ChangeLog][QtCore][QProcess] Reverted a change from Qt 6.0 that made
the childProcessModifier() callback be run in a child created by means
other than a real fork() library call, a situation in which certain
other library functions would be unusable, unreliable, or cause
deadlocks. A flag to opt in to the solution with better performance will
be added to Qt 6.6.
Task-number: QTBUG-104493
Fixes: QTBUG-111243
Fixes: QTBUG-111964
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d3e66843e5a29
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reduce the number of #ifdef blocks and use quint8 for the enums that
don't need more than 8 bits anyway (none of them do). Plus move the
std::function callback to an indirect block, as most users of QProcess
won't set them and this type is 4 pointers with libstdc++ and libc++.
After this, QProcessPrivate on 64-bit Unix is 688 bytes, of which:
- 392 bytes from QIODevicePrivate
- 295 bytes of own data
- 3x56 bytes per Channel (which have 5 bytes of tail padding each)
- 1 byte of tail padding and no middle padding
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d188a0821d060
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The DNS Records are variable length and encode their size in 16 bits
before the Record Data (RDATA). Ensure that both the RDATA and the
Record header fields before it fall inside the buffer we have.
Additionally reject any replies containing more than one query records.
[ChangeLog][QtNetwork][QDnsLookup] Fixed a bug that could cause a buffer
overflow in Unix systems while parsing corrupt, malicious, or truncated
replies.
Pick-to: 5.15 6.2 6.5 6.5.1
Change-Id: I3e3bfef633af4130a03afffd175e4b9547654b95
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
There's no fallback anywhere, so this class simply doesn't work if
threading isn't supported. Writing it is an exercise left for whoever
cares for that configuration.
Change-Id: I3e3bfef633af4130a03afffd175e6f68a3f4673f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It's unnecessary in Qt 6 if we use the new-style connect or if the type
was fully defined in the compilation of the unit containing the moc
output.
Change-Id: I3e3bfef633af4130a03afffd175e6f4e87adf5e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
These were added in commit 20e6a049fe as a
massive sweep of all Q_DECLARE_METATYPE, without thought as to whether
they were actually needed or not. If they are used as a metatype in a
single .cpp file, they don't need to be.
Incidentally removes the entirely incorrect Q_NETWORK_EXPORT of
QDnsLookupReply.
Pick-to: 6.5
Change-Id: I3e3bfef633af4130a03afffd175e6f378f09a3aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It was only used to later set exitStatus = CrashExit, so simply do it
early.
Drive-by removal of a magic numeric literal in the middle of the source
code. It's still magic, but at least we avoid accidentally making typos.
Pick-to: 6.5
Change-Id: Icfe44ecf285a480fafe4fffd174d4176a5d87641
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The parameter passed to reserve() is just a hint. The container
implementation is free to choose a larger capacity, and some do
(e.g. QList in prepend optimization mode).
Fix the test by querying the container for its post-make<>()
capacity() and taking a larger-than-expected initial capacity() into
account when later re-checking the capacity().
Change-Id: Id8f26f14e8df9d685ca2387ec4a52d74fea7cb9d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
It took me a sec to figure out the relation between the comment and
the code line following it. Make it easier for the next guy and add a
bit more infos.
Amends 7cbdc8abbd.
Change-Id: I4ff2d9a52aef643a92339df32cc86f686a689a9a
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
We use a single line per test slot everywhere else, ignoring even
line-length limitations, to keep the function names aligned for easier
parsing.
Amends 7cbdc8abbd.
Change-Id: Iaf2941aae88392d407d688fc4a7537fcdc0a5851
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
STL algorithms, in general, don't specify how often the function
objects passed to them are copied during the run of the
algorithm.
While generate_n is above any reasonable suspicion of copying the
function object after the first invocation, passing a mutable lambda
containing the counter is still an anti-pattern we don't want people
to copy.
Fix in the usual way, by keeping the counter external to the lambda.
As a drive-by, replace post- with pre-increment.
Amends dc091e7443.
Pick-to: 6.5 6.2
Change-Id: I9c44e769fd41e5f7157179a2be4c3534424cf913
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
It doesn't make any sense to setup and get policy when we build either
Qt or standalone tests, since the value will be ignored anyway. So
skip the policy setup for Qt builds to avoid littering the CMake logs
with QTP0002 warnings.
Amends c4debab927
Change-Id: Iacae8f9ecbb6c9da2f3af77b2016454c8d4194e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The icon loader machinery is a bit opaque, so let's add some logging
to understand the interactions.
Pick-to: 6.5
Change-Id: Ic400b6043607795ad92771f9d9f189699f185366
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Property merging genex only checks if previous value is not empty, but
doesn't check if an actual value that we concatenate is not empty too.
Add the check to make sure we don't have trailing comma in the json
lists.
Fixes: QTBUG-112885
Pick-to: 6.5
Change-Id: I1a5265ddf1b12f763650daf3c6e3538ed52a1674
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Avoids -Wsometimes-uninitialized warnings with clang-cl.
Also do not allow to return qt_message_fatal() if built with other
compiler than MSVC.
Amends 97b32fa0b6
Fixes: QTBUG-113351
Change-Id: I9ce87057e764af1e25de93388ae983891df66d2e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As of Qt 6.5 the html document should not create canvas
elements directly, but instead create div container
elements and let Qt create and manage the canvas elements.
However, qtloaders.js has not been updated to match this
and is still creating canvas elements when given div
elements.
Remove the canvas creation code and invert the primary
and fallback case: config.containerElements is now passed
to instance.qtContainerElements. config.canvasElements
is copied to config.containerElements, if set.
Change-Id: I7372db93ee4de5b23a0a5d992597a3fbd9711a33
Pick-to: 6.5 6.5.1
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
The `-sysroot` does not have any effect, and it can be removed.
I added a warning in case someone is still using it.
[ChangeLog][configure] The -sysroot option was removed. Use
CMAKE_SYSROOT or CMAKE_TOOLCHAIN_FILE instead.
Task-number: QTBUG-112951
Change-Id: Ib180b891ca8228ef1ebf9be43f2f6b8b5b5b0ee7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This places the first through third parameters on the exact positions
that they will be used to perform the operations in the switch, saving
the compiler from generating a few instructions to move data around. All
ABIs Qt supports that pass any function parameters in registers at all
pass at least 4.
We keep the return type as void (instead of returning bool, for the
Compare case) so the compiler can apply tail-call optimizations for
those two typical cases.
PMF case: https://gcc.godbolt.org/z/9oP5boKfj
Function case: https://gcc.godbolt.org/z/e9vEzd5dj
Functor case: https://gcc.godbolt.org/z/s8Ejjra7P
Change-Id: I3e3bfef633af4130a03afffd175d3e3009c56323
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We weren't using the LSB in big-endian builds because the bitfield was in
the wrong order: it was either using the MSB (in 32-bit builds) or
something in the middle for 64-bit. So use quintptr in the bitfield to
ensure proper sizing and correct the order.
Additionally, we now store the d "pointer" as a quintptr, so as to avoid
storing the actual pointer to QNativeIpcKeyPrivate with the LSB set.
Change-Id: Idd5e1bb52be047d7b4fffffd17506adb77d52805
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Commit c630b231ec ("Untangle
QLatin1StringView from qstring.{h,cpp}") moved QLatin1StringView from
qstring.h, causing compilations that included qlatin1stringview.h but
not qstring.h to produce a warning.
By un-inlining, we get an improved comparison functionality without
memory allocation too. So win-win.
qlatin1stringview.h:325:23: warning: inline function ‘static int QLatin1String::compare_helper(const QLatin1StringView&, const char*)’ used but never defined
This is BC because the actual function that used to be inline continues
to be so, and the old implementation is fine, albeit slower.
Change-Id: Ieab617d69f3b4b54ab30fffd175c4e11d4a3b6dd
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This happens often for me for ANY queries via Dnsmasq (home router) or
via whatever the corporate DNS servers are in the office.
Pick-to: 6.5
Change-Id: I3e3bfef633af4130a03afffd175e2656ae5e2c3e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>