Change copyrights and license headers from Nokia to Digia
Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
qUncompressCorruptedData() no longer hangs on QNX 650 and Blackberry OS
sytems.
Change-Id: Id131f9f1c6dcd358c152675c7e29ab937052c1d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.
Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This extension doesn't work for e.g. default arguments
in function declarations.
Change-Id: I32b7afa6e01b6af55fb2409179b4fd94cb04cd8d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This operation should be a no-op anyway, since at this point in time,
the fromAscii and toAscii functions simply call their fromLatin1 and
toLatin1 counterparts.
Task-number: QTBUG-21872
Change-Id: I38f97ad379deafebef02c75d611343ca15640c8a
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these
functions just to avoid an include, except to pay for it with worse runtime
performance.
On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15%
faster(!) than adding an additional call to qMemSet. The advantage on sizes
above that is unmeasurable.
For qMemCopy, the benefits are a little more modest: 16-7%.
Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: John Brooks <john.brooks@dereferenced.net>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Two equal QByteArrays must return the same hash.
Change-Id: Iddd45b0c420213ca2b82bbcb164367acb6104ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This uses an alternative approach to the testing formerly introduced
in 4ef5a626. Zero-termination tests are injected into all QCOMPARE/QTEST
invocations. This makes such testing more thorough and widespread, and
gets seamlessly extended by future tests.
It also fixes an issue uncovered by the test where using a past-the-end
position with QString::insert(pos, char), could move uninitialized data
and clobber the null-terminator.
Change-Id: I7392580245b419ee65c3ae6f261b6e851d66dd4f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
The approach used to verify for zero-termination is too intrusive and
requires additional maintenance work to ensure new zero-termination
tests are added with new functionality.
Zero-termination testing will be re-established in a subsequent commit.
This reverts commit 4ef5a6269c.
Change-Id: I862434a072f447f7f0c4bbf8f757ba216212db3c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
There were two constuctors offering essentially the same functionality.
One taking the QStatic*Data<N> struct, the other what essentially
amounts to a pointer wrapper of that struct. The former was dropped and
the latter untemplatized and kept, as that is the most generic and
widely applicable. The template parameter in the wrapper was not very
useful as it essentially duplicated information that already maintained
in the struct, and there were no consistency checks to ensure they were
in sync.
In this case, using a wrapper is preferred over the use of naked
pointers both as a way to make explicit the transfer of ownership as
well as to avoid unintended conversions. By using the reference count
(even if only by calling deref() in the destructor), QByteArray and
QString must own their Data pointers.
Const qualification was dropped from the member variable in these
wrappers as it causes some compilers to emit warnings on the lack of
constructors, and because it isn't needed there.
To otherwise reduce noise, QStatic*Data<N> gained a member function to
directly access the const_cast'ed naked pointer. This plays nicely with
the above constructor. Its use also allows us to do further changes in
the QStatic*Data structs with fewer changes in remaining code. The
function has an assert on isStatic(), to ensure it is not inadvertently
used with data that requires ref-count operations.
With this change, the need for the private constructor taking a naked
Q*Data pointer is obviated and that was dropped too.
In updating QStringBuilder's QConcatenable specializations I noticed
they were broken (using data, instead of data()), so a test was added to
avoid this happening again in the future.
An unnecessary ref-count increment in QByteArray::clear was also
dropped.
Change-Id: I9b92fbaae726ab9807837e83d0d19812bf7db5ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For data allocated and maintained by QByteArray, there's a guarantee
that data() is null-terminated. This holds true even for null and empty,
where logically the terminating character should never be dereferenced.
For tests that modify or generate QByteArrays, this ensures the
invariant is kept.
In the toFromHex() text, const-ness of temporary variables was dropped
to enable the test macro to be used, as the qualification didn't add
much to the test otherwise.
Change-Id: I7ee52e79e3a9df7de18c743f3698dab688e6bf0e
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Copy the unit tests that related to percent-encoding to
tst_qbytearray.cpp and use public functions to execute
QUrl::fromPercentEncoded and QUrl::toPercentEncoded.
Change-Id: I6639ea566d82dabeb91280177a854e89e18f6f8d
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: David Faure <faure@kde.org>
Internally we construct QByteArrays from QStaticByteArrays. For example
moc is generating QStaticByteArray structure for every string it saves.
New test cases check if a QByteArray constructed from a QStaticByteArray
behaves as a not statically constructed one.
Change-Id: Ia4aa9a1a5bc0209507636c683a782dda00eae85c
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
It used to be an index into the first element in 'd' that came after
'offset'. It is now the byte offset from the beginning of the
QByteArrayData structure.
By no longer using an actual array to access characters, we also steer
clear of GCC bug #43247:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247
This aligns this data structure with QArrayData. The intention is to
have QVector, QString and QByteArray share the same memory layout and
possibly code.
Change-Id: I8546e5f51cd2161ba09bd4ada174b7f5e6f09db7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qAllocMore is used by growing containers to allocate additional memory
for future growth. The previous algorithm would grow linearly in
increments of 8 up to 64 and then progress exponentially in powers of
two.
The new (constant time) algorithm does away with the linear segment and
always progresses exponentially. It also has the nice benefit of cleanly
avoiding undefined behaviour that the old implementation tried hard to
circumvent.
Besides always progressing exponentially, the next-power-of-two
algorithm was tweaked to always include space for growth. Previously
queries at boundary values (powers of two) would return the same value.
The test was updated to verify sanity of results. As the algorithm is
well behaved, testing of bogus data was dropped. Whatever happens in
those cases is irrelevant, anyway: the bug lives elsewhere.
Change-Id: I4def473cce4b438734887084e3c3bd8da0ff466b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
- Marked four tests insignificant due to failures, these need to be
fixed later and then re-enabled:
- tst_qfilesystemwatcher
- tst_qsettings
- tst_qlibrary
- tst_qsharedpointer
- Skipped one invalid case (tst_QCoreApplication::argc())
- Ifdeffed around vsprintf issue in MSVC (tst_QByteArray::qvsnprintf())
Task-number: QTBUG-24157
Task-number: QTBUG-24146
Task-number: QTBUG-24128
Change-Id: I4db957a65fbf0093f5ae3dc1a04d792492818104
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
QByteArray is declared as movable but it was not tested before.
Change-Id: I4fb636f8705c3fd792a768872206203ee5fd4ddb
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.
Change-Id: I311e001373776812699d6efc045b5f742890c689
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
, as those are going away.
The comment in QString/QByteArray::squeeze about shared_null was updated as it
also affects other static data, such as that generated by QStringLiteral and
QByteArrayLiteral.
Change-Id: I26a757d29db62b1e3566a1f7c8d4030918ed8a89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
These comments were mostly empty or inaccurate. Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.
Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
In .pro files, removed wince/symbian-specific DEPLOYMENT cases and
replaced them with TESTDATA where appropriate.
In .cpp files, removed SRCDIR and relative paths to testdata and
replaced them with the QFINDTESTDATA macro where appropriate.
Modified test helper apps/libs to install themselves under the test
they relate to.
This change allows corelib tests to be correctly installed, along with
their testdata, via `make install'.
Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Rename the qUncompress test to make clear that the test only deals with
uncompressing corrupted data and add a message making it clear that this
test will produce some warning messages.
Don't skip creating the test data, as that prevents the test output
reporting exactly what is skipped.
The expected output is the same for every row (an empty QByteArray), so
don't bother storing that in the data table.
Change-Id: I59f1cc91a941bcaadacb2a613dd5eca2564961c1
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Remove references to the old bug tracker. The data from the old bug
tracker is no longer accessible, so these markers are meaningless.
Change-Id: Ib9d029d52b70fd0a512b9532d65f03763eabfe57
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The restored code was inexplicably commented-out by commit d57aec33
(non-public history), which was only supposed to be changing upper-case
booleans to lower-case.
Change-Id: I1581fc89511f600c614871e1aec6bc030cddf40e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The moc tool is not aware of all defines (particularly those that are
compiler builtins) and does not correctly evaluate others that depend
on compiler builtins, such as Q_OS_FOO.
This commit reverts parts of the following commits, but is not a
complete fix as there were many instances of this problem in the tests
prior to those commits:
924d810dbd8aaff67510338d3f1197a55034062b253497b7447cfad460c59d2ff58f360cf6baa2d6
Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Remove various disabled and/or non-helpful debugging code.
Any test diagnostics that are useful should be part of the regular test
output, as the CI system cannot switch on commented-out code when there
is a test failure. Diagnostics should also be informative -- simply
printing the value of a variable with no other information about what is
being printed (or why it is being printed) is not informative.
Change-Id: I21a6c2121be86001bb57e80f426507b6e619ee9e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Instead of creating slots depending on certain defines,
these defines should be checked inside the slots.
Moc may not be aware of all defines (e.g. compiler
specific ones) and thus (not) create slots according
to the condition given.
Change-Id: I50495444b8f468ec131e6a0937e18803a8077758
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
qttest_p4.prf was added as a convenience for Qt's own autotests in Qt4.
It enables various crufty undocumented magic, of dubious value.
Stop using it, and explicitly enable the things from it which we want.
Change-Id: I7c1ffe9c8c294dbdc988e1582e580b1ed3f4593e
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
QSKIP is intended to be used to skip test functions that are found at
run-time to be inapplicable or unsafe. If a test function can be
determined to be inapplicable at compile-time, the entire test function
should be omitted instead of replacing the body of the test function
with a QSKIP, which only serves to slow down test runs and to inflate
test run-rates with empty, inapplicable tests.
Task-number: QTQAINFRA-278
Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9
Reviewed-on: http://codereview.qt-project.org/5942
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Symbian is not a supported platform for Qt5, so this code is no longer
required.
Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa
Reviewed-on: http://codereview.qt-project.org/5657
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
These functions should not take care not to unconditionally set the
capacityReserved private member, since the d may be referencing the
const shared_null or shared_empty which live in read-only memory.
The squeeze() methods check for ref > 1 instead of ref != 1 to prevent
detaching from the shared_null/shared_empty unnecessarily; the
shared_null/shared_empty ref count is -1, meaning squeeze() will never
detach from it.
Change-Id: Id3f1725a6f08b3a462343640a47bbe78f08ca7e7
Rubberstamped-by: Lars Knoll
Reviewed-on: http://codereview.qt-project.org/5454
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>