I is possible that QBuffer::open(OpenMode mode) ever returns false? Here is implementation:
bool QBuffer::open(OpenMode flags)
{
Q_D(QBuffer);
if ((flags & Append) == Append)
flags |= WriteOnly;
setOpenMode(flags);
if (!(isReadable() || isWritable())) {
qWarning("QFile::open: File access not specified");
return false;
}
if ((flags & QIODevice::Truncate) == QIODevice::Truncate) {
d->buf->resize(o);
}
if ((flags & QIODevice::Append) == QIODevice::Append) // append to end of buffer
seek(d->buf->size());
else
seek(o);
return true;
}
bool QIODevice::isReadable() const
{
return (openMode() & ReadOnly) != 0;
}
bool QIODevice::isWritable() const
{
return (openMode() & WriteOnly) != 0;
}
I would say no. I am making this research so my flexLint code analysis won’t create new kind of warning.
It can return false if you don’t give it the right flags. Calling
QBuffer::open(QIODevice::Text), for example, would fail since that does not specify read or write mode. Apart from that, it will always return true.