Previously, a 1, 2 or 3 for "dd" would be rejected because 10, 20 or
30 would fit in the field and be valid; but 4 or more was accepted,
even though it was too short for the field, because no suffix could
make it valid within the field-width.
[ChangeLog][QtCore][QDateTime] When parsing dates and times from
strings, fixed-width date-time fields, such as a "dd" for day,
QDateTime now rejects all values that should be padded, rather
than only doing so when the value is a prefix of some value that
would fill the field-width. Use a single letter for the field,
e.g. "d" for day, if you want to accept short
values. (QDateTimeEdit is not affected.)
Task-number: QTBUG-63072
Change-Id: I22d223c50057c3edab4ef7f01d9ed0f58e9139c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Test-case taken from bug-report; fits in as an easy row in an existing
data-driven test. Add similar tests for date-time and time; and an
isValid test on the end of year 9999. The date-time parser was using
the end of year 7999 as maximum value for dates and date-times; extend
this to year 9999, as I can see no reason not to.
[ChangeLog][QtCore][QDateTime] Years up to 9999 can now be parsed
without error (previously 8000 and beyond were treated as invalid) in
all formats (not only in ISO format). Widgets handling dates now
support dates to 9999, likewise.
Task-number: QTBUG-64401
Change-Id: I518cfa6c2cb4ecc5a85b896dc9e56b4fdd8a8bb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a new source model was set to QSortFilterProxyModel, the model
tried to remap the persistent indexes to the new model which was wrong.
The correct solution is to clear the persistent indexes with
_q_sourceModelDestroyed() since the old source model went away.
Task-number: QTBUG-44962
Change-Id: Id39e9ac83324250e8bfa434aae467a9206d2590e
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
The previous commit didn't handle correctly the case where an entire
mime directory is deleted. The unittest wasn't testing that case,
now it is. We need to move providers into a new list, and then
delete those left over (i.e. now unused).
Change-Id: I04fd8b39b511a2331d706864f695ce5074acf916
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Previously, we would use mime.cache in all mime directories if at
least one of them had such a file (other than the most-local one),
otherwise the "source" XML would be used in all directories.
Now it's possible to use mime.cache in those directories which
have one, and XML in those directories that don't.
Not only is this more correct, it will allow in a subsequent
commit to bundle the binary cache in QtCore's qrc rather than
the very big XML file.
The design change to allow this is that now every provider
only deals with a single directory, and QMimeDatabasePrivate
takes care of creating multiple providers, one for each dir.
This required to move most of the loops from the binary provider
up to QMimeDatabasePrivate itself.
Change-Id: Iac82d5f5836b80d45076e586b903d16fa2525b34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.
Change-Id: I1861e5366ea980dff2ffa753b137276c77278eee
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The test is removing 2 rows starting at the last row of a model.
As the comment indicates, that's clearly invalid.
Change-Id: I43ef00d602934965b206e2ba591ff8fd0a6ae398
Reviewed-by: David Faure <david.faure@kdab.com>
Unary ~ is not defined for enum classes, so we need a cast.
Change-Id: I79d495ebcc24ab960da8dae3be08eb307a9de448
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Both ARM and x86 can convert fp16 much faster in bulk than one at a
time. This also enables hardware accelerated conversion on x86, when
F16C isn't unconditionally available at compile time.
This code is implemented in C to ensure that there's no leakage of
inline symbols from the .obj file that was compiled by Visual Studio
with AVX support. Unfortunately, simd.prf uses $(CXX) instead of $(CC)
for all its sources, which means the file gets interpreted as C++ by
g++, clang++ and icpc. Those compilers at least don't leak any symbols.
Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I9d26d99e83392861fb09564e0e8e8d76cd8483b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Tested with Clang, GCC 4.5 & up, ICC 17 and MSVC 2017. No current
version of MSVC supports C11 and GCC implemented the features slightly
later in C than in C++.
Change-Id: I57a1bd6e0c194530b732fffd14f45c5074c9a052
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This test makes sure that we do not introduce a regression where the
threads exited the inner loop over the queue before the queue was
empty. This was triggered by calling tryTake at least maxThreadCount
times, which left the same number of null pointers in the queue
and caused the inner loop to exit too soon for all the threads.
Change-Id: I3a9d800149b88d09510ddc424667670b60f06a33
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This allows us to make sure that the PID we read is from the same boot
as we are right now running. The collision could happen on embedded
systems where the boot sequence is fixed, so all the same processes
would have the exact same PIDs after reboot as they did before.
[ChangeLog][QtCore][QLockFile] QLockFile can now properly conclude that
a lock file from a previous boot of the same device is stale and can be
removed. This is implemented only for Linux and Apple operating systems.
Task-number: QTBUG-63425
Change-Id: I0b48fc8e90304e0dacc3fffd14e8e3a197211788
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The issue was introduced by eaee1209f0, so
it affected only 5.9.2.
[ChangeLog][QtCore][QSemaphore] Fixed a regression that would make
tryAcquire() not to wait forever if the timeout was a negative
value. Note: new code is advised to only use -1 to indicate "forever",
as some other functions taking timeout periods do not accept other
values.
Task-number: QTBUG-64413
Change-Id: I57a1bd6e0c194530b732fffd14f58fce60d5dfc9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This brings us to almost parity with the C++11 Random Engine API
requirements (see chapter 26.5.1.4 [rand.req.eng]). We don't implement
the templated Sseq requirements because it would require moving the
implementation details to the public API. And we don't implement the
<iostreams> code because we don't want to.
Change-Id: Icaa86fc7b54d4b368c0efffd14f05ff813ebd759
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Since we don't document how many bytes one needs (it's 2496), it's
difficult for the caller to provide just enough data in the seed
sequence. Moreover, since std::mt19937 doesn't make it easy to provide
the ideal size either, we can't actually write code that operates
optimally given a quint32 range either -- we only provide it via
std::seed_seq, which is inefficient.
However, we can do it internally by passing QRandomGenerator to the
std::mersenne_twister_engine constructor, as it's designed to work.
Change-Id: Icaa86fc7b54d4b368c0efffd14f0613c10998321
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Now only QRandomGenerator::system() will access the system-wide RNG,
which we document to be cryptographically-safe and possibly backed by a
true HWRNG. Everything else just wraps a Mersenne Twister.
Change-Id: I0a103569c81b4711a649fffd14ec8cd3469425df
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Since we're adding a deterministic generator that inherently does not
use syscalls, and people should really use that one by default, there is
no point in optimizing the secure generator wrt syscalls. Besides,
keeping the random data in memory for longer than needed is likely
inadviseable.
Change-Id: Ib17dde1a1dbb49a7bba8fffd14ed0871117fe930
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
To obtain "proper" directory behavior, we have to check against the
extracted "resources" directory instead of its qrc counterpart.
Change-Id: I4996ba74419945f78d356ad953a5b826ff663687
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
To obtain the file's handle, we need to obtain it from the extracted
test data instead of qrc.
Change-Id: I89c5c3f3a7da7e36205a439581a6d83efffdc07c
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Resource files are extracted to m_dataDir in tst_QFile::initTestCase.
Instead of trying to access the file from the resource on systems that
use qrc for bundling the test data, we have to use the files that were
extracted at the beginning of the test.
Change-Id: I35453fbdeb27e317d1342ff1cb7bbea9cebea14d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
On some platforms (like UWP) files that are copied during
qfile auto tests are not writable by default. The cleanup will fail for
these files if the permissions are not set accordingly.
Change-Id: Id925dcadfc6b505c87f1f55d5ea05e286b60a5a5
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The vast majority is actually switched to QRandomGenerator::bounded(),
which gives a mostly uniform distribution over the [0, bound)
range. There are very few floating point cases left, as many of those
that did use floating point did not need to, after all. (I did leave
some that were too ugly for me to understand)
This commit also found a couple of calls to rand() instead of qrand().
This commit does not include changes to SSL code that continues to use
qrand() (job for someone else):
src/network/ssl/qsslkey_qt.cpp
src/network/ssl/qsslsocket_mac.cpp
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The milli-seconds since epoch value for an invalid transition is,
of course, invalidMSecs(), not invalidSeconds().
Added a comment while I was at it, explaining why we expect a
transition before the epoch, if such transitions are supported.
Change-Id: I0f376f9d69c0e6e79a309dc011943baa41175135
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
ultrix and reliant have not seen a release since 1995. dgux not since
2001. bsdi not since 2003. irix not since 2006. osf not since 2010.
dynix... unclear, but no later than 2002. symbian needs no mention.
All considered obsolete, all gone.
sco and unixware are effectively obsolete. Remove them until someone
expresses a real need.
Change-Id: Ia3d9d370016adce9213ae5ad0ef965ef8de2a3ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This
header file is a convenient staging area for helper APIs, eventually
some could be moved to public QTest API.
This header file utilizes the same pattern as other qtestlib header
files - wrapping functions with QT_${LIBNAME}_LIB to automatically
enable certain APIs based on what is in the projects dependencies,
e.g. QT += widgets.
Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Discussed during Qt Contributor Summit 2017. We concluded that we don't
want to make these functions public, as they do not follow Qt coding
style API. Specifically,
qStartsWith(a, b)
is not easily understood which argument is the needle and which argument
is the haystack (same problem memcpy() has). Compare that to
a.startsWith(b)
which can clearly be read in English as a subject-verb-object sentence.
This commit removes the unit tests that called compare().
Discussed-on: http://lists.qt-project.org/pipermail/development/2017-October/031060.html
Change-Id: Icaa86fc7b54d4b368c0efffd14ee6205eb9043fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Right now,this does really nothing. This commit is just to allow us to
transition the other modules (besides qtbase) to use the syntax that
will become the API.
I've marked three places to use the system CSPRNG:
1) the QHash seed
2) QUuid
3) QAuthenticator
I didn't think the HTTP multipart boundary needed to be
cryptographically safe, so I changed that one to the global generator.
Change-Id: Ib17dde1a1dbb49a7bba8fffd14ecf1938bd8ff61
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Open failures due to sharing violations have been observed in Coin.
Change-Id: If7fbe01a454b3c343c0b87f73db50c28eae901c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Guard the FILE * obtained by fopen() by a RAI class ensuring
the file is closed on destruction.
Change-Id: I9297f91ca2120238f3a44bad92bca5f920e01aa8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
There were a couple of corner cases where doing setPort() would result
in QUrl thinking that an authority was not present. Since the full URL
parsing implies that a host is always present if the authority is
present, then we also imply that setting the port number makes the host
be present too.
Change-Id: I69f37f9304f24709a823fffd14e67c12da18d69f
Reviewed-by: David Faure <david.faure@kdab.com>
The previous version was good, just not optimal. Because the input was
an unsigned 64-bit number, compilers needed to generate extra code to
deal with HW instructions that only convert 64-bit signed input. And
that was useless because a double uniformly distributed from 0 to 1 can
only have 53 bits of randomness.
The previous implementation did exactly what the Microsoft libstdc++ and
libc++ implementations do. In my opinion, those implementations have an
imperfect distribution, which is corrected in this commit. In those, all
random input bigger than 0x20000000000000 has a different frequency
compared to input below that mark. For example, both 0x20000000000000
and 0x20000000000001 produce the same result (4.8828125e-4).
What's more, for the libc++ and MSVC implementations, input between
0xfffffffffffff001 and 0xffffffffffffffff results in 1.0 (probability 1
in 2⁵³), even though the Standard is very clear that the result should
be strictly less than 1. GCC 7's libstdc++ doesn't have this issue,
whereas the versions before would enter an infinite loop.
Change-Id: Ib17dde1a1dbb49a7bba8fffd14eced3c375dd2ec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>