io/qfilesystemengine_unix.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12 -
13 -
14 -
15 -
16static inline bool _q_isMacHidden(const char *nativePath) -
17{ -
18 (void)nativePath;; -
19 -
20 return false;
executed: return false;
Execution Count:38171
38171
21} -
22 -
23 -
24 -
25QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data) -
26{ -
27 char s[4096 +1]; -
28 int len = readlink(link.nativeFilePath().constData(), s, 4096); -
29 -
30 if (len > 0) {
partially evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
31 QString ret; -
32 if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
evaluated: !data.hasFlags(QFileSystemMetaData::DirectoryType)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4
4-6
33 fillMetaData(link, data, QFileSystemMetaData::DirectoryType);
executed: fillMetaData(link, data, QFileSystemMetaData::DirectoryType);
Execution Count:6
6
34 if (data.isDirectory() && s[0] != '/') {
evaluated: data.isDirectory()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
evaluated: s[0] != '/'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-7
35 QDir parent(link.filePath()); -
36 parent.cdUp(); -
37 ret = parent.path(); -
38 if (!ret.isEmpty() && !ret.endsWith(QLatin1Char('/')))
partially evaluated: !ret.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !ret.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
39 ret += QLatin1Char('/');
executed: ret += QLatin1Char('/');
Execution Count:1
1
40 }
executed: }
Execution Count:1
1
41 s[len] = '\0'; -
42 ret += QFile::decodeName(QByteArray(s)); -
43 -
44 -
45 -
46 -
47 if (!ret.startsWith(QLatin1Char('/'))) {
evaluated: !ret.startsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
4-6
48 if (link.filePath().startsWith(QLatin1Char('/'))) {
evaluated: link.filePath().startsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
49 ret.prepend(link.filePath().left(link.filePath().lastIndexOf(QLatin1Char('/'))) -
50 + QLatin1Char('/')); -
51 } else {
executed: }
Execution Count:1
1
52 ret.prepend(QDir::currentPath() + QLatin1Char('/')); -
53 }
executed: }
Execution Count:3
3
54 } -
55 ret = QDir::cleanPath(ret); -
56 if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
partially evaluated: ret.size() > 1
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
partially evaluated: ret.endsWith(QLatin1Char('/'))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
0-10
57 ret.chop(1);
never executed: ret.chop(1);
0
58 return QFileSystemEntry(ret);
executed: return QFileSystemEntry(ret);
Execution Count:10
10
59 } -
60 return QFileSystemEntry();
never executed: return QFileSystemEntry();
0
61} -
62 -
63 -
64QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data) -
65{ -
66 if (entry.isEmpty() || entry.isRoot())
partially evaluated: entry.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2288
evaluated: entry.isRoot()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:2220
0-2288
67 return entry;
executed: return entry;
Execution Count:68
68
68 -
69 -
70 -
71 -
72 -
73 -
74 char *ret = 0; -
75 ret = realpath(entry.nativeFilePath().constData(), (char*)0); -
76 if (ret) {
evaluated: ret
TRUEFALSE
yes
Evaluation Count:2207
yes
Evaluation Count:13
13-2207
77 data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; -
78 data.entryFlags |= QFileSystemMetaData::ExistsAttribute; -
79 QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); -
80 free(ret); -
81 return QFileSystemEntry(canonicalPath);
executed: return QFileSystemEntry(canonicalPath);
Execution Count:2207
2207
82 } else if ((*__errno_location ()) == 2) {
partially evaluated: (*__errno_location ()) == 2
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
83 data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; -
84 data.entryFlags &= ~(QFileSystemMetaData::ExistsAttribute); -
85 return QFileSystemEntry();
executed: return QFileSystemEntry();
Execution Count:13
13
86 } -
87 return entry;
never executed: return entry;
0
88 -
89} -
90 -
91 -
92QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) -
93{ -
94 if (entry.isAbsolute() && entry.isClean())
evaluated: entry.isAbsolute()
TRUEFALSE
yes
Evaluation Count:9205
yes
Evaluation Count:581
evaluated: entry.isClean()
TRUEFALSE
yes
Evaluation Count:8767
yes
Evaluation Count:437
437-9205
95 return entry;
executed: return entry;
Execution Count:8767
8767
96 -
97 QByteArray orig = entry.nativeFilePath(); -
98 QByteArray result; -
99 if (orig.isEmpty() || !orig.startsWith('/')) {
partially evaluated: orig.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1018
evaluated: !orig.startsWith('/')
TRUEFALSE
yes
Evaluation Count:581
yes
Evaluation Count:437
0-1018
100 QFileSystemEntry cur(currentPath()); -
101 result = cur.nativeFilePath(); -
102 }
executed: }
Execution Count:581
581
103 if (!orig.isEmpty() && !(orig.length() == 1 && orig[0] == '.')) {
partially evaluated: !orig.isEmpty()
TRUEFALSE
yes
Evaluation Count:1018
no
Evaluation Count:0
evaluated: orig.length() == 1
TRUEFALSE
yes
Evaluation Count:210
yes
Evaluation Count:808
evaluated: orig[0] == '.'
TRUEFALSE
yes
Evaluation Count:209
yes
Evaluation Count:1
0-1018
104 if (!result.isEmpty() && !result.endsWith('/'))
evaluated: !result.isEmpty()
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:437
partially evaluated: !result.endsWith('/')
TRUEFALSE
yes
Evaluation Count:372
no
Evaluation Count:0
0-437
105 result.append('/');
executed: result.append('/');
Execution Count:372
372
106 result.append(orig); -
107 }
executed: }
Execution Count:809
809
108 -
109 if (result.length() == 1 && result[0] == '/')
partially evaluated: result.length() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1018
never evaluated: result[0] == '/'
0-1018
110 return QFileSystemEntry(result, QFileSystemEntry::FromNativePath());
never executed: return QFileSystemEntry(result, QFileSystemEntry::FromNativePath());
0
111 const bool isDir = result.endsWith('/'); -
112 -
113 -
114 -
115 -
116 -
117 QFileSystemEntry resultingEntry(result, QFileSystemEntry::FromNativePath()); -
118 QString stringVersion = QDir::cleanPath(resultingEntry.filePath()); -
119 if (isDir)
evaluated: isDir
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1016
2-1016
120 stringVersion.append(QLatin1Char('/'));
executed: stringVersion.append(QLatin1Char('/'));
Execution Count:2
2
121 return QFileSystemEntry(stringVersion);
executed: return QFileSystemEntry(stringVersion);
Execution Count:1018
1018
122} -
123 -
124 -
125QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) -
126{ -
127 struct stat statResult; -
128 if (stat(entry.nativeFilePath().constData(), &statResult)) {
never evaluated: stat(entry.nativeFilePath().constData(), &statResult)
0
129 qErrnoWarning("stat() failed for '%s'", entry.nativeFilePath().constData()); -
130 return QByteArray();
never executed: return QByteArray();
0
131 } -
132 QByteArray result = QByteArray::number(quint64(statResult.st_dev), 16); -
133 result += ':'; -
134 result += QByteArray::number(quint64(statResult.st_ino)); -
135 return result;
never executed: return result;
0
136} -
137 -
138 -
139QString QFileSystemEngine::resolveUserName(uint userId) -
140{ -
141 -
142 int size_max = sysconf(_SC_GETPW_R_SIZE_MAX); -
143 if (size_max == -1)
partially evaluated: size_max == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
144 size_max = 1024;
never executed: size_max = 1024;
0
145 QVarLengthArray<char, 1024> buf(size_max); -
146 -
147 -
148 struct passwd *pw = 0; -
149 -
150 -
151 struct passwd entry; -
152 getpwuid_r(userId, &entry, buf.data(), buf.size(), &pw); -
153 -
154 -
155 -
156 -
157 if (pw)
partially evaluated: pw
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
158 return QFile::decodeName(QByteArray(pw->pw_name));
executed: return QFile::decodeName(QByteArray(pw->pw_name));
Execution Count:2
2
159 return QString();
never executed: return QString();
0
160} -
161 -
162 -
163QString QFileSystemEngine::resolveGroupName(uint groupId) -
164{ -
165 -
166 int size_max = sysconf(_SC_GETPW_R_SIZE_MAX); -
167 if (size_max == -1)
never evaluated: size_max == -1
0
168 size_max = 1024;
never executed: size_max = 1024;
0
169 QVarLengthArray<char, 1024> buf(size_max); -
170 -
171 -
172 struct group *gr = 0; -
173 -
174 -
175 size_max = sysconf(_SC_GETGR_R_SIZE_MAX); -
176 if (size_max == -1)
never evaluated: size_max == -1
0
177 size_max = 1024;
never executed: size_max = 1024;
0
178 buf.resize(size_max); -
179 struct group entry; -
180 -
181 -
182 for (unsigned size = size_max; size < 256000; size += size)
never evaluated: size < 256000
0
183 { -
184 buf.resize(size); -
185 -
186 if (!getgrgid_r(groupId, &entry, buf.data(), buf.size(), &gr)
never evaluated: !getgrgid_r(groupId, &entry, buf.data(), buf.size(), &gr)
0
187 || (*__errno_location ()) != 34)
never evaluated: (*__errno_location ()) != 34
0
188 break;
never executed: break;
0
189 }
never executed: }
0
190 -
191 -
192 -
193 -
194 if (gr)
never evaluated: gr
0
195 return QFile::decodeName(QByteArray(gr->gr_name));
never executed: return QFile::decodeName(QByteArray(gr->gr_name));
0
196 return QString();
never executed: return QString();
0
197} -
198bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, -
199 QFileSystemMetaData::MetaDataFlags what) -
200{ -
201 if (what & QFileSystemMetaData::PosixStatFlags)
evaluated: what & QFileSystemMetaData::PosixStatFlags
TRUEFALSE
yes
Evaluation Count:47287
yes
Evaluation Count:52528
47287-52528
202 what |= QFileSystemMetaData::PosixStatFlags;
executed: what |= QFileSystemMetaData::PosixStatFlags;
Execution Count:47287
47287
203 -
204 if (what & QFileSystemMetaData::ExistsAttribute) {
evaluated: what & QFileSystemMetaData::ExistsAttribute
TRUEFALSE
yes
Evaluation Count:14227
yes
Evaluation Count:85588
14227-85588
205 -
206 what |= QFileSystemMetaData::PosixStatFlags; -
207 }
executed: }
Execution Count:14227
14227
208 -
209 data.entryFlags &= ~what; -
210 -
211 const char * nativeFilePath; -
212 int nativeFilePathLength; -
213 { -
214 const QByteArray &path = entry.nativeFilePath(); -
215 nativeFilePath = path.constData(); -
216 nativeFilePathLength = path.size(); -
217 (void)nativeFilePathLength;; -
218 } -
219 -
220 bool entryExists = true; -
221 -
222 struct stat64 statBuffer; -
223 bool statBufferValid = false; -
224 if (what & QFileSystemMetaData::LinkType) {
evaluated: what & QFileSystemMetaData::LinkType
TRUEFALSE
yes
Evaluation Count:7709
yes
Evaluation Count:92107
7709-92107
225 if (::lstat64(nativeFilePath, &statBuffer) == 0) {
evaluated: ::lstat64(nativeFilePath, &statBuffer) == 0
TRUEFALSE
yes
Evaluation Count:4564
yes
Evaluation Count:3145
3145-4564
226 if (((((statBuffer.st_mode)) & 0170000) == (0120000))) {
evaluated: ((((statBuffer.st_mode)) & 0170000) == (0120000))
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:4496
68-4496
227 data.entryFlags |= QFileSystemMetaData::LinkType; -
228 } else {
executed: }
Execution Count:68
68
229 statBufferValid = true; -
230 data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags; -
231 }
executed: }
Execution Count:4496
4496
232 } else { -
233 entryExists = false; -
234 }
executed: }
Execution Count:3145
3145
235 -
236 data.knownFlagsMask |= QFileSystemMetaData::LinkType; -
237 }
executed: }
Execution Count:7709
7709
238 -
239 if (statBufferValid || (what & QFileSystemMetaData::PosixStatFlags)) {
evaluated: statBufferValid
TRUEFALSE
yes
Evaluation Count:4496
yes
Evaluation Count:95320
evaluated: (what & QFileSystemMetaData::PosixStatFlags)
TRUEFALSE
yes
Evaluation Count:56774
yes
Evaluation Count:38546
4496-95320
240 if (entryExists && !statBufferValid)
evaluated: entryExists
TRUEFALSE
yes
Evaluation Count:58125
yes
Evaluation Count:3145
evaluated: !statBufferValid
TRUEFALSE
yes
Evaluation Count:53629
yes
Evaluation Count:4496
3145-58125
241 statBufferValid = (::stat64(nativeFilePath, &statBuffer) == 0);
executed: statBufferValid = (::stat64(nativeFilePath, &statBuffer) == 0);
Execution Count:53629
53629
242 -
243 if (statBufferValid)
evaluated: statBufferValid
TRUEFALSE
yes
Evaluation Count:52388
yes
Evaluation Count:8882
8882-52388
244 data.fillFromStatBuf(statBuffer);
executed: data.fillFromStatBuf(statBuffer);
Execution Count:52388
52388
245 else { -
246 entryExists = false; -
247 data.creationTime_ = 0; -
248 data.modificationTime_ = 0; -
249 data.accessTime_ = 0; -
250 data.size_ = 0; -
251 data.userId_ = (uint) -2; -
252 data.groupId_ = (uint) -2; -
253 }
executed: }
Execution Count:8882
8882
254 -
255 -
256 data.knownFlagsMask |= QFileSystemMetaData::PosixStatFlags -
257 | QFileSystemMetaData::ExistsAttribute; -
258 }
executed: }
Execution Count:61270
61270
259 if (what & QFileSystemMetaData::UserPermissions) {
evaluated: what & QFileSystemMetaData::UserPermissions
TRUEFALSE
yes
Evaluation Count:10173
yes
Evaluation Count:89643
10173-89643
260 -
261 -
262 if (entryExists) {
evaluated: entryExists
TRUEFALSE
yes
Evaluation Count:10172
yes
Evaluation Count:1
1-10172
263 if (what & QFileSystemMetaData::UserReadPermission) {
evaluated: what & QFileSystemMetaData::UserReadPermission
TRUEFALSE
yes
Evaluation Count:10153
yes
Evaluation Count:19
19-10153
264 if (::access(nativeFilePath, 4) == 0)
evaluated: ::access(nativeFilePath, 4) == 0
TRUEFALSE
yes
Evaluation Count:10065
yes
Evaluation Count:88
88-10065
265 data.entryFlags |= QFileSystemMetaData::UserReadPermission;
executed: data.entryFlags |= QFileSystemMetaData::UserReadPermission;
Execution Count:10065
10065
266 }
executed: }
Execution Count:10153
10153
267 if (what & QFileSystemMetaData::UserWritePermission) {
evaluated: what & QFileSystemMetaData::UserWritePermission
TRUEFALSE
yes
Evaluation Count:10055
yes
Evaluation Count:117
117-10055
268 if (::access(nativeFilePath, 2) == 0)
evaluated: ::access(nativeFilePath, 2) == 0
TRUEFALSE
yes
Evaluation Count:2389
yes
Evaluation Count:7666
2389-7666
269 data.entryFlags |= QFileSystemMetaData::UserWritePermission;
executed: data.entryFlags |= QFileSystemMetaData::UserWritePermission;
Execution Count:2389
2389
270 }
executed: }
Execution Count:10055
10055
271 if (what & QFileSystemMetaData::UserExecutePermission) {
evaluated: what & QFileSystemMetaData::UserExecutePermission
TRUEFALSE
yes
Evaluation Count:10060
yes
Evaluation Count:112
112-10060
272 if (::access(nativeFilePath, 1) == 0)
evaluated: ::access(nativeFilePath, 1) == 0
TRUEFALSE
yes
Evaluation Count:2156
yes
Evaluation Count:7904
2156-7904
273 data.entryFlags |= QFileSystemMetaData::UserExecutePermission;
executed: data.entryFlags |= QFileSystemMetaData::UserExecutePermission;
Execution Count:2156
2156
274 }
executed: }
Execution Count:10060
10060
275 }
executed: }
Execution Count:10172
10172
276 data.knownFlagsMask |= (what & QFileSystemMetaData::UserPermissions); -
277 }
executed: }
Execution Count:10173
10173
278 -
279 if (what & QFileSystemMetaData::HiddenAttribute
evaluated: what & QFileSystemMetaData::HiddenAttribute
TRUEFALSE
yes
Evaluation Count:43254
yes
Evaluation Count:56562
43254-56562
280 && !data.isHidden()) {
partially evaluated: !data.isHidden()
TRUEFALSE
yes
Evaluation Count:43254
no
Evaluation Count:0
0-43254
281 QString fileName = entry.fileName(); -
282 if ((fileName.size() > 0 && fileName.at(0) == QLatin1Char('.'))
partially evaluated: fileName.size() > 0
TRUEFALSE
yes
Evaluation Count:43254
no
Evaluation Count:0
evaluated: fileName.at(0) == QLatin1Char('.')
TRUEFALSE
yes
Evaluation Count:1938
yes
Evaluation Count:41316
0-43254
283 || (entryExists && _q_isMacHidden(nativeFilePath)))
evaluated: entryExists
TRUEFALSE
yes
Evaluation Count:38171
yes
Evaluation Count:3145
partially evaluated: _q_isMacHidden(nativeFilePath)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38171
0-38171
284 data.entryFlags |= QFileSystemMetaData::HiddenAttribute;
executed: data.entryFlags |= QFileSystemMetaData::HiddenAttribute;
Execution Count:1938
1938
285 data.knownFlagsMask |= QFileSystemMetaData::HiddenAttribute; -
286 }
executed: }
Execution Count:43254
43254
287 if (!entryExists) {
evaluated: !entryExists
TRUEFALSE
yes
Evaluation Count:8882
yes
Evaluation Count:90934
8882-90934
288 data.clearFlags(what); -
289 return false;
executed: return false;
Execution Count:8882
8882
290 } -
291 return data.hasFlags(what);
executed: return data.hasFlags(what);
Execution Count:90934
90934
292} -
293 -
294 -
295bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool createParents) -
296{ -
297 QString dirName = entry.filePath(); -
298 if (createParents) {
evaluated: createParents
TRUEFALSE
yes
Evaluation Count:216
yes
Evaluation Count:1332
216-1332
299 dirName = QDir::cleanPath(dirName); -
300 for (int oldslash = -1, slash=0; slash != -1; oldslash = slash) {
partially evaluated: slash != -1
TRUEFALSE
yes
Evaluation Count:1212
no
Evaluation Count:0
0-1212
301 slash = dirName.indexOf(QDir::separator(), oldslash+1); -
302 if (slash == -1) {
evaluated: slash == -1
TRUEFALSE
yes
Evaluation Count:432
yes
Evaluation Count:780
432-780
303 if (oldslash == dirName.length())
evaluated: oldslash == dirName.length()
TRUEFALSE
yes
Evaluation Count:216
yes
Evaluation Count:216
216
304 break;
executed: break;
Execution Count:216
216
305 slash = dirName.length(); -
306 }
executed: }
Execution Count:216
216
307 if (slash) {
evaluated: slash
TRUEFALSE
yes
Evaluation Count:781
yes
Evaluation Count:215
215-781
308 const QByteArray chunk = QFile::encodeName(dirName.left(slash)); -
309 struct stat64 st; -
310 if (::stat64(chunk.constData(), &st) != -1) {
evaluated: ::stat64(chunk.constData(), &st) != -1
TRUEFALSE
yes
Evaluation Count:519
yes
Evaluation Count:262
262-519
311 if ((st.st_mode & 0170000) != 0040000)
partially evaluated: (st.st_mode & 0170000) != 0040000
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:519
0-519
312 return false;
never executed: return false;
0
313 } else if (::mkdir(chunk.constData(), 0777) != 0) {
partially evaluated: ::mkdir(chunk.constData(), 0777) != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262
executed: }
Execution Count:519
0-519
314 return false;
never executed: return false;
0
315 } -
316 } -
317 }
executed: }
Execution Count:996
996
318 return true;
executed: return true;
Execution Count:216
216
319 } -
320 -
321 -
322 -
323 -
324 return (::mkdir(QFile::encodeName(dirName).constData(), 0777) == 0);
executed: return (::mkdir(QFile::encodeName(dirName).constData(), 0777) == 0);
Execution Count:1332
1332
325} -
326 -
327 -
328bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool removeEmptyParents) -
329{ -
330 if (removeEmptyParents) {
evaluated: removeEmptyParents
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2392
4-2392
331 QString dirName = QDir::cleanPath(entry.filePath()); -
332 for (int oldslash = 0, slash=dirName.length(); slash > 0; oldslash = slash) {
partially evaluated: slash > 0
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
333 const QByteArray chunk = QFile::encodeName(dirName.left(slash)); -
334 struct stat64 st; -
335 if (::stat64(chunk.constData(), &st) != -1) {
evaluated: ::stat64(chunk.constData(), &st) != -1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
336 if ((st.st_mode & 0170000) != 0040000)
partially evaluated: (st.st_mode & 0170000) != 0040000
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
337 return false;
never executed: return false;
0
338 if (::rmdir(chunk.constData()) != 0)
evaluated: ::rmdir(chunk.constData()) != 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
339 return oldslash != 0;
executed: return oldslash != 0;
Execution Count:1
1
340 } else {
executed: }
Execution Count:3
3
341 return false;
executed: return false;
Execution Count:3
3
342 } -
343 slash = dirName.lastIndexOf(QDir::separator(), oldslash-1); -
344 }
executed: }
Execution Count:3
3
345 return true;
never executed: return true;
0
346 } -
347 return rmdir(QFile::encodeName(entry.filePath()).constData()) == 0;
executed: return rmdir(QFile::encodeName(entry.filePath()).constData()) == 0;
Execution Count:2392
2392
348} -
349 -
350 -
351bool QFileSystemEngine::createLink(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) -
352{ -
353 if (::symlink(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0)
partially evaluated: ::symlink(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0
TRUEFALSE
yes
Evaluation Count:145
no
Evaluation Count:0
0-145
354 return true;
executed: return true;
Execution Count:145
145
355 error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); -
356 return false;
never executed: return false;
0
357} -
358 -
359 -
360bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) -
361{ -
362 (void)source;; -
363 (void)target;; -
364 error = QSystemError(38, QSystemError::StandardLibraryError); -
365 return false;
executed: return false;
Execution Count:96
96
366} -
367 -
368 -
369bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSystemEntry &target, QSystemError &error) -
370{ -
371 if (::rename(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0)
evaluated: ::rename(source.nativeFilePath().constData(), target.nativeFilePath().constData()) == 0
TRUEFALSE
yes
Evaluation Count:200
yes
Evaluation Count:3
3-200
372 return true;
executed: return true;
Execution Count:200
200
373 error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); -
374 return false;
executed: return false;
Execution Count:3
3
375} -
376 -
377 -
378bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError &error) -
379{ -
380 if (unlink(entry.nativeFilePath().constData()) == 0)
evaluated: unlink(entry.nativeFilePath().constData()) == 0
TRUEFALSE
yes
Evaluation Count:4879
yes
Evaluation Count:615
615-4879
381 return true;
executed: return true;
Execution Count:4879
4879
382 error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError); -
383 return false;
executed: return false;
Execution Count:615
615
384 -
385} -
386 -
387 -
388bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Permissions permissions, QSystemError &error, QFileSystemMetaData *data) -
389{ -
390 mode_t mode = 0; -
391 if (permissions & QFile::ReadOwner)
evaluated: permissions & QFile::ReadOwner
TRUEFALSE
yes
Evaluation Count:494
yes
Evaluation Count:21
21-494
392 mode |= 0400;
executed: mode |= 0400;
Execution Count:494
494
393 if (permissions & QFile::WriteOwner)
evaluated: permissions & QFile::WriteOwner
TRUEFALSE
yes
Evaluation Count:442
yes
Evaluation Count:73
73-442
394 mode |= 0200;
executed: mode |= 0200;
Execution Count:442
442
395 if (permissions & QFile::ExeOwner)
evaluated: permissions & QFile::ExeOwner
TRUEFALSE
yes
Evaluation Count:220
yes
Evaluation Count:295
220-295
396 mode |= 0100;
executed: mode |= 0100;
Execution Count:220
220
397 if (permissions & QFile::ReadUser)
evaluated: permissions & QFile::ReadUser
TRUEFALSE
yes
Evaluation Count:476
yes
Evaluation Count:39
39-476
398 mode |= 0400;
executed: mode |= 0400;
Execution Count:476
476
399 if (permissions & QFile::WriteUser)
evaluated: permissions & QFile::WriteUser
TRUEFALSE
yes
Evaluation Count:427
yes
Evaluation Count:88
88-427
400 mode |= 0200;
executed: mode |= 0200;
Execution Count:427
427
401 if (permissions & QFile::ExeUser)
evaluated: permissions & QFile::ExeUser
TRUEFALSE
yes
Evaluation Count:220
yes
Evaluation Count:295
220-295
402 mode |= 0100;
executed: mode |= 0100;
Execution Count:220
220
403 if (permissions & QFile::ReadGroup)
evaluated: permissions & QFile::ReadGroup
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:301
214-301
404 mode |= (0400 >> 3);
executed: mode |= (0400 >> 3);
Execution Count:214
214
405 if (permissions & QFile::WriteGroup)
partially evaluated: permissions & QFile::WriteGroup
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:515
0-515
406 mode |= (0200 >> 3);
never executed: mode |= (0200 >> 3);
0
407 if (permissions & QFile::ExeGroup)
evaluated: permissions & QFile::ExeGroup
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:514
1-514
408 mode |= (0100 >> 3);
executed: mode |= (0100 >> 3);
Execution Count:1
1
409 if (permissions & QFile::ReadOther)
evaluated: permissions & QFile::ReadOther
TRUEFALSE
yes
Evaluation Count:219
yes
Evaluation Count:296
219-296
410 mode |= ((0400 >> 3) >> 3);
executed: mode |= ((0400 >> 3) >> 3);
Execution Count:219
219
411 if (permissions & QFile::WriteOther)
evaluated: permissions & QFile::WriteOther
TRUEFALSE
yes
Evaluation Count:218
yes
Evaluation Count:297
218-297
412 mode |= ((0200 >> 3) >> 3);
executed: mode |= ((0200 >> 3) >> 3);
Execution Count:218
218
413 if (permissions & QFile::ExeOther)
evaluated: permissions & QFile::ExeOther
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:513
2-513
414 mode |= ((0100 >> 3) >> 3);
executed: mode |= ((0100 >> 3) >> 3);
Execution Count:2
2
415 -
416 bool success = ::chmod(entry.nativeFilePath().constData(), mode) == 0; -
417 if (success && data) {
evaluated: success
TRUEFALSE
yes
Evaluation Count:510
yes
Evaluation Count:5
partially evaluated: data
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:510
0-510
418 data->entryFlags &= ~QFileSystemMetaData::Permissions; -
419 data->entryFlags |= QFileSystemMetaData::MetaDataFlag(uint(permissions)); -
420 data->knownFlagsMask |= QFileSystemMetaData::Permissions; -
421 }
never executed: }
0
422 if (!success)
evaluated: !success
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:510
5-510
423 error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError);
executed: error = QSystemError((*__errno_location ()), QSystemError::StandardLibraryError);
Execution Count:5
5
424 return success;
executed: return success;
Execution Count:515
515
425} -
426 -
427QString QFileSystemEngine::homePath() -
428{ -
429 QString home = QFile::decodeName(qgetenv("HOME")); -
430 if (home.isEmpty())
evaluated: home.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:793
1-793
431 home = rootPath();
executed: home = rootPath();
Execution Count:1
1
432 return QDir::cleanPath(home);
executed: return QDir::cleanPath(home);
Execution Count:794
794
433} -
434 -
435QString QFileSystemEngine::rootPath() -
436{ -
437 return QLatin1String("/");
executed: return QLatin1String("/");
Execution Count:187
187
438} -
439 -
440QString QFileSystemEngine::tempPath() -
441{ -
442 QString temp = QFile::decodeName(qgetenv("TMPDIR")); -
443 if (temp.isEmpty())
partially evaluated: temp.isEmpty()
TRUEFALSE
yes
Evaluation Count:2929
no
Evaluation Count:0
0-2929
444 temp = QLatin1String("/tmp/");
executed: temp = QLatin1String("/tmp/");
Execution Count:2929
2929
445 return QDir::cleanPath(temp);
executed: return QDir::cleanPath(temp);
Execution Count:2929
2929
446 -
447} -
448 -
449bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &path) -
450{ -
451 int r; -
452 r = ::chdir(path.nativeFilePath().constData()); -
453 return r >= 0;
executed: return r >= 0;
Execution Count:312
312
454} -
455 -
456QFileSystemEntry QFileSystemEngine::currentPath() -
457{ -
458 QFileSystemEntry result; -
459 struct stat64 st; -
460 if (::stat64(".", &st) == 0) {
partially evaluated: ::stat64(".", &st) == 0
TRUEFALSE
yes
Evaluation Count:1399
no
Evaluation Count:0
0-1399
461 -
462 -
463 -
464 -
465 -
466 -
467 -
468 char currentName[4096 +1]; -
469 if (::getcwd(currentName, 4096))
partially evaluated: ::getcwd(currentName, 4096)
TRUEFALSE
yes
Evaluation Count:1399
no
Evaluation Count:0
0-1399
470 result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
executed: result = QFileSystemEntry(QByteArray(currentName), QFileSystemEntry::FromNativePath());
Execution Count:1399
1399
471 -
472 -
473 -
474 -
475 -
476 } else {
executed: }
Execution Count:1399
1399
477 -
478 -
479 -
480 }
never executed: }
0
481 return result;
executed: return result;
Execution Count:1399
1399
482} -
483 -
484 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial