qt6-bb10/tests/auto/corelib/io
Tor Arne Vestbø ab0ba66864 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
Cherry-picked: 764f5bf48c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2016-10-21 09:30:43 +00:00
..
largefile Merge remote-tracking branch 'origin/5.6' into dev 2016-01-26 16:27:28 +01: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 QDataStream: adjust containers' deserialization in transaction mode 2016-07-20 06:52:43 +00: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.6' into 5.7 2016-06-10 23:27:10 +02:00
qdiriterator Merge remote-tracking branch 'origin/5.6' into 5.7 2016-06-10 23:27:10 +02:00
qfile Merge remote-tracking branch 'origin/5.6' into 5.7 2016-08-13 01:05:02 +02:00
qfileinfo Merge remote-tracking branch 'origin/5.6' into 5.7 2016-06-10 23:27:10 +02: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 Remove the traces of the discontinued android-no-sdk platform 2016-03-30 10:12:34 +00:00
qiodevice Remove the traces of the discontinued android-no-sdk platform 2016-03-30 10:12:34 +00:00
qipaddress Merge remote-tracking branch 'origin/5.6' into 5.7 2016-04-13 06:55:37 +02:00
qlockfile Merge remote-tracking branch 'origin/5.6' into 5.7 2016-04-13 06:55:37 +02: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.6' into 5.7 2016-08-10 17:43:13 +02:00
qprocess-noapplication Updated license headers 2016-01-21 18:55:18 +00:00
qprocessenvironment Updated license headers 2016-01-21 18:55:18 +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-21 09:30:43 +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.6' into 5.7 2016-05-19 12:55:27 +02:00
qtemporarydir Merge remote-tracking branch 'origin/5.6' into 5.7 2016-07-26 10:43:29 +02:00
qtemporaryfile Merge remote-tracking branch 'origin/5.6' into 5.7 2016-07-26 10:43:29 +02:00
qtextstream Merge remote-tracking branch 'origin/5.6' into 5.7 2016-03-21 09:02:57 +01:00
qurl Merge remote-tracking branch 'origin/5.6' into 5.7 2016-08-05 08:58:48 +02:00
qurlinternal Disallow non-character Unicode codepoints in QUrl/QUrlQuery 2016-04-26 23:08:11 +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 winrt: msvc2015: refactor file handling 2016-01-21 05:53:17 +00:00