diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-07-17 08:31:43 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-07-19 07:54:12 +0200 |
| commit | 5fca6c51ce91c98ebe4da14838a1651e40a7d904 (patch) | |
| tree | 736306a2998381546612e19d609cd988439a44d0 /src/corelib/serialization/qtextstream.cpp | |
| parent | c1e9af8d6c05ff38818a86055d0e58683548da70 (diff) | |
Prefer QTextStreamPrivate::write(QStringView) over (ptr, n) [1/2]: casts
Replace calls that needed to reinterpret_cast arguments in order to
call write(const QChar *, qsizetype) with calls that use QStringView.
The QStringView ctor hides the casts. In both cases, the ranges are
statically known to be valid (one is over a local buffer and the other
over contents we've already inspected), so the old code cannot have
depended on the write(p, n) behavior, inherited from
QString::append(p, n), of silently ignoring invalid ranges. So this
change is safe.
Requires changing an if() into an if constexpr(): while the
reinterpret_cast to QChar* compiles even for uchar* input, the
QStringView ctor would not.
This is in preparation of removing the write(p, n) overload
completely.
Task-number: QTBUG-138520
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ic4bd0ca8743fe5d2cfc08e2caa3f2cbdad29abc3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/serialization/qtextstream.cpp')
0 files changed, 0 insertions, 0 deletions
