QReg*Exp*s can be compared for equality,
so qHash should be overloaded, too.
There was a (poor) private implementation of qHash(QRegExpEngineKey)
already, which has now been replaced with a better one (the old one
didn't take into account all the fields that make up equality,
producing unnecessary collisions).
[ChangeLog][QtCore][QRegExp] Added qHash(QRegExp).
[ChangeLog][QtCore][QRegularExpression] Added qHash(QRegularExpression).
Change-Id: I1d22fbcc0508018a3f94b4c24571b13ba6e07df2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
QVectors can be compared for equality, so qHash should be overloaded, too.
[ChangeLog][QtCore][QVector] Added qHash(QVector).
Change-Id: I2aacce55d416abf2492631a504a02c6e8fc4ff1c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QLists can be compared for equality, so qHash should be overloaded, too.
[ChangeLog][QtCore][QList] Added qHash(QList).
Change-Id: I9ad91811f12479764cc17d87192539612ceb0b4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Add an ordinary peek() function which also allows retrieving data from
a specified position. We need this functionality in several places.
Change-Id: Ia4a1b6fe1d7f76cb8f6f1ea34b3e4b89e05a2a68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
std::vector has them, too.
[ChangeLog][QtCore][QVarLengthArray] Added relational operators <, <=, >, >= if the element
type supports operator<.
Change-Id: I69e16d361fd4738a56b292ebfa78316d28871eda
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
std::vector has them, too.
[ChangeLog][QtCore][QList] Added relational operators <, <=, >, >= if the element
type supports operator<.
Change-Id: Id2bd905e92c0365ad9f439d49908045c8df309c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QString::append(QStringRef) exists, and so should prepend().
QString::append(const QChar *,int) exists, and so should prepend().
[ChangeLog][QtCore][QString] Added prepend(QStringRef) and prepent(const QChar *, int) overloads.
Change-Id: I3eca41045f7c481be473507e23e92690f3ed7ba3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
... using the framework developed for testing QString::append.
Change-Id: I29011eba6438bf9b3daad354cbec4b8e2b98ed81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is tedious to test all the overloads of QString::insert,
so get the help of the compiler to do it. The framework
was originally developed for testing append.
This change showed that the insert(int, QStringRef),
insert(int, const char*) and insert(int, QByteArray)
overloads were missing. They will be added in a separate
commit.
Change-Id: I609b8a05203f8a1ea12827d1798313ace5b719f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is tedious to test all the overloads of QString::prepend,
so get the help of the compiler to do it. The framework
was originally developed for testing append.
This change showed that prepend(QStringRef) and
prepend(const QChar*, int) overloads were missing. They will
be added in a separate commit.
Change-Id: Ic3d6ad011bedc6ee7d5024094d7c3529b1b9d669
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is tedious to test all the overloads of QString::append(),
so get the help of the compiler to do it. The framework
developed for this will be used in subsequent commits for
prepend and insert, too.
Change-Id: I89df581b6d037a5af80b34dd6b5d37ac7484c774
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unearthed an off-by-one error in a QByteArray::fromRawData() call in
tst_qtextdocumentfragment. Fixed by porting to QStringLiteral.
[ChangeLog][Important Behavior Changes] All conversions from QByteArray
to QString now preserve embedded NULs. This is done in order to provide a
faster conversion from QByteArray to QString that does not involve a call to
strlen. If you need the old behavior, convert from QByteArray::constData()
instead. If you are porting from Qt 4, we suggest to make your source compile
with QT_NO_CAST_FROM_BYTEARRAY before porting to Qt 5.
Change-Id: Ibca40f503920fee6f3a5f0d74a04b38b8849796f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Currently, calling these functions with a null QByteArray will return
a non-null QString because QByteArray::data() never returns nullptr.
This behavior leads to inconsistencies between QString::append overloads,
in particular the QByteArray vs. all others (null + null test always
returns a null QString, except for the QByteArray overload before this
change).
It also is inconsistent with the const char* overloads of these methods,
which explicitly preserve nullness (as verified by test cases).
Fixed by an explicit check for nullness and return of null QString.
Alternative would have been to check for nullness and pass nullptr
instead of ba.data() to the _helper() functions, which do the correct
thing in that case. But since we'd have the check anyway and with the
chosen strategy we can avoid a call to a non-inline method, I opted
against that.
[ChangeLog][QtCore][QString] fromLatin1(), fromAscii(), fromUtf8() and
fromLocal8Bit() now return a null QString when called with a null
QByteArray.
Change-Id: I5f2c0bad27fb73c7d535085af0271823bf6ed1da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
std::vector has them, too.
[ChangeLog][QtCore][QVector] Added relational operators <, <=, >, >= if the element
type supports operator<.
Change-Id: I0bcb22dfcc43cb0362f17b4e06154ce18646580a
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Two new function families have been added: qFindFirstSetBit() and
qFindLastSetBit() for a variety of integer sizes. Fast implementations
are included for most platforms.
[ChangeLog][QtCore][QtAlgorithms] Added qFindFirstSetBit() and
qFindLastSetBit().
Change-Id: I89d9d1637ea26070aee5a60be95be1b51bfc84dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a dedicated operator=(std::initializer_list) that
first resizes the QCLA, and then replaces the elements
one by one.
This should be usually faster than creating a temporary
QCLA and then copying it, except for the case where the
new array does not fit into the allocated stack - but this
is IMO nothing to optimize for.
Task-number: QTBUG-45041
Change-Id: I147d6d01186b1ca3c635b2c8365d8f6e638ce6fe
GPush-Base: 08de3113051e1289f0de0651ec5647c9ee6feb27
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
+ A bunch of fixes in the locale data
+ New scripts from Unicode 7.0
+ New locales
- Some locales disappeared (aa_DJ, aa_ER, st_LS, ss_SZ, swc_CD, tn_BW)
- Some locales lost their contents (i.e. en_Dsrt_US)
[ChangeLog][QtCore] QLocale data updated to CLDR v.27
Change-Id: Iba8c7884f8087e577cbb25a8fc106dd7bd3ebb5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Two newly adopted currency symbols:
the Azerbaijan manat and the Russia ruble
* Pictographic symbols (including many emoji), geometric symbols,
arrows, and ornaments originating from the Wingdings and Webdings sets
* Twenty-three new lesser-used and historic scripts
extending support for written languages of North America, China, India,
other Asian countries, and Africa
* Letters used in Teuthonista and other transcriptional systems,
and a new notational set, Duployan
For more details, see http://www.unicode.org/versions/Unicode7.0.0/
The Properties struct's .*Diff members were narrowed down
to signed 15 bits and the unicodeVersion has been expanded to 8 bits.
[ChangeLog][QtCore] Unicode data updated to v.7.0
Change-Id: I93ab6f79fa3b05f61abc7279f1d046834c1c1a0b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Implement an initializer_list constructor, which was probably
just forgotten so far. Technically this is a SC incompatible change,
since
QVarLengthArray<int> array = {10};
will now create an array with one element 10, instead of an empty array
with a reserved size of 10. Anyhow, keeping the inconsistency with the
STL / other Qt containers here would certainly do more harm than good
in the long run.
Task-number: QTBUG-45047
Change-Id: I4675880f93e141181250939942fa32300916b0e3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Since Qt 5.0, static overloads of QChar has a uint parameter only,
so there is no more ambiguity between uint<->ushort and thus some tests
does not make sense anymore; avoid explicit cast to uint for the others.
Change-Id: Ibc7a2ac4de63d3f023a8dbb5e53211ef8521579d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This system is no longer in the CI rotation and we haven't had reports
of the same issues happening on later versions. Either the issues have
since been fixed or they were never an issue in Qt in the first place.
This commit has the additional benefit of getting rid of the following
shell error when qmake was run:
sh: line 0: [: =: unary operator expected
as /etc/lsb-release hasn't contained DISTRIB_CODENAME for some time and
proper quoting was never implemented (not even qtcpsocket.pro).
Change-Id: Ia0aac2f09e9245339951ffff13c829e910ee64e9
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Properly QSKIP tests that use disabled QProcess and symlink
features instead of excluding them silently by #ifdef.
Other reason is that moc doesn't respect QT_NO_* defines
in class definition which causes build issues on some
platforms.
Change-Id: I041020f7452f7d36c7ec8a5866a4ba5eb23d1f94
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
According to I/O API, QIODevice and its inherited classes should be
able to process a full 64-bit offsets and lengths. This requires
64-bit parameters in operations with internal buffers. Rework
QRingBuffer to avoid implicit truncation of numbers and fix some
64-bit issues in code.
Change-Id: Iadd6fd5fefd2d64e6c084e2feebb4dc2d6df66de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The existing check fails to detect the case where white space characters
other than the space character are replaced by space characters
without the length actually changing and returns the original string.
Task-number: QTBUG-44936
Change-Id: Ice6faa975f8b41f185c76f6d0d4ff81603e25eb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Let's not try to to compare our QTimeZone handling with the system one.
Our handling goes beyond the range of the POSIX APIs, so that's a recipe
for error.
Change-Id: Iee8cbc07c4434ce9b560ffff13ca4a4f335bdbae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
The refactoring from a8c74ddcf7 commit
exposed more issues in the Windows API. There were already quite a few
QEXPECT_FAIL for this, so this isn't new.
For example, localtime(1351386000) on the Central European Timezone
should be "Sun Oct 28 02:00:00 CET 2012" (the second occurrence of 2
am), but the Windows API returns tm_isdst = 1 (i.e., still in the CEST
timezone) and that's incorrect.
Change-Id: I1bc63ac99b1d67b55d783f9606e5c59b24223b13
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
In QtScript we use the msecs since epoch conversion (JS date is based on
the concept). After a8c74ddcf7 the date
conversion test in qtscript started to fail. Instead of relying on the
code working by chance, simply update the date when setting it with
setMSecsSinceEpoch.
Task-number: QTBUG-44885
Change-Id: I9f95c9cdccea52e7d1f808f3cb9e18570ef0df13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Otherwise, we modify shared strings that happened to be rvalues.
Task-number: QTBUG-44706
Change-Id: Ia0aac2f09e9245339951ffff13c85bfc912f03d1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
When timezone support for QDateTime was added, we decided it was a good
idea to delay creating the QTimeZone object and checking that the time
is valid in that timezone (including for local time) until the user
requested that information. Unfortunately, QExplicitlySharedDataPointer
returns a non-const T* in operator->(), which meant we were accidentally
modifying the d pointer's contents in const methods, which in turn means
those const methods were not thread-safe when operating on the same
object.
This commit changes the d pointer to QSharedDataPointer, which is safer
in this regard and pointed out where the issues with constness were
located. Since we can't lazily calculate QTimeZone anymore, we need to
do it whenever the date, time or offset changes.
Task-number: QTBUG-43703
Change-Id: Ic5d393bfd36e48a193fcffff13b9686ef4ef1454
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The new mode, ParseAsPositionalArguments, allows to interpret
"application argument --opt" as having two positional arguments,
"argument" and "--opt".
This mode is useful for executables that aim to launch other executables
(e.g. wrappers, debugging tools, etc.) or who support internal commands
followed by options for the command. "argument" is the name of the command,
and all options occurring after it can be collected and parsed by another
command line parser, possibly in another executable.
[ChangeLog][QtCore][QCommandLineParser] Add parsing mode for options
after arguments, to allow treating them as more arguments.
Change-Id: I48d5fcf90f2f59deda8422538b8ebf2680fae828
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
[ChangeLog][QtCore][QCommandLineParser] Added support for hiding options
from the --help output, with QCommandLineOption::setHidden(true).
Task-number: QTBUG-44298
Change-Id: I62cc2a55428365c0bcc79d2e47c72c0c92104e74
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Those QTimeZones failed to convert to other timezones because the data()
virtual function was never overridden and reimplemented. That meant all
QUtcTimeZonePrivate objects were *really* UTC, with no offset.
Task-number: QTBUG-44600
Change-Id: Ia0aac2f09e9245339951ffff13c5294bb783c674
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The c2m() function which converts a const_iterator into an iterator
is a broken concept for an implicitly shared container such as
QVector, because the act of calling begin() as the starting
point already detaches and invalidates the c2m argument.
This could be fixed in c2m, but the bug wasn't even in c2m,
but in removeAll(), which called end() before c2m, so the c2m
argument was already invalidated when entering c2m.
The solution is to store the positions as indices instead of
iterators before calling the first detaching function.
Task-number: QTBUG-44592
Change-Id: I66cf4f1277e71148a4d5b5bbfb6a3369ad02db68
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Add one tag class for each of QList's three different memory layouts
to QListData, and inherit QList<T>::MemoryLayout from exactly one of
them.
To simplify overloading, added tag classes that express the negation
of the two extreme poles of memory layout (C-compatible and heap),
too. The "missing" one could be added when needed, too.
Change-Id: I45ea603731499fd3fdfb37d60a0a98fb22ac15ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The Movable type, surprisingly, was as large as sizeof(void*), so on
32-bit platforms, we were not testing the QList memory layout where
items are placed directly into the void*-slots, but are too small,
leaving gaps.
Fixed by making sure that Movable is smaller than void* and adding
a variant of Movable, Optimal, that is guaranteed to be the same
size as void*, and replacing the int tests with tests of Optimal.
Had to demote the State variable to uchar, since MSVC will apparently
not make a collection of bit-fields smaller than the largest type used
in any of the consituent bitfields, so State s : 8 wouldn't work.
Change-Id: I4f0e24bd6928f076b4ce60e8d977d5d98a724161
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>