我有可能 QBuffer::open(OpenMode mode) 返回 false 吗?这是实现:
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;
}
我会说不。我正在进行这项研究,因此我的 flexLint 代码分析不会产生新的警告。