qt5base-lts/tests/auto/corelib/io
Tor Arne Vestbø 764f5bf48c Apple OS: Handle QSetting strings with embedded zero-bytes
Saving strings with embedded zero-bytes (\0) as CFStrings would
sometimes fail, and only write the part of the string leading
up to the first zero-byte, instead of all the way to the final
zero-terminator. This bug was revealed by the code-path that
falls back to storing e.g. QTime as strings, via the helper
method QSettingsPrivate::variantToString().

We now use the same approach as on platforms such as Windows
and WinRT, where the string produced by variantToString() is
checked for null-bytes, and if so, stored using a binary
representation instead of as a string. For our case that
means we fall back to CFData when detecting the null-byte.

To separate strings from regular byte arrays, new logic has
been added to variantToString() that wraps the null-byte
strings in @String(). That way we can implement a fast-path
when converting back from CFData, that doesn't go via the
slow and lossy conversion via UTF8, and the resulting QVariant
will be of type QVariant::ByteArray. The reason for using
UTF-8 as the binary representation of the string is that
in the case of storing a QByteArray("@foo") we need to
still be able to convert it back to the same byte array,
which doesn't work if the on-disk format is UTF-16.

Task-number: QTBUG-56124
Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-05 11:57:41 +00:00
..
largefile QtCore: Remove Windows CE. 2016-03-30 11:22:47 +00:00
qabstractfileengine Merge remote-tracking branch 'origin/5.6' into dev 2016-01-26 16:27:28 +01:00
qbuffer Updated license headers 2016-01-21 18:55:18 +00:00
qdatastream Merge remote-tracking branch 'origin/5.7' into dev 2016-08-01 18:20:00 +02:00
qdataurl Updated license headers 2016-01-21 18:55:18 +00:00
qdebug Merge remote-tracking branch 'origin/5.6' into 5.7 2016-06-10 23:27:10 +02:00
qdir Merge remote-tracking branch 'origin/5.7' into dev 2016-06-13 12:46:46 +02:00
qdiriterator Merge remote-tracking branch 'origin/5.7' into dev 2016-06-13 12:46:46 +02:00
qfile Merge remote-tracking branch 'origin/5.7' into dev 2016-08-16 07:58:32 +02:00
qfileinfo Fix/adapt the uses of {to,set,from}Time_t in the qtbase source code 2016-07-06 06:28:13 +00:00
qfileselector Fix QFileSelectorPrivate::addStatics() 2016-02-12 14:10:29 +00:00
qfilesystementry Updated license headers 2016-01-21 18:55:18 +00:00
qfilesystemwatcher Merge remote-tracking branch 'origin/5.7' into dev 2016-04-05 14:22:45 +02:00
qiodevice Revert blacklisting of two tests now the fix is in 2016-05-30 17:39:37 +00:00
qipaddress Merge remote-tracking branch 'origin/5.6' into 5.7 2016-04-13 06:55:37 +02:00
qlockfile Add support for Apple tvOS 2016-05-17 16:11:23 +00:00
qloggingcategory Updated license headers 2016-01-21 18:55:18 +00:00
qloggingregistry Merge remote-tracking branch 'origin/5.6' into 5.7 2016-05-06 15:36:44 +02:00
qnodebug Updated license headers 2016-01-21 18:55:18 +00:00
qprocess Merge remote-tracking branch 'origin/5.7' into dev 2016-08-16 07:58:32 +02:00
qprocess-noapplication Updated license headers 2016-01-21 18:55:18 +00:00
qprocessenvironment QtCore: Remove Windows CE. 2016-03-30 11:22:47 +00:00
qresourceengine Remove the traces of the discontinued android-no-sdk platform 2016-03-30 10:12:34 +00:00
qsavefile Updated license headers 2016-01-21 18:55:18 +00:00
qsettings Apple OS: Handle QSetting strings with embedded zero-bytes 2016-10-05 11:57:41 +00:00
qstandardpaths Merge remote-tracking branch 'origin/5.6' into 5.7 2016-04-04 08:59:18 +02:00
qstorageinfo Merge remote-tracking branch 'origin/5.7' into dev 2016-05-23 21:09:46 +02:00
qtemporarydir Merge remote-tracking branch 'origin/5.7' into dev 2016-08-01 18:20:00 +02:00
qtemporaryfile Merge remote-tracking branch 'origin/5.7' into dev 2016-08-01 18:20:00 +02:00
qtextstream Revert blacklisting of two tests now the fix is in 2016-05-30 17:39:37 +00:00
qurl Merge remote-tracking branch 'origin/5.6' into 5.7 2016-08-05 08:58:48 +02:00
qurlinternal Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
qurlquery Updated license headers 2016-01-21 18:55:18 +00:00
qwinoverlappedionotifier Updated license headers 2016-01-21 18:55:18 +00:00
io.pro Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00