Commit Graph

150 Commits

Author SHA1 Message Date
Tor Arne Vestbø
b88573e29b Collate conversion functions for Core Foundation/Foundation types
Makes it easier to apply similar changes across all related functions,
and to implement functions for new types by having the previous
approaches available in one place.

Change-Id: I3f0590d67d0e6deb1c6c856ab1de96b55b6af058
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-19 11:20:36 +00:00
Friedemann Kleint
7fc2864dc5 QtCore: Remove Windows CE.
Remove QSysInfo::WV_CE_5/6 enumeration values, #ifdef sections for Q_OS_WINCE
and wince .pro file clauses in library, examples and tests.

Task-number: QTBUG-51673
Change-Id: Ib63463445f3a26e04d018b193e4655030002f5f9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-30 11:22:47 +00:00
Liang Qi
0a1af55a9b Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-01-26 11:27:37 +00:00
Thiago Macieira
cfe891eeb8 Add Intel copyright to files that Intel has had non-trivial contribution
I wrote a script to help find the files, but I reviewed the
contributions manually to be sure I wasn't claiming copyright for search
& replace, adding Q_DECL_NOTHROW or adding "We mean it" headers.

Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 22:44:21 +00:00
Jani Heikkinen
f776595cc1 Updated license headers
From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some
exceptions, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one
(in those files which will be under GPL 3 with exceptions)

Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-21 18:55:18 +00:00
Liang Qi
158a3a4159 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qiodevice_p.h
	src/corelib/kernel/qvariant_p.h
	src/corelib/tools/qsimd.cpp
	src/gui/kernel/qguiapplication.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp

Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
2016-01-21 08:17:21 +01:00
Marc Mutz
08775e4bd7 Revert "QString: preserve embedded NULs when converting from QByteArray"
This partially reverts commit e486d69133.
It broke too many users, even though all of them deserved to be broken.
The new functionality will be provided by differently-named functions,
where possible (problem: equality operators).

I did not revert the fix for the off-by-one error in
tst_qtextdocumentfragment.cpp.

I also didn't revert the change in the inequality relational operators,
since for all strings s1, s2 and s2' where s2' is s2 truncated at the
first NUL, s1 < s2 ⟺ s1 < s2' (since NUL < c for any c != 0), and,
trivially, for ≤, >, ≥, too. This does not hold for = and ≠, of course,
since "foo\0bar" ≠ "foo".

[ChangeLog][Important Behavior Changes][EDITORIAL] Reverted: All
conversions from QByteArray to QString now preserve embedded NULs...

Change-Id: If4b47048b39ae5be6ed08e6d91809626a67ea7f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-12 06:13:05 +00:00
Marc Mutz
8f166ccf40 QString: add resize(int, QChar)
This will be used in QTextStream to speed up padding processing.

[ChangeLog][QtCore][QString] Added resize(int, QChar) overload.

Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-28 09:14:59 +00:00
Liang Qi
beb65dcd79 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/gui/painting/painting.pri
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
	tests/auto/corelib/tools/qlocale/test/test.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
	tools/configure/environment.cpp

Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
2015-12-18 08:37:31 +01:00
Marc Mutz
6de49f4ab6 QString: where possible, re-use existing capacity in op(QChar/QL1S)
If the LHS is detached and has existing capacity that is large
enough to hold the RHS, re-use the memory instead of allocating
a new buffer and throwing away the old.

Change-Id: I53d42825da92c264c7301e8e771cba9fb35c321b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-08 23:48:12 +00:00
Marc Mutz
1005b7a0de Long live qUtf16Printable()
QString::asprintf() has the ability to take a ushort* array as
obtained from QString::utf16() and insert that into the output
with an %ls conversion.

But no-one ever used this, because just passing QString::utf16()
to QString::asprintf() creates a warning about wchar_t* expected,
but ushort* provided.

The new qUtf16Printable() macro adds the necessary casts (via void*
to prevent any "type-punned pointer" warnings) to make
passing QString::utf16() to QString::asprintf() work silently.

This should greatly reduce the need to do a round-trip via utf-8
just to print the contents of a QString.

[ChangeLog][QtCore] Added qUtf16Printable().

Change-Id: I7ddd8d2b2a2191c9faa26aca95d49850d94b287c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-11-21 14:25:55 +00:00
Marc Mutz
ceb71d5b3f tst_QString: add checks for sprintf's %ls
... at the cost of a bunch of warnings about
ushort*/wchar_t*.

