io/qfilesystemiterator_unix.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters, -
9 const QStringList &nameFilters, QDirIterator::IteratorFlags flags) -
10 : nativePath(entry.nativeFilePath()) -
11 , dir(0) -
12 , dirEntry(0) -
13 -
14 -
15 -
16 , lastError(0) -
17{ -
18 (void)filters; -
19 (void)nameFilters; -
20 (void)flags; -
21 -
22 if ((dir = ::opendir(nativePath.constData())) == 0) {
evaluated: (dir = ::opendir(nativePath.constData())) == 0
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:5816
24-5816
23 lastError = (*__errno_location ()); -
24 } else {
executed: }
Execution Count:24
24
25 -
26 if (!nativePath.endsWith('/'))
evaluated: !nativePath.endsWith('/')
TRUEFALSE
yes
Evaluation Count:5649
yes
Evaluation Count:167
167-5649
27 nativePath.append('/');
executed: nativePath.append('/');
Execution Count:5649
5649
28 -
29 -
30 -
31 size_t maxPathName = ::pathconf(nativePath.constData(), _PC_NAME_MAX); -
32 if (maxPathName == size_t(-1))
partially evaluated: maxPathName == size_t(-1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5816
0-5816
33 maxPathName = 4096;
never executed: maxPathName = 4096;
0
34 maxPathName += sizeof(struct dirent64) + 1; -
35 -
36 struct dirent64 *p = reinterpret_cast<struct dirent64*>(::malloc(maxPathName)); -
37 do { if (!(p)) qBadAlloc(); } while (0);
partially evaluated: !(p)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5816
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5816
never executed: qBadAlloc();
executed: }
Execution Count:5816
0-5816
38 -
39 mt_file.reset(p); -
40 }
executed: }
Execution Count:5816
5816
41} -
42 -
43QFileSystemIterator::~QFileSystemIterator() -
44{ -
45 if (dir)
evaluated: dir
TRUEFALSE
yes
Evaluation Count:5816
yes
Evaluation Count:24
24-5816
46 ::closedir(dir);
executed: ::closedir(dir);
Execution Count:5816
5816
47}
executed: }
Execution Count:5840
5840
48 -
49bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData) -
50{ -
51 if (!dir)
evaluated: !dir
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:92600
24-92600
52 return false;
executed: return false;
Execution Count:24
24
53 -
54 -
55 -
56 -
57 -
58 -
59 lastError = ::readdir64_r(dir, mt_file.data(), &dirEntry); -
60 if (lastError)
partially evaluated: lastError
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:92606
0-92606
61 return false;
never executed: return false;
0
62 -
63 -
64 -
65 -
66 -
67 if (dirEntry) {
evaluated: dirEntry
TRUEFALSE
yes
Evaluation Count:86844
yes
Evaluation Count:5763
5763-86844
68 fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath()); -
69 metaData.fillFromDirEnt(*dirEntry); -
70 return true;
executed: return true;
Execution Count:86823
86823
71 } -
72 -
73 lastError = (*__errno_location ()); -
74 return false;
executed: return false;
Execution Count:5763
5763
75} -
76 -
77 -
78 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial