When a QFile object is reused, the atEnd() method may return incorrect
values. The reason for this is that QFileDevicePrivate::cachedSize is
not cleared. Setting cachedSize = 0 in the close() method fixes this issue.
Task-number: QTBUG-57698
Change-Id: I828a2cf844e98d581098f2c781fa47d2cd3275ce
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QDateTimeEdit (QtWidgets) inherits its Private class from
QDateTimeParser.
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.
Since the class is already exported, users of these classes are
unaffected by the change, and since it's private API, we don't need
to avoid adding code to the out-of-line destructor until Qt 6.
Task-number: QTBUG-45582
Change-Id: Id57289a7eff13564dddeca0af1c45a6180c36c48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On macOS, the code that read the plist is using
QByteArray::fromRawCFData. When we return the data directly
we need to detach the QByteArray so that it does not point
CFData's data that will get deallocated just after the call.
Task-number: QTBUG-58531
Change-Id: If829a304b986c99c8fc2aeeb992f2d539a4eef3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
qcore_foundation.mm:
- Can't link to 'fromCGPoint()'
- Undocumented parameter 'point' in QPointF::fromCGPoint()
- Can't link to 'fromCGRect()'
- Undocumented parameter 'rect' in QRectF::fromCGRect()
- Can't link to 'fromCGSize()'
- Undocumented parameter 'size' in QSizeF::fromCGSize()
Change-Id: Ie48f04c7b990634f8c5a836100b1be7854848bb4
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Previously, the flags were replaced rather than appended to, losing -I
flags and causing `#include` directives to fail.
Change-Id: I74609e891ea327a8136c8075ab13176fc85ab111
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Which allows us to remove the #include. The qfloat16 operator overloads
in the global namespace are giving some trouble on some compilers, for
reasons unknown (could be compiler bug, could be real). So don't #include
the header anywhere else: let the user choose it.
Task-number: QTBUG-58555
Change-Id: I4c9f691516694b90b08ffffd149ef7dff27d0f6a
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Chinese locale means Code Page 936 here. It's also related with
removing C4819 warnings.
And it's also following Conventions in Qt source code: All code
is ascii only (7-bit characters only, run man ascii if unsure)
See also http://wiki.qt.io/Coding_Conventions
Task-number: QTBUG-56155
Task-number: QTBUG-58161
Change-Id: I37fa7a0e6a82a16eaf80e1cc99be801099ab87de
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC < 1800 (older than 2013) is no longer supported, so we can simplify
the code. And the implementation for C never worked -- "if it's not C++,
let's use a namespace!"
Change-Id: Iaeecaffe26af4535b416fffd148c2c6788c43881
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
The last use of qWinMain was removed in commit
390598cb43, "Winmain: Remove Windows CE."
It used to be used on non-WinCE, but that was dropped in commit
9b121e5579.
Change-Id: Idc347fbb462f4122b044fffd1490a210358a61b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
There was a test that tested this, but was wrong.
[ChangeLog][QtCore][QVariant] Fixed a bug that caused wrong results for
comparisons of QVariants containing either NaN or infinite numbers.
Task-number: QTBUG-56073
Change-Id: I33dc971f005a4848bb8ffffd1475d29d00dd1b7f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This constitutes a fairly complete submission of an entirely new
floating point type which conforms to IEEE 754 as a 16-bit storage
class. Conversion between qfloat16 and float is currently performed
through a sequence of lookup tables. Global-level functions
qRound(), qRound64(), qFuzzyCompare(), qFuzzyIsNull(), and
qIsNull() each with a qfloat16 parameter have been included
for completeness.
[ChangeLog][QtCore] Added new qfloat16 class.
Change-Id: Ia52eb27846965c14f8140c00faf5ba33c9443976
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Although it's permitted to specify the project name together with
a version number for \since, it's unnecessary for Qt classes and
functions.
This change also normalizes the version formatting: '<major>.<minor>'
Change-Id: Ie5a43662077d13c31e241bcde8a7a2849d27d330
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
It's included by qglobal.h, so we get it for free in other headers.
Change-Id: I90072156e313271a5354a39cbf78a83a6885c431
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of
result += QString(string builder expression);
forcing a QString creation incl. memory allocation, do
result += string builder expression;
using the overloaded QString += QStringBuilder operator.
Change-Id: I23023c76620fa6bb7bf9f2786c22f6a2ec0d87c2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The crc32() functions take a size_t length, but the hash() functions
wrapping them took int lengths.
That makes no sense and actively hurts adding hash functions for STL
types or QStringView, so port the hash() interface to size_t.
Change-Id: Id303d6df4b698560fce656cec8ed693b01daac1c
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of using the actual compiler version to determine which C++11
features to enable, let's just use the Mirosoft compiler version that
the actual compiler is claiming compatibility with. That is because the
limiting factor is often the standard library, not the compiler itself.
This will cause some features that do not depend on the library to also
be disabled, but oh well. Better upgrade your Visual Studio version
instead.
Task-number: QTBUG-57696
Change-Id: I3e4e5051937c40319d6efffd14912cd4fdab25fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
The __popcnt family of intrinsics with MSVC generates directly the
POPCNT instruction and are documented to do so:
https://msdn.microsoft.com/en-us/library/bb385231.aspx
So we can't use __popcnt unless the target processor supports it.
[ChangeLog][Windows] Fixed a bug that caused applications to crash with
"Illegal instruction" faults when compiled with Visual Studio and run on
some older processors.
Task-number: QTBUG-58446
Change-Id: I445bb15619f6401494e8fffd149d83bd2a7e3376
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This ensures at compile-time that Qt libraries do not use any APIs that
are not safe for use in application extensions, and fixes warning
messages that appear when linking to Qt libraries that are not built
with this flag, when used in an application extension.
This is especially important on watchOS where *all* "applications" are
actually application extensions, and on other Apple platforms if
application extensions are developed using Qt.
Task-number: QTBUG-40101
Change-Id: I022046f2584e0222253d33052b0abc221d7c93d6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The patch fixes a number of bugs in code, and removes dead logic
clarifying that MIPS DSP, like ARM NEON, has no runtime detecton.
Change-Id: If2f4eea68da5b2eaa80b8e9c8258206d8c1b7173
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There was an off-by-one error in the while loop for aarch64: we start
counting at 0 for the first position, so the last valid input position
is "a+7", not 8.
This wasn't covered by the tests, nor was the SSE2 version, so now there
are also tests for both versions.
Change-Id: I7eb8c5708e6179f45ea56885b0e66e1a37969c1d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It was automatically merged from 5.6 branch. Qt 5.8 does not support
Windows CE.
Change-Id: I6968f50ef568035c224851d595d6c057128491a7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
error: base class ‘class QBasicAtomicPointer<void>’ should be explicitly initialized in the copy constructor [-Werror=extra]
Change-Id: I2bc52f3c7a574209b213fffd149b4b71f3006be5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Implements isNull for QVariants of a nullptr so they always return
true to isNull(), instead of depending on how they were constructed.
Task-number: QTBUG-58296
Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This patch replaces QRegExp by QString search and replace.
Change-Id: I11165afa45f8f9a856e6fb9b64929e4bdacb913d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This corrects an issue converting dates and times to strings which would
use the "default" time zone (CFTimeZoneCopyDefault) in contrast to the
rest of Qt which uses the system time zone in such contexts.
[ChangeLog][QtCore][QLocale] Qt functions now always use the system
time zone on Apple platforms, the same that low-level C APIs like
localtime() does. Previously, converting dates and times to strings
would use the "default" time zone (which is almost always the same as
the "system" time zone but could be changed with the Apple API).
Change-Id: I2942c3c1c8aa01a0130f1b7280371a72bdb01b1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I62448507f80daf6be72994ee99f0fb1aa107eb78
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
while compiling class template member function 'QVarLengthArray<T,Prealloc>::QVarLengthArray(std::initializer_list<T>)'
Change-Id: I36f5ef65ec1f511eac7f3ad1a4717d18f7dc9ce4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Gcc defines neither _MIPS_ARCH_MIPS32 nor __mips32 on MIPS32
architectures, instead __mips is defined to 32.
This fix exposed bit-rot in qdrawhelper where qt_memfill32 was set as
a function pointer despite not being one since Qt4.
Change-Id: I87461823e54fa3166223ebf97175fd05d2f2fd16
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QString::fromRawData code sample still shows the use of QRegExp. This
patch updates it for QRegularExpression and cleans the code.
Change-Id: Iff0f736cdbdd7d35c65fde1496ce9f838a8f5c6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The documentation of QStringList is missing some mention of
QRegularExpression as well as still using QRegExp in some sample code.
This patch fixes that.
Change-Id: I4a7c9fe8e5ae7c73497192bb71d1fa66ee864bd2
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
There should be no blank lines in \value content, otherwise qdoc
ends the list and starts a new one.
Change-Id: Idddc7992317894487445aea36397136df40b9691
Reviewed-by: Martin Smith <martin.smith@qt.io>
INTEGRITY doesn't support self-extending stack. The default stack
size for a pthread on INTEGRITY is too small so we have to increase
the default size.
Change-Id: I0787d14938cf5e7e96c35df204212c8e83aa8893
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][QFileSelector] Removed the requirement for an unused
default base file in case you want to load only a variant.
When the base file (e.g. /image.jpg) was missing, no selectors were
considered and it was not possible to load variants of this file (e.g.
/+android/image.jpg, /+android/+tablet/image.jpg) without specifying the
directory as well.
As a work around, one previously had to place a default file in
the base location, which is undesirable in some cases because:
1. The extra file consumes unnecessary space.
2. It is impossible to encapsulate platform-specific implementation
details by hiding files in a subdirectory.
Task-number: QTBUG-51230
Change-Id: I4c7f9ec952bff6e5b7738d8cabe3c762c208a38e
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
This is a version of QByteArrayMatcher that calculates the
Boyer-Moore skip table at compile-time instead of at run-time,
making this class more generally applicable than QByteArray-
Matcher itself, at least for statically-known strings.
The compile-time part requires C++14 constexpr support, but
the class should compile and work even in C++98 mode, just
with runtime initialization of the skip-table.
While touching tst_qbytearraymatcher, clean up the static
global QByteArrayMatchers there and add tests with needles
longer than 255 characters for QByteArrayMatcher, too.
[ChangeLog][QtCore] Added QStaticByteArrayMatcher.
Change-Id: I0662f262ab19b79ae4096f3ab384d5b3ada72347
Reviewed-by: David Faure <david.faure@kdab.com>
QHostAddress is one of the few classes in Qt which is pimpl'd but not
implictly shared, making it suprisingly expensive to copy around, return
by value and so on. Being pimpl'd it is also still lacking a move
constructor, like most of such types in Qt.
Remove a bit of the surprise factor and make it implictly shared. In
practice this means making it eagerly parse host addresses from strings.
Since it was entirely implemented out of line, replacing it with a
implictly shared implementation is binary compatible.
[ChangeLog][QtNetwork][QHostAddress] QHostAddress is now implicitly
shared.
Change-Id: Ia7ff94efcb74e7321b7607cd690c5c162f685605
Reviewed-by: Richard J. Moore <rich@kde.org>
[ChangeLog][QtBase][General] Removed support for WinRT/Windows Phone 8.1.
Task-number: QTBUG-57288
Change-Id: Ifd6d6780cbbdb710d99556ba3d2fb2e514d4f789
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
operator== and operator!= have been disabled, as they are likely to be
misused and are not particularly useful in practice. The same goes for
the QVersionNumber conversion convenience functions.
The constructor normalizes version component values so that invalid
versions like [5, -1, 3] cannot be constructed and made to wreak havoc
on assumed logic.
Change-Id: Iabb6876bd5dc11522032837f78cf825b921a49b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
C++17 adopts P0021R1[1], which makes noexcept be part of the function
pointer's type and thus be overloadable. It contains some provisions for
allowing a noexcept function pointer to cast implicitly to a non-
noexcept function pointer, but that fails in the presence of templates
and additional overloads that could match the type in question.
Fortunately, the paper proposed a test macro, so we can change our
sources now and be compatible with both C++14 and C++17 rules.
This first failed with Clang 4.0 trunk. This source incompatibility is
not our fault, it's the language's doing.
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html
Task-number: QTBUG-58054
Change-Id: I2bc52f3c7a574209b213fffd14988cf0b875be63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
clang/g++ still warn when encountering the implementation of a
deprecated function.
Follows up 21a247adb4
Change-Id: I6ab1695acb520ef7ce7cb1896545d02607c3ce29
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
So that QFlags can use an (un)signed int matching the
underlying type as identified by the compiler and not by us.
Requires fixing a few warnings about sign conversion due to
QFlags misusages in qtbase that were either plain wrong, or
were relying on the enum being backed by an (un)signed int
when it wasn't.
Keep qtypetraits.h in the source tree in order to prevent
source breaks if some downstream #includes it (note however
that it did not contain any public API).
Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... instead of sequential .arg(const QString &) callings.
It saves memory allocations and prevents unexpected results
if replacing strings contain place markers.
Found with clazy's qstring-arg check.
Change-Id: I3912275a6e11c6fb7559ff5623f2e8cde9b7f07a
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... along with the two matching unused methods of QDateTime's test.
Change-Id: Id11a4b1b0132587f0df451d49c0043e9425d87ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's supposed to be a full alignment (like Top | Right), not
just one flag.
Change-Id: I656adda83742d7e4f31955322e937e979b32747c
Reviewed-by: David Faure <david.faure@kdab.com>
[ChangeLog][QtCore] QCoreApplication::applicationVersion now defaults to
an appropriate platform-specific value. On Windows, it defaults to the
PRODUCTVERSION parameter of the VERSIONINFO resource for classic desktop
apps, and the version attribute of the application package manifest for
Univeral Windows Platform apps. On Apple Platforms (macOS, iOS, tvOS,
watchOS), it defaults to the CFBundleVersion property of the information
property list (Info.plist) file. On Android, it defaults to the
android:versionName attribute of the AndroidManifest.xml manifest
element. On other platforms, the default remains an empty string.
Task-number: QTBUG-57715
Change-Id: I26f83dd00737e06f4321cf962aa5fab8398104ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This avoids so many complications. The prior code, using
SystemTimeToTzSpecificLocalTime(), lead to unhelpful results when the
QDateTime() implementation used MS-POSIX's defective mktime().
Although SystemTimeToTzSpecificLocalTime() is actually more correct,
we were getting inconsistent results by mixing the two: and
eliminating the use of mktime() turns out to be decidedly tricky. So,
to avoid inconsistency, stick with a UTC time (which is what FILETIME
is defined as). Change QFileInfo's methods to explicitly convert
.toLocalTime() where appropriate and document that these methods do
indeed return local time (as we conjecture has been taken for granted
by callers).
Also added a regression test for the reported case of this going
wrong. A time-stamp from before Russia's (permanent, not DST) change
of TZ could end up inconsistently handled between file-system
meta-data and raw date-time APIs, due to cross-talk between different
MS-Win time APIs.
[ChangeLog][QtCore][QFileInfo] Made sure that all file lifecycle times
are in local time. This was probably true before, but is now explicit.
Task-number: QTBUG-48306
Change-Id: Ic0b99d25c4168f623d31967bc60665c0c4f38a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For language "Traditional Chinese" on iOS with region "US",
the logic was formerly to attempt a match on country/language/script (fail),
followed by country/language (which would result in script defaulting to
"Simplified"). Now, the logic is to try language/script first if script is
specified. Failing that, language/country will be attempted.
Task-number: QTBUG-39639
Change-Id: I75a774b1e66686e95167ff221458a97a7ea2660d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jason Erb <jason.erb@sparist.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If we use QLatin1String we should include qstring.h.
Change-Id: Iebd761b98e515e9cd9cd34b96a0f8a602d00f086
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Initial support for INTEGRITY to build QtBase
Change-Id: I18f36b4dea9107f01e1c281e4b62880590c777a1
Reviewed-by: Tuukka Turunen <tuukka.turunen@theqtcompany.com>
Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
Reviewed-by: Risto Avila <risto.avila@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Honor the rule of five. Copy assignment was already disabled.
Disable also copy construction, but re-enable the move special
member functions.
This requires making the container non-const; to avoid detaches
and keep compatibility with containers that only have begin/end
(but not cbegin/cend), use qAsConst. This requires moving qAsConst
definition a bit up in the file.
Change-Id: I19cd74437cf69baceada9483920a21e96d7b1727
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Don't use Dinkum choices when the C++ library is libC++ (QNX 7.0).
Change-Id: I18c3f716ccfb0c02dbfdc01eac4b707d3ae9aab6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A directory is empty when it doesn't contain files or folders.
We can exploit QDirIterator::hasNext() to check whether this is the
case. This is efficient since it doesn't list the whole folder (in the
non-empty case).
Test cases are added for both the empty and non-empty cases.
Change-Id: I0f7e26782c0f97f9c16f928dab6cae37927875d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
StripTrailingSlash removes trailing slashes from the path, but not the
entire URL.
Task-number: QTBUG-47607
Change-Id: Id62b971e563e290b7ca000576bcc328616a3f1a2
Reviewed-by: David Faure <david.faure@kdab.com>
qmutex.h is updated to let clangqdoc document the threads case,
because the no-threads case is not interesting, and clang can
handle everything declared in qmutex.h. This change required
that a few minor qdoc errors be corrected in qmutex.cpp as well.
Change-Id: Icb4122f2179d6aad39dc68376498364820143297
Reviewed-by: Martin Smith <martin.smith@qt.io>
turns out that just appending builtin-qt.conf isn't a good idea:
executable-editing tools (objcopy, prelink, etc.) will happily drop the
"attachment".
a safe method would be adding a proper section to the executable, but
there doesn't appear to be an objcopy equivalent in msvc, and using
entirely different methods of embedding the file with different
toolchains seems like a rather bad idea.
so instead go back to the old method of building qmake with a generated
qconfig.cpp. of course, as said file is now created by qmake itself, we
have to compile qlibraryinfo.cpp a second time, and link a second qmake
executable.
Task-number: QTBUG-57803
Change-Id: I9e232693550aa870cec154e49cc06add13017cc2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Most of these involved moving or removing extraneous
aide-memoir comments left by programmers between qdoc
comments and their functions. There were also some
cases where Q_CLANG_QDOC had to be tested to make
something visible to clangqdoc. And there were a few
functions that should not have been documented at all.
Change-Id: I3bf7c397a9e5ddbffc40cc1fee7f19cad71a1ae7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
We have to enable qt_safe_ftok with either sharedmemory or
systemsemaphore. In order to make the resulting QT_CONFIG work with the
bootstrap library we switch the features off for bootstrapping. Some
tests and examples have to be excluded when sharedmemory is not
available.
Change-Id: I3fc3926d160202b378be2293fba40201a4bf50c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This update undefines Q_GADGET when clangqdoc is running.
With Q_GADGET defined, clangqdoc expects documentation for
QtGadgetHelper in each class where Q_GADGET is used.
Note that the documentation for the Q_GADGET macro is still
generated.
Change-Id: I3e6e6644c2c537c00c44ae77664892e125046daa
Reviewed-by: Martin Smith <martin.smith@qt.io>
Commit 9ca635482d renamed the configure
feature from pcre to pcre2, which unfortunately means that people would
have to change their build scripts to pass -qt-pcre2 instead of
-qt-pcre. As the configure check already verifies the correct PCRE
version for use (when using the system library), it seems more
convenient for our users to retain compatibility and call the configure
feature "pcre" again.
Change-Id: If26e7888814d8204d43baf7298d9916a4f856a48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
In this case, the issue was ICC, when compiling QtQml:
qv4sequenceobject.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QList<class QItemSelectionRange>::replace(int,class QItemSelectionRange const &)" (__imp_?replace@?$QList@VQItemSelectionRange@@@@QEAAXHAEBVQItemSelectionRange@@@Z)
referenced in function "public: static bool __cdecl QV4::QQmlSequence<class QItemSelection>::deleteIndexedProperty(struct QV4::Managed *,unsigned int)" (?deleteIndexedProperty@?$QQmlSequence@VQItemSelection@@@QV4@@SA_NPEAUManaged@2@I@Z)
This applies the same fix as qvector.h has had for ages due to QPolygon.
Change-Id: I15b62e0f9cec482fbb40fffd1490d791db5056bc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
getMaximum() and getMinimum(), called during parsing, create new
QDateTime instances, which on Linux end up calling mktime().
Making these static (for the common case of LocalTime spec)
improves performance dramatically, when parsing several date/times.
tests/benchmarks/corelib/tools/qdatetime/ (after fixing it to
actually parse a valid date/time) says:
RESULT : tst_QDateTime::fromString():
- 36,742,060 instruction reads per iteration (total: 36,742,060, iterations: 1)
+ 24,230,060 instruction reads per iteration (total: 24,230,060, iterations: 1)
Change-Id: I0c3931285475bf19a5be8cba1486ed07cbf5e134
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's quite a simple addition and required for the ahead of time compilation
tool for qtdeclarative.
Change-Id: Iba85ae5182919cdb5ab15a0b643e57c103eae632
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This allows the Dptr parameter of the Q_DECLARE_PRIVATE_D macro to be
a smart pointer, not just a raw pointer.
Change-Id: Iaf27352e327e9aedea149461d47f2f11460a42dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The article does answer the questions asked in the bug.
Task-number: QTBUG-56629
Change-Id: Ib8bac0acf45bc10598fc47feb6dd73005b5ad040
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "qYouForgotTheQ_OBJECT_Macro" function hasn't been used in
qobject_cast since commit 7d7e8ae3fa (Qt
5.2), when Olivier made the error use Q_STATIC_ASSERT instead.
Change-Id: I15b62e0f9cec482fbb40fffd1490d7c050084369
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This reverts commit 91a2c8630b. We
promised in the Qt 5.6.2 changelog to do it in Qt 5.8. It was a
temporary compatibility hack.
[ChangeLog][QtCore][QUrl] The temporary compatibility in
QUrl::resolved() that treated the base URL as relative if its scheme
matched the current URL's scheme has been removed.
Change-Id: I3e4e5051937c40319d6efffd1490eb9a5a948481
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Two sentences that read like author notes likely added by accident.
Task-number: QTBUG-56630
Change-Id: I7a0b114e128f95e54e9e8f26b43493f67747d650
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This code always intended to follow the recommended checking order from
the spec, which says "if multiple globs match, use file contents".
But if the globs had different weights, it would discard globs with
lower weights, and then wrongly conclude, if there is only one glob
left, that there was no ambiguity.
The correct way is rather: remember that multiple globs matched,
do determination from contents, and if that didn't work, *then* use
(one of) the highest-weight glob(s).
This fixes PGP-encrypted *.asc files being detected as text/plain rather
than application/pgp-encrypted.
(https://bugs.kde.org/show_bug.cgi?id=346754)
Change-Id: I734459daf9f502baa95ebb89432819964e0ce304
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* apply endianness to the mask as well
* do not apply endianness to "host" entries, they were wrongly behaving
exactly like "big endian" entries.
The issue with the mask was detected by the audio/aac magic
<match type="big16" value="0xFFF0" mask="0xFFF6" offset="0"/>
which failed to identify the test file ct_faac-adts.aac since it was
applying the mask 0xFFF6 instead of 0xF6FF (on a little-endian machine).
Not yet detected by tst_qmimedatabase which is based on shared-mime-info 1.0,
will be covered by the upgrade to 1.8 in dev.
Change-Id: I4fb7af2d367099817e712b14f2a031066d0ac432
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the loop says p <= e, no +1 should be added to e.
Testcase:
The magic for application/x-gameboy-rom says
<match type="byte" value="0x0" mask="0x80" offset="323"/>
and this code was checking both byte 323 and byte 324, finding a match
at pos 324, returning application/x-gameboy-rom erroneously.
Given the magic for application/x-gameboy-color-rom:
<match type="byte" value="0x80" mask="0x80" offset="323"/>
the expected result for game-boy-color-test.gbc is application/x-gameboy-color-rom
Not yet detected by tst_qmimedatabase which is based on shared-mime-info 1.0,
will be covered by the upgrade to 1.8.
Change-Id: I2396cb1ccfb26db5a24d5551fef493cc0b98a247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
ISO 14443-3 is for nfc communication and uses 2 different checksums.
The existing one is from ISO 3309 and the other one is from ITU-V.41.
Both are needed to implement an own transport layer defined in ISO
14443-4 to allow nfc commands with a length above 250 byte independent
from the smartphone.
This change will avoid code duplication in QNearFieldTarget.
The private function qNfcChecksum is a copy of qChecksum.
Change-Id: I790ffec8e2ea46f88b2db6f48b64fdcb140e7b70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The separator character is inserted in the resulting array
after every byte and is useful for MAC address output like
01:23:45🆎cd:ef, Hash fingerprints, or low level data
debug output.
[ChangeLog][QtCore][QByteArray] Added toHex() overload to
insert a separator character between the hex bytes.
Change-Id: Ibe436094badc02f3ade7751aa8b5d690599941d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In client code I often see code like:
startTimer(1000); //ms
Let the code to be self-explaining. So provide overload
method that takes std::chrono::milliseconds as arg.
QTimer already has std::chrono support, but QObject does not.
Change-Id: Ib348612ce35f1a997b4816fe9e864775cbcbec16
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
initially, the idea was that QLibraryInfo would receive a
pre-sysrootified ExtPrefix from the builtin qt.conf. matching this
against the sysroot would then tell us whether to sysrootify the Prefix
from a "regular" qt.conf as well.
however, this would have lead to some major ugliness and inconsistency
between the code paths, so i changed my mind.
unfortunately, i failed to adjust the remaining code, leading to
169a40d51 entirely breaking sysrootification ...
the proper (and nicely consistent) solution is to introduce a
SysrootifyPrefix key to qt.conf. this is user-accessible as well, so as
a bonus it is now possible to adjust the setting at qmake installation
time. incidentally, this omission was the last thing that prevented
using the same qmake host build for any imaginable configuration of the
same qt version ... i think.
Change-Id: Ic0eebf21f93651f6374628c0ad8b206d696a4a7e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
We chose to use UTF-8 as it allows us to ensure there's no mistaking the
hostname in case the locale is changed, if the host name contains
characters outside of US-ASCII.
But this didn't work because the code that wrote the hostname always
used the local 8-bit codec instead of UTF-8. On Unix, we used the
result of gethostname(3) directly, which is supposedly on the locale codec.
This commit doesn't fix Windows, which requires _wgetenv, the plan being
to encapsulate that with a qEnvironmentVariable() method.
[ChangeLog][QtCore][QLockFile] Fixed a bug that caused QLockFile not to
recognize a stale lock file if the machine's hostname contained non-US-
ASCII characters, on Unix. A Windows fix is still pending.
Task-number: QTBUG-49640
Change-Id: Ib9d045544ff370ec901626658a84ec4e6575fe21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Callers can persist a QModelIndex which was not persisted before in a
slot connected to the signal, and such a persisted index must be updated
in the course of the layoutChange.
Store the indexes to persist after emitting the signal.
Task-number: QTBUG-32981
Change-Id: Ibee4c0d84817d72603a03fe5b22fdeefeac0695e
Reviewed-by: David Faure <david.faure@kdab.com>
Similar to the fix in the parent commit, incorrect updating of the
internal data structures during layout changes can lead to dangling
pointers being dereferenced later. Moves are treated as layoutChanges
by this proxy by forwarding to the appropriate method. However, data is
incorrectly cleared prior to that forwarding. Remove that, and let the
layoutChange handling take appropriate action.
Change-Id: Iee951e37152328a4e6a5fb8e5385c32a2fe4c0bd
Reviewed-by: David Faure <david.faure@kdab.com>
In sourceLayoutAboutToBeChanged the source model update is ignored if
the affected parents are filtered out anyway. The same logic is
attempted in the sourceLayoutChanged slot, but there the early-return
logic is applied too late - the mapping is cleared before performing the
early-return. Because pointers into the mapping are used in the
internalPointer of QModelIndexes in this class, persistent indexes used
later will segfault when attempting to dereference it.
Additionally, if a parent becomes invalid as a result of the
layoutChange, it would be filtered out by the condition in the loop,
resulting in a different result in the comparison of emptiness of the
parents container.
Fix that by persisting the parent's container, and performing the test
for early-return before clearing the mapping.
Task-number: QTBUG-47711
Task-number: QTBUG-32981
Change-Id: If45e8a1c97d39454160f52041bc9ae7e337dce97
Reviewed-by: David Faure <david.faure@kdab.com>
The process of loading a plugin is examplified by the qLoadPlugin
function (though not all users of QFactoryLoader use this function, they
all do something similar):
const int index = loader->indexOf(key);
if (index != -1) {
QObject *factoryObject = loader->instance(index);
if (FactoryInterface *factory = qobject_cast<FactoryInterface *>(factoryObject))
if (PluginInterface *result = factory->create(key, std::forward<Args>(args)...))
return result;
}
QFactoryLoader::indexOf already locked the mutex, but not
QFactoryLoader::instance. This commit fixes that.
Note that calling the virtual create() in the plugin's factory is not
protected by the mutex. Each plugin's factory must be thread-safe and
also create an object that works on any thread too. It's also the
responsibility of the caller of qLoadPlugin to ensure that it's called
thread-safely.
Task-number: QTBUG-42855
Change-Id: I63e21df51c7448bc8b5ffffd148ebee33d4c47de
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
All Apple Platforms have public API to get the environment; there is no
reason to exclude it from the UIKit subset. It can be useful for
debugging in Xcode, in particular. Furthermore, VxWorks appears to have
support for the Unix environment API, so don't exclude it either.
[ChangeLog][QtCore] QProcessEnvironment is now available on iOS, tvOS,
watchOS, and VxWorks
Change-Id: Ife3745f9b0a588de521a714b4273c5c08eeef286
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This decouples QProcess and QProcessEnvironment, since the latter may
actually be available on platforms where the former is not.
Change-Id: I3dc799ffdf94486b64143ed01a369897fff44a96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Clang pre-3.4 didn't like this and it's used in Xcode 5.1 (which we need
to support for 5.8).
error: 'this' cannot be implicitly captured in this context
typename T::const_iterator i = c.begin(), e = c.end();
^
Task-number: QTBUG-57488
Change-Id: I63e21df51c7448bc8b5ffffd148e688d7c9b89d6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
After all the check makes sense here. If a timer was removed as a result
of sendEvent and it was not at the end of the list the list is not
shrunk but the timer info's id is just set to INVALID_TIMER_ID.
Additionally the timer's object should be fetched before we unlock the
locker as timerIdToObject is changed in removeTimer and we might access
a nullptr if the timer has been removed.
Reverts c83ba01f7b
Task-number: QTBUG-56756
Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e
(cherry picked from commit 8f2088db17)
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Some public functions in QString and QDebug are declared inside
Q_COMPILER_UNICODE_STRINGS. This commit defines it for QDoc, and
adds documentation for QDebug functions that are now visible to
QDoc.
Change-Id: Ia7f2501c1dc7b8244dcc3ce4adcd2019fdbffcb6
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
g++ still warns when encountering the implementation of a deprecated
function.
Change-Id: I6a25fc8c814590e5337069f9bced0cdec97653bf
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We can in fact delegate to QDate::toString(), contrary to the comment
that was there; we just need to insert the time in the right place,
which is easy enough to find.
Change-Id: I66624724628d45ce283243879b102ec8f741a15f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, a zone-based time would claim to be GMT, rather than
identifying its zone properly. Sadly, testing this reveals that
proprietary operating systems don't handle abbreviations ideally.
Task-number: QTBUG-57320
Task-number: QTBUG-57298
Change-Id: I8d8b7fffdbf65ac6178a65f5fc2df4d25afb1a14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When the time is specified relative to a zone, the ISO date produced
lacked its offset suffix; all zones were treated as if they were local
time. Handle zone as for an offset from UTC and ensure we do set the
date-time objects's offset from UTC when it's zone-based.
Change-Id: I7c9896bb8ec0a9d89df14a6e94b005174ab9e943
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "algorithm" is the same as the one for x86.
Also added a comment to qt_from_latin1 to indicate that manual
vectorization doesn't bring anything useful.
Change-Id: I6130cbd83c14c22b1bd15d726b26dbc83068b1a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
this moves us another step towards the "outer" configure doing just
minimal bootstrapping of qmake.
a challenge here was that so far, qmake itself needed qconfig.cpp. this
was replaced by usage of a qt.conf file instead of compiled-in values.
however, to make the executable still self-contained, that qt.conf is
embedded into it (by simple appending of a fixed signature and the text
file).
the qmake with the embedded qt.conf is not used for the qt build itself,
which instead relies on the qt.conf in bin/ as before. however, due to
the missing built-in values, this file now needs to contain more
information than before. but except for a minimal version that is needed
to start up qmake/configure at all, that file is now also generated with
qmake. as some of the newly set up properties are subsequently used by
configure itself, qmake gains a (deliberately undocumented) function to
reload the qt.conf after it's fully populated.
unlike the old implementations, this one doesn't emit redundant qt.conf
entries which match the hard-coded fallbacks. omitting them leads to
leaner files which are more comprehensible.
Started-by: Paolo Angelelli <paolo.angelelli@qt.io>
Change-Id: I4526ef64b3c89d9851e10f83965fe479ed7f39f6
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The builtins clzs and ctzs have been removed. Additionally they were
never proper internal GCC builtins and shouldn't have been used in a
constexpr function in the first place. This patch removes the assumption
that they exist when BMI is available, and let GCC fall back to using
__builtin_clz and __builtin_ctz.
Change-Id: I3e0b4e246098bb9ce6ede28b311948260ef881b9
Task-number: QTBUG-56813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
PCRE1 is going towards EOL. PCRE2 is the way forward in terms
of new features, performance, and security improvements. The
APIs that QRegularExpression uses are similar so the required
modifications aren't extensive.
The biggest difference comes to JIT-compiling of the pattern.
In PCRE1, JIT-compiling did not modify the processed PCRE pattern,
but returned a new chunk of data.
This allowed multiple threads to keep matching using the same
processed data and NULL for the JIT data, until a thread
JIT-compiled and atomically set the shared JIT data to the results
of the compilation.
In PCRE2, JIT-compiling _modifies_ the processed PCRE pattern in a
way that it's thread unsafe [1]; the results of JIT-compilation
are stored somewhere inside the processed pattern.
This means the above approach cannot work -- a thread may be
matching while another one JIT-compiles, causing a data race.
While waiting for better workarounds from upstream, employ a
read/write mutex to protect the matching from JIT-compilation.
[1] https://lists.exim.org/lurker/message/20160104.105831.3cb25b39.en.html
[ChangeLog][General] QRegularExpression now requires the PCRE2
library, at least version 10.20. Support for the PCRE1 library
has been dropped. A copy of PCRE2 is shipped with Qt and will
automatically be used on those platforms which lack it.
Change-Id: I9fe11104230a096796df2d0bdcea861acf769f57
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It probably is today, but when the I/O we're doing is explicit about
how many bytes it eats, make sure we're using an explicitly 4-byte
type, qint32.
Change-Id: I48a35fe58043368cdfd096e2628bba410d94ceaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Europe/Samara reduced its standard offset at the same time as it
started DST in March 2010, so the transition didn't change net offset.
Our interpretation of the TZ database assumed the prior standard
offset still applied; as this was equal to the new offset with DST, it
marked the dst offset as zero, so we interpreted the next few months
as being without DST, although the TZ database marks it as with.
Generally, if a DST period has an odd DST offset, it's possible it's
due to a change to standard offset at its start. Deem the offset odd
if it's not what we last saw (or, on the first DST, not an hour); in
that case, check the DST period's end, to see if it offers a less odd
DST offset. Positive DST offsets are less odd than zero or negative;
otherwise, expect what we saw last, one hour is not odd and closer to
what we saw last is less odd than further from it. This suffices to
fix Samara in 2010, at least.
Task-number: QTBUG-56345
Change-Id: I9f0ee4e9cd6901c28a8ec1558aec5d26a21152f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Such mappings are ill-defined in the presence of daylight-savings time
(DST); at its transitions, you need information about whether DST is
active or not to determine the correct UTC value. Existing code did
not have a way to be told that hint, so could not be correct.
Fixing this required changing the (thankfully private) APIs by which
QDateTime accessed QTimeZone's information stipulated by zone time.
In QDateTime, this required propagating the needed hint, when DST
status was known.
QAndroidTimeZonePrivate overloaded QTimeZonePrivate::dataForLocalTime
with an implementation that works whenever !hasTransitions(); the base
implementation handled this case lamely, so I've moved the Android
implementation there, to have only one place for both re-writes.
Amended tst_QDateTime's expected failures; passing a date and time to
the constructor *is* ambiguous when the moment indicated is in a
transition. I have changed which way we resolve that ambiguity.
Added round-trip test of QDateTime's fromMSecs/toMSecs (but as a
QTimeZone test, since that's what's actually getting tested), based on
a test-case from Marko Kangas. Initially failed for various zones,
each at one hour-offset; and, on some platforms, for some zones, at
all offsets. These last revealed that a platform may claim to have
zone information yet, for some zones, lack it (or have very incomplete
information). In each case, despite this, the platform does give
offsetFromUtc(). (The test also found another pre-existing bug on
Linux; fixed in an earlier commit.)
To accommodate these gaps in transition data, the transition-based
code now falls back to the offsetFromUtc()-based code (used when there
are no transitions) if it can't find a previous transition (which, in
any case, it needs to do its job).
Task-number: QTBUG-56460
Task-number: QTBUG-56397
Task-number: QTBUG-52284
Change-Id: I2f7422a9e9d3767940b1901d887c6a2c1f36ac9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reinterpret_cast()ing a pointer to a suitably sized integer is not guaranteed
to always give the same result for the same pointer (!). Therefore the
resulting integers are not comparable in a meaningful way. std::less is
supposed to be used to compare arbitrary pointers, so use it.
(Hopefully and reasonably, under the hood std::less does exactly what we
were doing, so this isn't BiC.)
Change-Id: I9960b3d6e35657fe7a25b842054f5d338280e850
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a bool *ok out parameter to qt_normalizePathSegments() and return false
when ".." are left over for an absolute path, indicating an attempt to
change above root.
Factor out static helper qt_cleanPath() to be able to pass the return value
to QDir::cd() and return on failure from there.
Amends change 63f634322b, which did
not handle UNC paths.
Task-number: QTBUG-53712
Change-Id: I3e63a5dd0259306a0b99145348d815899582f78e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Calling QDir::cleanPath() on "//server/path/.." resulted in "/".
Factor out a function to determine the root path part of an absolute
path for later use, and handle some special cases:
- Consider server name of "//server/path/.." as part of the prefix.
- Check on the root path for WinRT.
Task-number: QTBUG-53712
Change-Id: Ibddacf06212b6fc86fa74a5e4078df6cfd5b66f5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Commit c35fef9d3b wasn't sufficient. The
problem is that there's a complex combination of libc headers (math.h),
C++ headers (cmath), which may be provided by three different sources on
Linux (glibc, gcc and ICC). On some combinations, the isnan macro leaks
from math.h or cmath and that's what the the commit above tried to fix.
On some other combinations, there's no macro but there's an ::isnan
function defined. When we do "using namespace std; return isnan(x);",
that causes a compilation error. This commit solves that by detecting
whether there is a macro defined.
error: more than one instance of overloaded function "isnan" matches the argument list
function "isnan(double)"
function "std::isnan(double)"
argument types are: (double)
Change-Id: Iaeecaffe26af4535b416fffd148bf71826541bdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Namely: decltype(). Ideally we'd want C++17's template constructor
argument deduction, but instead use the C++11 solution: a factory
function. This enables using things such as lambdas in the container
argument.
Change-Id: Idba64d8069d15bbafe54cfdebe24b1fba1eb8d0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The C++ standard says in [support.initlist.access]/1:
constexpr const E* begin() const noexcept;
Returns: A pointer to the beginning of the array. If size() == 0 the
values of begin() and end() are unspecified but they shall be
identical.
So we can't assume it's non-null. I didn't want to remove the Q_ASSERT,
so passing a non-null pointer to append() remains required. This patch
simply won't call append() if the initializer list is empty.
This was already tested, but the failure is with a compiler that is not
part of the Qt CI.
Task-number: QTBUG-57277
Change-Id: Iaeecaffe26af4535b416fffd1489806872b412ee
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We now have qtHookData, which is a better (and cheaper) way to add hooks
for object creation and deletion. For binary-compatibility reasons we
cannot remove it in Qt5.
Change-Id: Iecd9f4e1195f90279c395845fa26c6301b67b9a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Other methods that call this method check for errorMessage to be
nullptr, so better check here, too.
Change-Id: I8cf4e9d4f5eaafcfc8309dc351ae3b7027c40a98
Reviewed-by: David Faure <david.faure@kdab.com>
Provide appropriate alternative documentation where applicable.
Change-Id: I73d810938bb961a74d06d8cedb05c38675363ef0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This adds documentation for QOperatingSystemVersion::OSType and cleans
up some extraneous quotes.
Change-Id: Idaeb163caded9a51ce0fbcc812eb622b4227844e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Q_COMPILER_REF_QUALIFIERS is not yet supported
on all platforms, so clangqdoc must ignore
functions that are defined only when it is
defined. This change adds && !defined(Q_CLANG_QDOC)
to some #if defined(Q_COMPILER_REF_QUALIFIERS) tests
to allow clangqdoc to use old declarations.
Note that Q_CLANG_QDOC should also be used instead
of Q_QDOC from now on, so that we know that uses
of Q_QDOC have been examined to see if they are
still required for clangqdoc.
Change-Id: I910be70df63eca09985728c7b9eba473aed141ba
Reviewed-by: Martin Smith <martin.smith@qt.io>
Some declarations in QProcess are declared only
for Windows. This change uses the Q_CLANG_QDOC
macro so that #if defined(Q_OS_WIN) becomes
This ensures that Windows-specific documentation
always gets generated. The macro is added in
both .h and .cpp files.
Change-Id: I632fc52d010cd7c0399fd191f44cbacf6ed25aff
Reviewed-by: Martin Smith <martin.smith@qt.io>
Duplicate qdoc comments removed for setPreciseRemainingTime(),
remainingTime(), and deadline(). Added qdoc comments for swap(),
and two new assignment operators. Also added a few parameter names.
Change-Id: I5c19ca3bdef876019c5742397249ea9e0c066bf3
Reviewed-by: Martin Smith <martin.smith@qt.io>
That's what happens when you don't test and just rely on an the warning
listing. ICC has two warning numbers for deprecated warnings: one that
matches Q_DECL_DEPRECATED and one for Q_DECL_DEPRECATED_X.
Change-Id: I73fa1e59a4844c43a109fffd148ca7a05eda8f13
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
It's a bit large for an inline function.
Note for Qt 6 that this function is nonsense.
Change-Id: If6af5d3538aac86d55313ba6accdb13f892e6564
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Do not create QByteArray from const char* to compare with other
QByteArray, because there is an overloaded operator==.
So avoid needless allocations.
Reorder condition, because isEmpty() method is cheaper than
string compare.
Change-Id: I8d2c8a0fb247528d9ce485007431167372d62bff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
And get rid of related DEFINES in the pri file
Change-Id: I54cf25b7cb447af22b410213759044e8018939a6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
After all the check makes sense here. If a timer was removed as a result
of sendEvent and it was not at the end of the list the list is not
shrunk but the timer info's id is just set to INVALID_TIMER_ID.
Additionally the timer's object should be fetched before we unlock the
locker as timerIdToObject is changed in removeTimer and we might access
a nullptr if the timer has been removed.
Reverts c83ba01f7b
Task-number: QTBUG-56756
Change-Id: Ib1a04c02fbfcf4c939b4891d42f954dc9e87149e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Turn them into proper private features, and remove setting of
defines in the pri file.
Change-Id: Iafc11e93d4a9349bf15971dc1adac9a828ea03f6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
... if sync() has already been called manually.
Change-Id: I11bd6810aa3c1065a72ffaa2001d1bdbf8bf9c89
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add parentheses after function names, replace
is different -> differs
Change-Id: I6332db1d1650ed8d8320c5f20cd79d0bf1870e27
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
As _BitScanForward and friends are not marked constexpr in Visual Studio,
functions using these may not be marked either.
Task-number: QTBUG-57086
Change-Id: I29cfa4459580b5740f1011e7f39309844518ce03
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This is the only warning we disable in a lot of places in Qt 5.8 source
code. If other warnings become common, we can add macros for them too.
Change-Id: Iaeecaffe26af4535b416fffd1489d1968e29c52a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The user can call qSetMessagePattern after program start, so we need to
be sure that the parsed argument data is properly cleared.
Task-number: QTBUG-57144
Change-Id: I1978c6b95bd84639a8c4fffd1487429b04725522
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Qt5Config restricts search paths of Qt components to ${_qt5_install_prefix}
to prevent accidentally using system Qt modules in case of restricted Qt
configuration. However this does not work properly when Qt is used without
installation, in particular when building cmake-based QtWebKit as a Qt
submodule, because ${_qt5_install_prefix} resolves to QtBase and does not
contain components from other modules.
This patch changes search path from ${_qt5_install_prefix} to all qt5
subdirectories.
Change-Id: Icf01a256097710889573ad69d847b9c3bffa1449
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Introduce a glProgramBinary-based disk cache in QOpenGLShaderProgram.
By switching the typical
program->addShaderFromSourceCode(QOpenGLShader::Vertex, ...)
program->addShaderFromSourceCode(QOpenGLShader::Fragment, ...)
invocations to
program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, ...)
program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, ...)
the compilation may be skipped via gl(Get)ProgramBinary and a disk
cache, when supported. Such QOpenGLShaderProgram instances will have
no QOpenGLShader instances attached. Instead, the entire program
binary (which is driver-specific) is loaded as-is.
Support means OpenGL ES 3.0 or the presence of
GL_ARB_get_program_binary, in combination with >= 1 supported binary
formats. Note that some drivers claim program binary support but
expose no formats. This amounts to no support in practice.
When support is not present, calling the new functions is equivalent
to the non-cacheable variants. If the OpenGL driver changes (vendor,
renderer, version strings), recompilation and storage of the new,
potentially incompatible binary program will happen transparently.
The cache can always be disabled by setting
QT_DISABLE_SHADER_DISK_CACHE=1 or the new application attribute
Qt::AA_DisableShaderDiskCache.
Location-wise the primary choice is the shared cache
(GenericCacheLocation). If this is not available or is not writable,
the per-process one (CacheLocation) is used instead.
In addition to the new public APIs in QOpenGLShaderProgram, the main
shader users in QtGui are migrated as well. (OpenGL paint engine,
glyph cache, blitter, eglfs mouse cursor). This means that any
application using QPainter on OpenGL or widgets with eglfs will
benefit from the improved startup times. Qt Quick will follow suit as
well.
[ChangeLog][QtGui][OpenGL] QOpenGLShaderProgram offers a built-in
program binary disk cache for systems with OpenGL ES 3.x or
GL_ARB_get_program_binary. This can lead to significant increases in
performance when it comes to application startup times for
example. Usage is opt-in for direct C++ users of the class, however
Qt's own main users of shaders, including Qt Quick and QPainter's
OpenGL engine, are migrated to use the new, cache-enabled APIs.
Opting out on application level is always possible via
Qt::AA_DisableShaderDiskCache.
Task-number: QTBUG-55496
Change-Id: I556f053d258bfa6887b1d5238c9f6396914c5421
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
They should be enabled/disabled through the configuration system.
Remove some unused defines, and move one define from qglobal.h to
a proper feature definition in Qt Gui.
Change-Id: Ie8d5bff9712ba745af60b42ceca3f0440bed2706
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead of doing the conversion from the big-endian data by hand, let's
use the convenience functions from qendian.h.
Change-Id: If3966ca94428afabb1f5c922967fb9970f976622
Reviewed-by: hjk <hjk@qt.io>
Shuffled its parts to make clear which bits are public, private and
protected. QDateTimeEditPrivate makes rather heavy use of the last.
Change-Id: Ic5f9d0c5cc85f02e57d3f31e9ac31a17428c5311
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
If it fails, we get NULL back but haven't free()d the old pointer;
saving the NULL return over the old pointer forgets it, leaking the
memory it pointed to. This is particularly severe in the JSON
parser's grow(), where reading a very large JSON document can lead to
the last successful realloc() in a doubling pattern being very large
indeed; the subsequent failure will leak this very last allocation.
Only worth checking for, however, when the subsequent code takes care
to handle failure: in most cases, if realloc() fails, we're about to
crash anyway.
Change-Id: Icd3a503f169be224f0a058c58e8b7c82a3241ae7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Text that should simply have been naming days of the week used
Qt::Sunday rather than the simple day name.
Change-Id: I64a3cdacd854c1c9c0fbf2d11826555086d674f4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
SHGetSpecialFolderPath is declared 'unsupported' by Microsoft, and has
problems with non-ASCII characters. Replace it by the newer
SHGetKnownFolderPath.
Task-number: QTBUG-50570
Change-Id: I8b2dfa10fa5dc30e6c3be094a2ba8d7c3504f2ca
GPush-Base: 4d181bd93234a3747b520d10417825a0147bfeb1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
The code is dead, as the codec is never used on macOS.
Change-Id: I86138f1c95e5564256b4d592f0044e83658def93
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Turn iconv off if ICU is being used (in line with codecs.pri)
and get rid of the DEFINES += GNU_LIBICONV in the pri file.
Change-Id: I6fbca975498adbb3e67f913ae9b1dd5cc53ee8da
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The prior test deemed there to be narrowing if source and destination
integral-or-enum types didn't have the same signedness; but all values
of an unsigned source type can be represented in a larger signed
destination type, so there is no narrowing in this case.
Updated QObject test-case to match.
Change-Id: I517a5997adcad70e185d7469a8d26788e463cb75
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
remove(int, int) with O(N) was used in a loop.
We had a quadratic complexity.
Use erase-remove idiom to fix it.
Change-Id: I643a2a75619ec5ea2bf99e48a25f64a7f69ba156
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
allowed code such as
mutex.try_lock_for(10us)
to compile, which is misleading, since it's actually a zero-
timeout try_lock().
Feedback from the std-discussions mailing list is that the
wait_for functions should wait for _at least_ the duration
given, because that is the natural direction of variance
(tasks becoming ready to run might not get a CPU immediately,
causing delays), while an interface that documents to wait
_no more_ than the given duration is promising something it
cannot fulfill.
Fix by converting the given duration to the smallest number
of milliseconds not less than the original duration. If that
is not representable in an int, use INT_MAX, emulating the
effect of a spurious wakeup, which are allowed to happen if
the function returns false in that case.
In the above example, the try_lock_for call is now equivalent
to
mutex.tryLock(1);
The tryLock() docs state that the actual waiting time does
not exceed the given milliseconds, but fixing that is a
separate issue.
Change-Id: Id4cbbea0ecc6fd2f94bb5aef28a1658be3728e52
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The time stamp is added at the end of the node information and
consequently this also bumps the version.
Task-number: QTBUG-57182
Change-Id: Ia10e006f28c0b168b2bcd74ed8b7098f84d10af3
Reviewed-by: hjk <hjk@qt.io>
Introduce helper functions switch_{on,off,from_to} to make
the code more readable, and prepare everything for later
optimizations reducing the sizes of critical sections (by
locking the mutex later, or even never).
This commit, however, is only concerned with shutting up
tsan.
In waitForResult(), simplified the code by removing an
unneeded if guard: the condition is checked in the while
loop immediately following in the then-block, and the
local variable declaration that precedes the loop is not
worth guarding.
Change-Id: I24bfd864ca96f862302536ad8662065e6f366fa8
Reviewed-by: David Faure <david.faure@kdab.com>
clangqdoc must parse the declaration for QWinEventNotifier
for all platforms, not just for Q_OS_WIN, so Q_CLANG_QDOC
must be tested as well.
Plus the qdoc comment for an invisible static function is
converted to a non-qdoc comment in qvariant.cpp
Change-Id: Ic41731decca55b3be837f9c5f832310513773e60
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Giving the URL of unicode.org isn't much use; the standard is enormous
and the reader shall have trouble finding the specific table that
enumerates the direction types. Found a more specific URL (that looks
like it should be stable) for this one link.
Change-Id: I8abcedf530baf692d7e0c7f146f3066df223951f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The outer scope it was in had a later clause with its own pos
variable.
Change-Id: I8d083d3d5935416ef82a78890ed145f02d6d6ded
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The documentation for the qtmain license is right now pretty hidden.
The library is added by qmake independent of the Qt module that are
linked to, but it seems safe to assume people at least link against
Qt Core.
Change-Id: Id474990edde45feab6727bada2bc6a28946216cd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
swap the branches for (not) reading from qt.conf, and use a state
variable instead of an 'else' for mutual exclusion. this is somewhat
more self-documenting, and allows for a saner handling of the mkspec
fallbacks (which really should have been in a separate [QMake] section
along with Host* and Sysroot, but changing that now is way too much
hassle downstream).
Change-Id: I80a73294022fd1e8d84fe501b737c4fc7758662f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Do not consume white-space after a token before the token has been
parsed, otherwise we end up with misleading offsets. This also fixes
a wrong error of illegal number in several cases.
Change-Id: I492ca4de0346a1d0ab73b1c23d7a72dba812664c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This reverts commit 862fa24179,
which attempted to optimize QJsonObject::operator== under the
assumption that the entries it holds are lexicographically
sorted. They should be, because Object::indexOf() finds them
by binary search, but apparently both fromJson(), as well as
construction through op[] leave (some) entries unsorted.
This behavior should be fixed, because other code relies on
sorted entries, too, but until the problem is more fully under-
stood, revert the patch to unbreak equality comparisons.
Task-number: QTBUG-56843
Change-Id: I5b608c16d1bbcb4f01b75ce93bd58b49ff050be2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fix compilation with topleveldomain, textodfwriter
and cssparser features disabled.
Change-Id: I3f061fb09eef36cd640256a46cf77dde85a54d3d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Add better boundary checks and catch (hopefully all)
cases where invalid binary JSON could cause crashes.
Change-Id: I206510b7c5e3ba953802a5f46645878e65704ecc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
qt_find_obj_child is a vestige from Qt3. It is not used nor
exported. It can safely be removed.
Change-Id: Ief6164c361a369559e067b99880c357e421e6342
Reviewed-by: Martin Smith <martin.smith@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When we already have the hash-value we can give it to findNode to avoid
recalculating it, and if don't need it later, we don't need to request
it.
Removes around 1% of qHash calls when running QtCreator.
Change-Id: I0e5e61e26a407f4ac7e029a3ac13ddd553e4994b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Someone cut-and-pasted but forgot one of the changes.
Change-Id: I647dc8117ebfe8ce3d4b26d468b80c15d4e533e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Any other use than for enums should use std::is_[un]signed. Make this
explicit by renaming the type traits.
Change-Id: I494158563c95c710e710d0d337f4e547006df171
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the macro is now just a wrapper for std::is_enum,
its use is also deprecated.
[ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated.
Use std::is_enum<>::value instead.
Change-Id: I09b9f4559c02c81f338cace927873318f2acafde
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We do not need to check for an invalid timer id, as this can only happen
if the above check is already true. Hence, this was doing the same check
twice.
Task-number: QTBUG-56756
Change-Id: Icca9b26c32ce88eab76dd02c6c10b24af07bfad7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The intention has probably been to reset a reference, which is not
required.
Task-number: QTBUG-56756
Change-Id: I1ef44b6c9b8365ac5c8d48234137e518558e9398
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Remove most type traits from qtypetraits.h, but keep the custom
implementation of is_signed/is_unsigned. This gets rid of
BSD-3 licensed code from Google in a public header (hugh!).
The custom implementations for is_signed/is_unsigned are kept
because the implementations in gcc's standard headers do not
work as we expect for enums - both is_signed and is_unsigned
always returns false there - see also
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027
[ChangeLog][QtCore][General] Qt now relies on type traits from
the C++ standard library.
Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's arguably better to return a non-existing location than no location
at all. This makes it in line with the documentation for e.g.
QStandardPaths::writableLocation that says
Note: The storage location returned can be a directory that does not
exist; i.e., it may need to be created by the system or the user.
Finally, this was also the behavior of code that used
SHGetSpecialFolderPath before.
Change-Id: I5ee44747a38434535610e45a4d303b36ef79d42a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
SHGetSpecialFolderPath is declared 'unsupported' by Microsoft, and has
problems with non-ASCII characters. Replace it by the newer
SHGetKnownFolderPath.
To fix compilation with MinGW, we have to link in libuuid also in
the bootstrapped tools. The alternative is redefining all GUID's
(like we did for FOLDERID_Downloads), which is arguably less elegant.
Task-number: QTBUG-50570
Change-Id: If99be559bc72de3734ae1fa4d50f960659739898
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Define NTDDI_VERSION, just like _WIN32_WINNT, to be Windows Vista.
Usually NTDDI_VERSION is automatically set by MinGW headers to the value
that matches _WIN32_WINNT. However, for precompiled headers the inclusion
order is that _WIN32_WINNT is set _after_ the relevant MinGW header is
parsed, so this can fail.
The alternative would be to set _WIN32_WINNT via a compiler flag, e.g.
in the mkspecs.
Change-Id: Id59e7083f0d3e00491b54e87647c6c9fabb99795
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Adds a few missing parts of the conversion from QVariant to QJsonValue
after the introduction of the nullptr QVariant. The conversion the other
way is already implemented.
Change-Id: I8b25dec4b476c4761c5098a60944ff11c36f8bec
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The timerInfo list might get accessed concurrently and cause references
to become dangling. Hence, we need to protect usages with a mutex.
According to tests/benchmark there is no impact on performance.
Task-number: QTBUG-56756
Change-Id: I4bdffccff70d2dca99f4a39defad438afe571ada
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
By some unfortunate oversight, this enum was never registered.
Change-Id: I2227ccf294d2cf717187a3dcaaf4cbfacc4ac65d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
I'm guess I introduced the regression in the commit
18ed6f20ad, which I wasn't sure about.
Change-Id: Ic46ff326a6ba46bc877cfffd14839f84fdf796e7
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Check all places where we reallocate our internal data structure
and return a DocumentTooLarge parse error if we can't get enough
memory.
Change-Id: I006d0170d941837220c7dad0508571b68e2cbfd7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kati Kankaanpaa <kati.kankaanpaa@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
POSIX does not require that readdir() be reentrant even for operations
on different dirent objects, but all implementations (according to the
glibc documentation) already do that. Moreover, it's not a good idea to
use readdir_r since the buffer space is limited by the caller, so
certain file names may be too long (ENAMETOOLONG) -- we had a workaround
for QNX, but for no other OS. According to the glibc documentation, it
is expected that POSIX will mark readdir_r obsolete and instead require
some form of reentrancy for readdir.
This commit makes everyone use readdir instead. The macros in
qplatformdefs.h are left behind in case someone else is using them.
With glibc 2.24, we started getting:
qplatformdefs.h:150:35: warning: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Wdeprecated-declarations]
qfilesystemiterator_unix.cpp:112:17: note: in expansion of macro ‘QT_READDIR_R’
Task-number: QTBUG-56088
Change-Id: I33dc971f005a4848bb8ffffd14749b4082f62e69
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
missed the equivalent code in QFactoryLoader (which bypasses
QPluginLoader). Besides, QPluginLoader::unload() was still doing
unloading, which it won't anymore.
Not unloading plugins is Qt's policy, as decided during the 5.0
development process and reaffirmed now in 5.6. This is due to static
data in plugins leaking out and remaining in use past the unloading of
the plugin, causing crashes.
This does not affect QLibrary and QLibrary::unload(). Those are meant
for non-Qt loadable modules, so unloading them may be safe.
Task-number: QTBUG-49061
Discussed-on: http://lists.qt-project.org/pipermail/development/2015-November/023681.html
Change-Id: I461e9fc7199748faa187ffff1416070f138df8db
(cherry picked from commit 494376f980)
Discussed-again-on: http://lists.qt-project.org/pipermail/development/2016-October/027476.html
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Only detach() if the string does contain the character to be replaced.
Save memory allocations.
Change-Id: I69c070d3f0b99f505fb6c209f657cdce31a35461
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This change provides missing documentation for two member
functions of QString.
QString QString::fromUtf16(const char16_t *str, int size)
QString QString::fromUcs4(const char32_t *str, int size)
Change-Id: I94a9437a457062e49e4457f5876e4d7c31fff24c
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
The mentioned functions are now documented in src/3rdparty/freebsd.
Anyhow, the license and copyright differs ...
Change-Id: Ib59ace624d1d8244f591668ed05993787ca65d24
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
It's nonsensical to have a variable like AndroidJellyBean which is
documented as Android versions 4.1 through 4.3 but is actually codified
as 4.1. Add separate variables for Android "maintenance releases" which
incremented both the version number and API level. "MRn" where n is an
integer is the same naming convention the Android APIs use.
The only exception to this rule is Android 4.4W (API level 20) which was
KitKat for watches. 4.4W is not a representible or comparable version
number, so for now, AndroidKitKat will identify both Android 4.4 and
4.4W (API levels 19 and 20). As Qt does not yet support Android Wear,
this is not expected to be a problem in practice.
Change-Id: I28473bad86bbe747db292bd0a9a164eeeba56a32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Recontribute QUrl::fromUserInput under the corporate license agreement;
i.e. remove the separate BSD license from the code.
Change-Id: I1e0b4aab921fb20d2fd558fe732cea596ecbc9ca
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
According to the latest XDG spec, FontsLocation should point to
XDG_DATA_DIR/fonts, not ~/.fonts.
Task-number: QTBUG-55507
Change-Id: Ia62ffe172abbb93d5ce7fd58bdf038ff13954f1b
Reviewed-by: David Faure <david.faure@kdab.com>
replace explicit pkg-config uses with the results of configure tests,
for consistency.
Change-Id: I3587db6085798ea7a49f8871fc6838eb687a6391
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
On a discussion in the Development mailing list it became clear that
qFuzzyCompare does not work for NaN or infinity values. That was not
mentioned in the method documentation though. This patch fixes that
hiatus. It also clarifies how to deal with the comparing to 0.0
limitation.
Change-Id: I8b6d54cc0c1136e79b0d7be1a62bc9ed394d2575
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
The origin of the class predate git history, but it has been apparently
unused in Qt since Qt 4.5 times. Removing this relieves us from
documenting its custom license.
Change-Id: Ie91be5f0b2fbaf10dc212c44ebd37e6b9d781592
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Allows the usage of _BitScanForward, _BitScanReverse, __popcnt and
__popcnt16 functions.
Fixes part of the build with MSVC15.
Change-Id: I5ec37184209196ad19beddb4d6a36f9a9fd3b315
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Though there should have been no ill-effects, they happen.
Task-number: QTBUG-52605
Change-Id: I9093948278414644a416fffd147444078edc3183
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
isRightToLeft() was missing in the API.
Change-Id: I49bc30e4c50f5693eb613c200587acba85074f33
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Remove the errorCodeToString() which is duplicating
the functionality and does apparently not work.
Change-Id: Ib1ca2dfed630b10d01c0acf278c42eb851405b46
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This will be done by all POSIX APIs for strings coming in that way, but
because other code (like NSWhateverViews) will most likely return
decomposed form, we make sure that those are in composed form too.
Task-number: QTBUG-55896
Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
These methods were missing in the API. constBegin, constEnd
are the more Qt-ish names.
Also it makes porting client code from QString to QStringRef easier.
Change-Id: I3fce1d206073d26259fe0fa44d0f7ca718504ec3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The property is 'purpose' now. Also elaborate a bit more on the feature.
Change-Id: I66aa4165044f132dff018cfd01d54b939bb64fac
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
'bytes' is checked against MaxByteArraySize in the beginning and
remains unchanged in the function.
Change-Id: Ibd4091b95837db16cf45f845d485bfb189317125
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
While "commonest" is still correct English, it's rather old-fashioned
and "most common" predominates Qt's wording style.
Change-Id: I20d72c098ee40b2a89f91e42f7208fe5b87286a2
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
All strings coming out of POSIX API calls are converted to composed form
by QFile::decodeName. Do the same for realpath(3) output. This is
especially important for HFS+, which will store file names in decomposed
form, and APIs will therefore return strings in decomposed form.
Task-number: QTBUG-55896
Change-Id: I5e51f4e5712ff26bf9644cbcf9a9603995748892
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
There are more than 1000 new entries since the table has been
generated the last time. The autotest needs to be tweaked
because the rules for the .mz domains have changed; use the
.ck domain instead.
Change-Id: Ife692afd46ac41a66604e966e5e8cb57c7aa649c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Qt::ISODate format strips milliseconds, so a new format is introduced
that keeps the milliseconds. A new format was chosen over fixing the
existing format due to the behavioral change of suddenly having ms
as part of Qt::ISODate.
Change-Id: If8b852daed068cce8eee9b61a7cd4576bc763443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is an improvement for the following reasons:
- Should mutex locking allocate any kind of resource,
unlocking in reverse order will free those resources
in inverse order, which helps typical allocators.
- If the lock pair is contended, by unlocking in the
same order as locking, we were allowing the waiting
thread to wake up to take the first lock just to
find that the second lock is still held by someone
else.
The order of unlocking has no influence on the correct-
ness of the algorithm.
Change-Id: Id16b0342aef325c14a7bd8836d3a75db68ef2588
Reviewed-by: David Faure <david.faure@kdab.com>
Change 0696566b1e caused the block
size to be incorrect for data > 32MB.
Since bytesToWrite changes within the do...while loop, then the block size
can potentially change too each time. So it needs to be recalculated each
time rather than just once.
Task-number: QTBUG-56616
Change-Id: I9880d0985f2d0242c30e67230be7271eb806db95
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Use QStringBuilder more.
Avoid quadratic behavior when prepending zeros
in a loop, prepend whole string intead.
Use const API more for CoW types.
Change-Id: If114107dc3d9876b9a7c77bc0071878cb6e00892
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
By templating on the <chrono> types and unconditionally using
duration_cast to coerce the duration into a milliseconds, we
violate a principal design rule of <chrono>, namely that non-
narrowing conversions are implicit, but narrowing conversions
need duration_cast. By accepting any duration, we allow non-
sensical code such as
QTimer::singleShot(10us, ...)
to compile, which is misleading, since it's actually a zero-
timeout timer.
Overloading a non-template with a template also has adverse
effects: it breaks qOverload().
Fix by replacing the function templates with functions that
just take std::chrono::milliseconds. This way, benign code
such as
QTimer::singleShot(10s, ...)
QTimer::singleShot(10min, ...)
QTimer::singleShot(1h, ...)
work as expected, but attempts to use sub-millisecond
resolution fails to compile / needs an explicit user-
provided duration_cast.
To allow future extension to more precise timers, forcibly
inline the functions, so they don't partake in the ABI of the
class and we can later support sub-millisecond resolution by
simply taking micro- or nano- instead of milliseconds.
Change-Id: I12c9a98bdabefcd8ec18a9eb09f87ad908d889de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().
We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.
To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.
Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Comparing pointers that do not point into the same array using
operator< is UB. You need to use std::less<>.
The QOrderedMutexLocker ctor already used std::less to compare
pointers, but the static relock() function was not fixed.
Amends 5007352164.
Change-Id: I584d382391dd5a2af75020a4e77f3e42ee5d5708
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Add a class QWindowsRemovableDriveListener to
QWindowsFileSystemWatcherEngine listening to the WM_DEVICECHANGE messages
sent to the top level windows to detect insertion and removal of USB drives.
In addition, hook into QWindowsFileSystemWatcherEngine::addPaths() when
watching on removable drives, registering a notification for a
volume-lock-for-removal message on the internal window handle obtained from
QEventDispatcherWin32. When a request to lock the volume for removal is
received, remove the paths from the watcher, enabling removal.
The class instance is set as a dynamic property on the QFileSystemWatcher where
it can be retrieved from clients. This is primarily intended for use by
QFileInfoGatherer/QFileSystemModel.
Task-number: QTBUG-14290
Task-number: QTBUG-18729
Task-number: QTBUG-55459
Change-Id: Ic95b9d9291b1ec6f426c0702bad896bb064b9346
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
all users of this functionality have been removed, and not emitting the
version info saves quite some noise from the generated files.
the reason why the users have been removed is that it was unreliable in
the first place: if a dependency is found without pkg-config, no version
information would be available.
the extraction of the version via pkg-config itself is kept in place, as
configure tests could be potentially optimized by utilizing it.
this reverts much of commit 48b4e0bf6f.
Change-Id: I01917f3b2a56b747d7cc54955141d20d23d0990a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: Ia471fff171b3bc3de40e166e18f30e6782581611
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
for that, qt_help_lib.prf gains the ability to write "external module
pri" files that contain suitable information for QMAKE_USE.
these files have a bunch of limitations:
- they are not installed, because a) they are not relocatable and b) the
helper libs' headers are not installed, either
- it won't work with qmake -r, which is ok, as qt5 does not build with
qmake -r anyway
- deps are not transitive, neither at build nor at use time
the freetype, harfbuzz-ng, pcre, and png helper libs have been adjusted
accordingly, and their uses replaced with QMAKE_USE instances. this also
allowed inlining the now trivial {harfbuzz,pcrc,png}_dependency.pri
files. freetype_dependency.pri remains due to its funkiness.
Change-Id: I16890eecb122e34ec49f3d3e68380d1ea71a198a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The SSE code had a case where tail-loop unrolling was disabled when
optimizing for size. What would be even shorter, is to just do a
straight-forward loop over the arrays and compare them. For anything
else, we can just go for speed.
Change-Id: Ifb31650e10e41409972a38014067dbd2927674c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fixes build with the latest GCC 7.
Change-Id: I4900a256ed1c6cb177d7f94d54e5b07c06ddad08
Task-number: QTBUG-56514
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Defines a structure that tells the compiler in no uncertain terms the
maximum number of times a loop can be run.
The reduces the size of qdrawhelper_avx2.o from 22kbytes to 11kbytes.
Change-Id: Ie3d6281b04b4be3332497c15f3dfe9f185e20507
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The sources of the state machine are excluded completely at the build
system level instead of littering them with #ifs.
All remaining usages of QT_NO_STATEMACHINE are converted to
QT_CONFIG(statemachine) or a QT_REQUIRE_CONFIG(statemachine).
Also make the qeventtransition feature dependent on statemachine.
Change-Id: Ib05c7ca263a02042523fff8f794fa87342df1069
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Add a qconfig-bootstrap.h, which contains all the defines required
to build the bootstrapped tools. This will be required anyway when
moving more code over to use QT_CONFIG(foo) instead of QT_NO_FOO.
Change-Id: I783d0aa0100b9190fe2d422bee4a95b05720aebe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Not all Qt integration points can call QCoreApplication::exec(), in
particular, ActiveQt. When an ActiveQt server is loaded, it tries to
mimic the behavior of calling QCoreApplication::exec() by setting
QCoreApplicationPrivate::in_exec = true. However, when unloading the
DLL it is necessary to call the same clean-up (e.g. deferred delete)
that QCoreApplication::exec() does. Extracting the cleanup in a separate
function means implementation does not have to be duplicated.
Task-number: QTBUG-56172
Change-Id: I061f1c06f38881032ad7044416c12c91e536478a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
GCC defines the [[gnu::fallthrough]] attribute for C++11 and C++14
code, as well as __attribute__((fallthrough)) for C++98 and C code.
Use them.
Change-Id: I66aa178c2a96e2ff9ac3f6f02821c978b4ec3696
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>