It wasn't checked at all, which isn't really a solution,
either.

Split off the %s checks into a separate function, which
makes obvious the sorry state of sprintf non-%s, non-%d
testing that's left.

Change-Id: I6312f984bacfb568b609e34b5218b3ab9a9765c4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-20 11:09:34 +00:00
Liang Qi
c7934f2489 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess_unix.cpp
	src/network/kernel/qnetworkinterface_winrt.cpp
	tools/configure/configureapp.cpp

Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
2015-11-18 09:01:51 +01:00
Thiago Macieira
f29b6943f0 QString: Fix in-place toUpper/Lower when there's size expansion
When that happens, we need to detach (in-place conversion won't work),
so we recurse back into the same function, but the template version that
does detaching.

Task-number: QTBUG-49181
Change-Id: Idba8c29717f34c70a58fffff1412fea3acc95f98
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-18 00:30:40 +00:00
Ulf Hermann
8c2ca33073 Replace qdtoa and qstrtod implementation by a 3rdparty library
This also fixes the underlying cause of QTBUG-44039 and QTBUG-43885.

You can choose between system, qt, and no libdouble-conversion
support. If you choose "no", snprintf_l and sscanf_l will be
used.

By default, system double conversion is used if the system provides a
double-conversion library. Otherwise the bundled libdouble-conversion
is built. sscanf_l and snprintf_l are not used by default as the
planned "shortest" conversion mode to produce the shortest possible
string will give less precise results when implemented with snprintf_l.

Change-Id: I8ca08a0fca5c54cf7009e48e771385614f6aa031
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-11-02 17:00:50 +00:00
Friedemann Kleint
c4265fb1b8 tst_qstring: Enable previously disabled test for Q_CC_MINGW.
gcc 4.8 now supports all printf()-formats.

Change-Id: Idead5ff77c3825c642615eceed110c1252869e90
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-10-27 15:04:19 +00:00
Liang Qi
790aef362f Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	.qmake.conf
	configure
	src/corelib/global/qglobal.h
	src/tools/qdoc/node.cpp
	src/tools/qdoc/qdocdatabase.cpp
	tests/auto/corelib/io/qsettings/tst_qsettings.cpp
	tools/configure/configureapp.cpp

Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
2015-10-23 14:45:03 +02:00
Friedemann Kleint
456f721917 tests/auto/corelib: Remove some placeholder formatting.
Use QByteArray/QString addition instead in loops and for
test row names.

Change-Id: Ieffb429efdc14aa5932b3fcdef5a18e13a62d35f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-10-22 03:54:29 +00:00
Lars Knoll
3695285fde The C locale should omit group separators by default
Numbers formatted in the C locale should not use group
separators by default.

[ChangeLog][QtCore][QLocale] The C locale does not use group separators
when formatting numbers any more.

Task-number: QTBUG-4044
Task-number: QTBUG-3068
Change-Id: Ia647a72efc11fecd66d22f9253562b1d4ef58168
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-10-19 07:36:13 +00:00
Liang Qi
4456984da7 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	tests/auto/corelib/io/qfile/tst_qfile.cpp
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp
	tests/auto/corelib/tools/qversionnumber/qversionnumber.pro

Change-Id: Ia93ce500349d96a2fbf0b4a37b73f088cc505c6e
2015-10-14 15:45:35 +02:00
Friedemann Kleint
f0a559f1c8 Tests: Use QCOMPARE() with QLatin1String() for QString values.
Prefer QCOMPARE over QVERIFY for equality and use QLatin1String().

Change-Id: If226a0fc7b25be3e6774c7e36ca1e6f99234e5dd
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-10-14 08:32:42 +00:00
Friedemann Kleint
a2a00eb044 Tests: Fix single-character string literals.
Use character literals where applicable.

Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-10-13 18:14:27 +00:00
Liang Qi
d0eaa737e1 Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	qmake/doc/src/qmake-manual.qdoc
	src/corelib/tools/qstring.h
	src/gui/image/qimagereader.cpp
	src/network/access/qnetworkaccessmanager.cpp
	src/tools/qdoc/doc/examples/examples.qdoc
	src/widgets/accessible/qaccessiblewidgetfactory_p.h
	src/widgets/doc/qtwidgets.qdocconf

Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
2015-10-02 16:59:55 +02:00
Christian Kandeler
d24366a632 Fix comparisons between QByteArray and QString.
QByteArray::operator< and friends had their logic reversed.

Task-number: QTBUG-48350
Change-Id: I625209cc922b47e78dfb8de9fe100411f285a628
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-09-28 07:42:51 +00:00
Friedemann Kleint
76cf88157f Tests: Remove CONFIG += parallel_test.
The keyword no longer has a meaning for the new CI.

Change-Id: Ibcea4c7a82fb7f982cf4569fdff19f82066543d1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-05 07:16:50 +00:00
Marc Mutz
92d5733c78 QString: add {const_,reverse_iterator}, {c,}r{begin,end}()
Had to mark {,c,const}{begin,end}() inline, since they are, and mingw
complains about inconsistent dllimport attributes.

[ChangeLog][QtCore][QString] Added rbegin(), crbegin(), rend(), crend(),
and reverse_iterator and const_reverse_iterator typedefs.

Task-number: QTBUG-25919
Change-Id: I1d48729c76e510c1e49c0e5dc41691aa662fdf21
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-07 05:22:04 +00:00
Liang Qi
0aa2d318b1 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qglobal.h
	src/corelib/global/qsysinfo.h
	src/corelib/global/qsystemdetection.h
	src/corelib/kernel/qobjectdefs.h
	src/plugins/plugins.pro
	tests/auto/widgets/itemviews/qlistview/qlistview.pro

Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
2015-07-01 11:05:26 +02:00
Nico Vertriest
a7f2af0911 Replace MAC OS X with OS X
Task-number: QTBUG-46374
Change-Id: I7bc633ab551740bd328a24b0ccae1d534af47138
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-06-30 07:33:31 +00:00
Tor Arne Vestbø
5471413522 Add shared implementation of a NSAutoreleasePool wrapper to qglobal
We have at least 5 different (but equal) implementations of a wrapper
in Qt, and some code uses explicit NSAutoreleasePools. Having a shared
implementation lets us clean up things a bit and makes it easier to
reason about which pools are actually needed.

Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-27 18:45:29 +00:00
Marc Mutz
4bd81e0b82 Add missing QString::prepend(QStringRef)/(const QChar*,int) overloads
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>
2015-04-02 19:30:05 +00:00
Marc Mutz
2a15c83c90 Add QString::insert() overloads for QStringRef, const char*, QByteArray
The corresponding QString::append() overloads exists,
and so should insert().

[ChangeLog][QtCore][QString] Added insert(int, QStringRef),
insert(int, const char*) and insert(int, QByteArray).

Change-Id: I1cf43fe8908319e2a57415945718b72e69ca0fb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-04-02 19:29:54 +00:00
Marc Mutz
d543b1c3d4 tst_QString: refactor the op+= tests
... using the framework developed for testing QString::append.

Change-Id: I29011eba6438bf9b3daad354cbec4b8e2b98ed81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-04-02 19:29:30 +00:00
Marc Mutz
dd350ec2e7 tst_QString: refactor the insert tests
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>
2015-04-02 19:29:16 +00:00
Marc Mutz
5ba36ec29e tst_QString: refactor the prepend tests
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>
2015-04-02 19:29:04 +00:00
Marc Mutz
ec75c0f684 tst_QString: refactor the append tests
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>
2015-04-02 19:28:50 +00:00
Marc Mutz
e486d69133 QString: preserve embedded NULs when converting from QByteArray
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>
2015-04-02 19:28:31 +00:00
Marc Mutz
6f145707eb QString::from{Utf8,Latin1,Local8Bit}(QByteArray): preserve nullness of argument
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>
2015-04-02 19:28:18 +00:00
Friedemann Kleint
5930a2d314 Track modifications of white space in QString::simplified().
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>
2015-03-12 05:32:41 +00:00
Thiago Macieira
53ce0d1a31 QStringAlgorithms::simplified_helper: add missing check for detached
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>
2015-03-07 19:36:24 +00:00
Jani Heikkinen
cb95fff1c7 Fixed license headers
Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-02-17 18:46:09 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Outdated header.LGPL removed (use header.LGPL21 instead)

Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)

Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination

Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
2015-02-11 06:49:51 +00:00
Frederik Gladhorn
fc35f71434 Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
	src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
	src/gui/image/qimage_conversions.cpp
	src/gui/opengl/qopenglextensions_p.h
	src/gui/text/qtextengine.cpp
	src/network/ssl/qsslsocket_openssl.cpp
	src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
	src/plugins/platforms/eglfs/qeglfsscreen.cpp
	src/plugins/platforms/eglfs/qeglfswindow.cpp
	src/plugins/platforms/windows/qwindowsfontdatabase.cpp
	src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
	src/plugins/platforms/windows/qwindowsnativeinterface.cpp
	src/plugins/platforms/windows/qwindowsscreen.cpp
	src/plugins/platforms/windows/qwindowswindow.cpp
	src/plugins/platforms/windows/qwindowswindow.h
	src/plugins/platforms/xcb/qxcbdrag.h
	src/widgets/itemviews/qabstractitemview.cpp
	src/widgets/kernel/qwidget.cpp
	src/widgets/util/qsystemtrayicon_p.h
	tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp

Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp
conflicts.

Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
2015-02-10 09:42:25 +01:00
Erik Verbruggen
467c2bc9c3 Remove support for QT_QLOCALE_USES_FCVT.
We expect floating-point math to be IEEE754 compliant.

