summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qbuffer.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index 4e513bc7cf7..16abac48886 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -286,27 +286,32 @@ void QBuffer::setData(const char *data, qsizetype size)
}
/*!
- \reimp
+ Opens the buffer using \a mode flags, returning \c true if successful;
+ otherwise returns \c false.
+
+ The flags for \a mode must include \l QIODeviceBase::ReadOnly,
+ \l WriteOnly, or \l ReadWrite. If not, an error is printed and
+ the method fails. In any other case, it succeeds.
- Unlike QFile, opening a QBuffer QIODevice::WriteOnly does not truncate it.
- However, pos() is set to 0. Use QIODevice::Append or QIODevice::Truncate to
- change either behavior.
+ Unlike \l QFile::open(), opening a QBuffer with \l WriteOnly
+ does not truncate it. However, \l pos() is set to \c{0}.
+ Use \l Append or \l Truncate to change either behavior.
*/
-bool QBuffer::open(OpenMode flags)
+bool QBuffer::open(OpenMode mode)
{
Q_D(QBuffer);
- if ((flags & (Append | Truncate)) != 0)
- flags |= WriteOnly;
- if ((flags & (ReadOnly | WriteOnly)) == 0) {
+ if ((mode & (Append | Truncate)) != 0)
+ mode |= WriteOnly;
+ if ((mode & (ReadOnly | WriteOnly)) == 0) {
qWarning("QBuffer::open: Buffer access not specified");
return false;
}
- if ((flags & Truncate) == Truncate)
+ if ((mode & Truncate) == Truncate)
d->buf->resize(0);
- return QIODevice::open(flags | QIODevice::Unbuffered);
+ return QIODevice::open(mode | QIODevice::Unbuffered);
}
/*!