qt5base-lts/tests/auto/corelib/tools
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
..
collections Update copyright headers 2015-02-11 06:49:51 +00:00
qalgorithms Adds qFindFirstSetBit() and qFindLastSetBit(). 2015-03-28 00:05:50 +00:00
qarraydata Update copyright headers 2015-02-11 06:49:51 +00:00
qarraydata_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qbitarray Update copyright headers 2015-02-11 06:49:51 +00:00
qbytearray Fixed license headers 2015-02-17 18:46:09 +00:00
qbytearraylist Update copyright headers 2015-02-11 06:49:51 +00:00
qbytearraymatcher Update copyright headers 2015-02-11 06:49:51 +00:00
qbytedatabuffer Update copyright headers 2015-02-11 06:49:51 +00:00
qcache Update copyright headers 2015-02-11 06:49:51 +00:00
qchar Update Unicode data up to v7.0 2015-03-27 16:40:06 +00:00
qcollator Update copyright headers 2015-02-11 06:49:51 +00:00
qcommandlineparser QCommandLineParser: add parsing mode for options after arguments 2015-03-06 09:09:31 +00:00
qcontiguouscache Update copyright headers 2015-02-11 06:49:51 +00:00
qcryptographichash Update copyright headers 2015-02-11 06:49:51 +00:00
qdate Update copyright headers 2015-02-11 06:49:51 +00:00
qdatetime tst_QDateTime: remove silly test for timezone date too early 2015-03-11 07:23:21 +00:00
qeasingcurve Remove the tests for Ubuntu Oneiric (11.10) 2015-03-17 01:26:13 +00:00
qelapsedtimer Update copyright headers 2015-02-11 06:49:51 +00:00
qexplicitlyshareddatapointer Update copyright headers 2015-02-11 06:49:51 +00:00
qfreelist Update copyright headers 2015-02-11 06:49:51 +00:00
qhash Update copyright headers 2015-02-11 06:49:51 +00:00
qhash_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qhashfunctions Fixed license headers 2015-02-17 18:46:09 +00:00
qline Update copyright headers 2015-02-11 06:49:51 +00:00
qlinkedlist Update copyright headers 2015-02-11 06:49:51 +00:00
qlist QList: prepare for tag dispatching based on memory layout 2015-02-17 15:05:07 +00:00
qlist_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qlocale Update CLDR to v27 2015-03-27 16:40:16 +00:00
qmap Update copyright headers 2015-02-11 06:49:51 +00:00
qmap_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qmargins Update copyright headers 2015-02-11 06:49:51 +00:00
qmessageauthenticationcode Update copyright headers 2015-02-11 06:49:51 +00:00
qpair Update copyright headers 2015-02-11 06:49:51 +00:00
qpoint Update copyright headers 2015-02-11 06:49:51 +00:00
qpointf Fix build of tests on QNX. 2015-03-14 07:05:34 +00:00
qqueue Update copyright headers 2015-02-11 06:49:51 +00:00
qrect Update copyright headers 2015-02-11 06:49:51 +00:00
qregexp QtCore: assorted migrations to QString::asprintf 2015-02-12 19:40:04 +00:00
qregularexpression Update copyright headers 2015-02-11 06:49:51 +00:00
qringbuffer Make QRingBuffer a 64-bit safe 2015-03-12 05:33:20 +00:00
qscopedpointer Update copyright headers 2015-02-11 06:49:51 +00:00
qscopedvaluerollback Update copyright headers 2015-02-11 06:49:51 +00:00
qset Update copyright headers 2015-02-11 06:49:51 +00:00
qsharedpointer Update copyright headers 2015-02-11 06:49:51 +00:00
qsize Update copyright headers 2015-02-11 06:49:51 +00:00
qsizef Update copyright headers 2015-02-11 06:49:51 +00:00
qstl Update copyright headers 2015-02-11 06:49:51 +00:00
qstring QString::from{Utf8,Latin1,Local8Bit}(QByteArray): preserve nullness of argument 2015-04-02 19:28:18 +00:00
qstring_no_cast_from_bytearray Update copyright headers 2015-02-11 06:49:51 +00:00
qstringbuilder Update copyright headers 2015-02-11 06:49:51 +00:00
qstringiterator Update copyright headers 2015-02-11 06:49:51 +00:00
qstringlist Update copyright headers 2015-02-11 06:49:51 +00:00
qstringmatcher Update copyright headers 2015-02-11 06:49:51 +00:00
qstringref Update copyright headers 2015-02-11 06:49:51 +00:00
qtextboundaryfinder Update UCD source files to v7.0 2015-03-27 16:39:53 +00:00
qtime Update copyright headers 2015-02-11 06:49:51 +00:00
qtimeline Update copyright headers 2015-02-11 06:49:51 +00:00
qtimezone Update copyright headers 2015-02-11 06:49:51 +00:00
qvarlengtharray QVarLengthArray: Add initializer_list constructor 2015-03-23 08:13:42 +00:00
qvector QVector: add {const_,}reverse_iterator, {c,}r{begin,end}() 2015-04-02 18:49:28 +00:00
qvector_strictiterators Make sure all containers compile in strict-iterator mode 2014-02-22 04:38:01 +01:00
qversionnumber Update copyright headers 2015-02-11 06:49:51 +00:00
tools.pro tst_QHash: Factor qHash()-related test cases into a separate test 2015-01-05 20:18:51 +01:00