QDataStream: clarify QDataStream::operator>>(char *&s) API docs
The wording was slightly ambiguous giving readers the idea that it will scan for a \0 terminator in the data; however what actually happens is that readBytes() gets the length of the string from a quint32 in the stream right before the data, and readBytes() always adds a null-terminator. Fixes: QTBUG-3287 Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Ie22500a9c191ffd590a6b57babeb67577c24dddb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
1849489315
commit
74098981bd
@ -962,10 +962,11 @@ QDataStream &QDataStream::operator>>(double &f)
|
||||
/*!
|
||||
\overload
|
||||
|
||||
Reads the '\\0'-terminated string \a s from the stream and returns
|
||||
a reference to the stream.
|
||||
Reads string \a s from the stream and returns a reference to the stream.
|
||||
|
||||
The string is deserialized using \c{readBytes()}.
|
||||
The string is deserialized using \c{readBytes()} where the serialization
|
||||
format is a \c quint32 length specifier first, followed by that many bytes
|
||||
of data. The resulting string is always '\\0'-terminated.
|
||||
|
||||
Space for the string is allocated using \c{new []} -- the caller must
|
||||
destroy it with \c{delete []}.
|
||||
|
Loading…
x
Reference in New Issue
Block a user