QZipReader - test that QFile::open was, indeed, successful.
Coverity, CIDs 10917, 10918. This fix looks like purely cosmetic and unneeded: we check f->error() after f->open(). Unfortunately, f->open() can fail without setting an error (if you provided an invalid mode). Change-Id: Idbfcb9305b3f004e5e425cb6076b41e193b8d473 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
90631dcbf5
commit
0b35167c20
@ -816,9 +816,8 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
|
||||
QZipReader::QZipReader(const QString &archive, QIODevice::OpenMode mode)
|
||||
{
|
||||
QScopedPointer<QFile> f(new QFile(archive));
|
||||
f->open(mode);
|
||||
QZipReader::Status status;
|
||||
if (f->error() == QFile::NoError)
|
||||
if (f->open(mode) && f->error() == QFile::NoError)
|
||||
status = NoError;
|
||||
else {
|
||||
if (f->error() == QFile::ReadError)
|
||||
@ -1112,9 +1111,8 @@ void QZipReader::close()
|
||||
QZipWriter::QZipWriter(const QString &fileName, QIODevice::OpenMode mode)
|
||||
{
|
||||
QScopedPointer<QFile> f(new QFile(fileName));
|
||||
f->open(mode);
|
||||
QZipWriter::Status status;
|
||||
if (f->error() == QFile::NoError)
|
||||
if (f->open(mode) && f->error() == QFile::NoError)
|
||||
status = QZipWriter::NoError;
|
||||
else {
|
||||
if (f->error() == QFile::WriteError)
|
||||
|
Loading…
Reference in New Issue
Block a user