Change-Id: I2b257177f2ef5fce38ac4d8fd76f746dc7b9fc15
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-01-28 12:44:55 +00:00
Allan Sandfeld Jensen
dd07b1e389 Add conversion functions for C++11 u16string and u32string
The patch adds convenience functions for working on C++11's new char
width specific unicode strings u16string and u32string.

[ChangeLog][QtCore][QString] Added methods for convenient conversion
to and from std::u16string and std::u32string.

Change-Id: I67c082e4755c592d61daaaaa70c8867ef0b23dcb
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-01-24 11:50:13 +01:00
Allan Sandfeld Jensen
05feaeed43 Remove duplicated NAN/INF logic from tst_qstring
Qt already has solutions for cross platform isnan and isinf logic. We
should use that instead of duplicating it.

This should also fix compiling tst_qstring on MinGW with C++11.

Change-Id: I7b691fd47701a8f07e1a1fe08a95a0aca43ccca1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-01-21 10:54:22 +01:00
Morten Johan Sørvig
ee1afbb8aa tst_qstring_mac: Correct memory management.
The NSStrings return by QString::toNSString are autoreleased;
manually releasing them is not correct. The test still
works (no leaks or double deletes) since there is no
autorelease pool in place when running it.

We don't want to encourage incorrect usage: remove
the release call an add an autorelease pool.

Change-Id: Ic566fd3a8efd6cbc0eb6db850248a68bfc8fed0b
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
2015-01-20 05:47:16 +01:00
Thiago Macieira
1eb7005850 Use the new warning enabling/disabling macros in qtbase
Change-Id: I91ff06644e8047c2ca483f9768b46c1372eb6171
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2014-12-03 18:09:17 +01:00
Frederik Gladhorn
34aba4724f Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
	src/corelib/io/qiodevice.cpp
	src/plugins/bearer/linux_common/qofonoservice_linux.cpp
	src/plugins/bearer/linux_common/qofonoservice_linux_p.h
	src/plugins/platforms/android/qandroidplatformtheme.cpp
	src/tools/bootstrap/bootstrap.pro
	src/widgets/styles/qmacstyle_mac.mm

Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
2014-11-24 13:39:13 +01:00
Alex Trotsenko
6bded1695b Fix QString::section() behavior on negative and out-of-range indexes
Change-Id: I3bff6ba73b15ee810bb11b2902d11244c3205b2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-11-20 15:37:18 +01:00
Thiago Macieira
294c914eb6 Add rvalue-ref qualified {QString,QByteArray}::{simplified,trimmed}
Of the const overloads that return a QString or a QByteArray, this is
one that gains the most benefit. It happens often in constructs like:

    QByteArray s = x.readLine().trimmed();

After this change, 41 out of 103 calls to trimmed become rvalue in Qt
and 272 out of 441 in Qt Creator. For simplified, the numbers are 27 out
of 69 in Qt and 10 out of 19 in Qt Creator.

Other candidates are left, right, and mid, but there are exactly zero
uses of left, right and mid on an xvalue QString or QByteArray in Qt.

I'm being lazy and using qstring_compat.cpp to store the QByteArray
compat methods.

Change-Id: I4e410fc1adc4c761bb07cc3d43b348a65befa9f6
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-11-02 20:51:57 +01:00