diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-12-11 12:46:11 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-12-13 10:55:59 +0000 |
commit | 27aacfb61e85a332394c7996f5c6603f07c28cd2 (patch) | |
tree | 9515f66e9bba5fa8fa9a185fc5083ad311b73b3a /tests/auto/corelib/io | |
parent | 91996d4ec4d9f54a4506b92aa06c097a7bb965a5 (diff) |
QString: fix documentation of NUL-termination of unicode(), data(), constData()
(or lack thereof).
* `QString::utf16()` reallocates if `*this` has been constructed using
`fromRawData()`.
* `QString::data()` ensures a writable string, so will detach from raw
data.
* `QString::unicode()`, `constData()`, and `data() const` do not. They
just return `QStringData::data()`, which may point to raw,
non-NUL-terminated data.
These functions can therefore not possibly have the same behavior, but
were documented the same.
Fix.
Also drop the discussion of operator[](size()), as that, too, was not
correct, and anyone who indexes with op[] beyond size() - 1 should not
rely on proper behavior.
[ChangeLog][QtCore][QString] QString::unicode(), constData() and
`data() const` do not return a NUL-terminated string. This was true
before, but the documentation claimed the opposite.
Change-Id: I1437f57cd02bdf80264e8559608b46aa749c23a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io')
0 files changed, 0 insertions, 0 deletions