summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/text/qzip.cpp7
-rw-r--r--src/gui/text/qzipreader_p.h1
-rw-r--r--tests/auto/qzip/tst_qzip.cpp4
3 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index fab6891..5aa0a94 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -343,7 +343,7 @@ struct FileHeader
};
QZipReader::FileInfo::FileInfo()
- : isDir(false), isFile(true), isSymLink(false), crc32(0), size(0)
+ : isDir(false), isFile(false), isSymLink(false), crc32(0), size(0)
{
}
@@ -368,6 +368,11 @@ QZipReader::FileInfo& QZipReader::FileInfo::operator=(const FileInfo &other)
return *this;
}
+bool QZipReader::FileInfo::isValid() const
+{
+ return isDir || isFile || isSymLink;
+}
+
class QZipPrivate
{
public:
diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h
index d838957..4961e1c 100644
--- a/src/gui/text/qzipreader_p.h
+++ b/src/gui/text/qzipreader_p.h
@@ -81,6 +81,7 @@ public:
FileInfo(const FileInfo &other);
~FileInfo();
FileInfo &operator=(const FileInfo &other);
+ bool isValid() const;
QString filePath;
uint isDir : 1;
uint isFile : 1;
diff --git a/tests/auto/qzip/tst_qzip.cpp b/tests/auto/qzip/tst_qzip.cpp
index d7fc2f7..99379b5 100644
--- a/tests/auto/qzip/tst_qzip.cpp
+++ b/tests/auto/qzip/tst_qzip.cpp
@@ -77,6 +77,7 @@ void tst_QZip::basicUnpack()
QCOMPARE(files.count(), 2);
QZipReader::FileInfo fi = files.at(0);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("test/"));
QCOMPARE(uint(fi.isDir), (uint) 1);
QCOMPARE(uint(fi.isFile), (uint) 0);
@@ -86,6 +87,7 @@ void tst_QZip::basicUnpack()
| QFile::ReadUser | QFile::WriteUser | QFile::ExeUser ));
fi = files.at(1);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("test/test.txt"));
QCOMPARE(uint(fi.isDir), (uint) 0);
QCOMPARE(uint(fi.isFile), (uint) 1);
@@ -104,6 +106,7 @@ void tst_QZip::symlinks()
QCOMPARE(files.count(), 2);
QZipReader::FileInfo fi = files.at(0);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("symlink"));
QVERIFY(!fi.isDir);
QVERIFY(!fi.isFile);
@@ -112,6 +115,7 @@ void tst_QZip::symlinks()
QCOMPARE(zip.fileData("symlink"), QByteArray("destination"));
fi = files.at(1);
+ QVERIFY(fi.isValid());
QCOMPARE(fi.filePath, QString("destination"));
QVERIFY(!fi.isDir);
QVERIFY(fi.isFile);