qt5base-lts/tests/auto
João Abecasis a959f34d71 Clean up constructors for "statics" in QString and QByteArray
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>
2012-04-04 23:29:37 +02:00
..
compilerwarnings/data Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
concurrent Remove commented code from qtconcurrentmap autotest. 2012-03-14 07:51:45 +01:00
corelib Clean up constructors for "statics" in QString and QByteArray 2012-04-04 23:29:37 +02:00
dbus Don't hardcode the order of elements in QHashes 2012-03-28 04:07:16 +02:00
gui Merge master into api_changes 2012-03-27 19:22:48 +02:00
guiapplauncher Update the documentation after moving examples. 2011-07-05 21:19:08 +02:00
network Port to the new QUrl API 2012-03-30 01:19:59 +02:00
opengl EGLFS: Integrate building into configure. 2012-03-21 03:03:29 +01:00
other Port to the new QUrl API 2012-03-30 01:19:59 +02:00
printsupport QPrinterInfo: remove a test that is too early 2012-03-24 17:07:52 +01:00
shared Refactor input context tests 2012-02-22 13:54:13 +01:00
sql Fix compilation of tst_QSqlThread: no need to use QBasicAtomicInt here 2012-03-24 17:07:52 +01:00
testlib Add a remainingTime() method to the public interface of the QTimer class 2012-04-03 15:10:05 +02:00
tools Stop relying on QHash ordering 2012-04-03 23:56:10 +02:00
widgets Remove WA_PaintOutsidePaintEvent 2012-03-28 11:22:11 +02:00
xml Stop relying on QHash ordering 2012-04-03 23:56:10 +02:00
auto.pro Disable some tests and examples when --no-widgets is specified 2012-03-19 20:16:04 +01:00
network-settings.h Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
platformquirks.h Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
test.pl Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00