| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qfilesystemengine_p.h" | - |
| 43 | #include <QtCore/qdir.h> | - |
| 44 | #include <QtCore/qset.h> | - |
| 45 | #include <QtCore/qstringbuilder.h> | - |
| 46 | #include <QtCore/private/qabstractfileengine_p.h> | - |
| 47 | #ifdef QT_BUILD_CORE_LIB | - |
| 48 | #include <QtCore/private/qresource_p.h> | - |
| 49 | #endif | - |
| 50 | | - |
| 51 | QT_BEGIN_NAMESPACE | - |
| 52 | | - |
| 53 | /*! | - |
| 54 | \internal | - |
| 55 | | - |
| 56 | Returns the canonicalized form of \a path (i.e., with all symlinks | - |
| 57 | resolved, and all redundant path elements removed. | - |
| 58 | */ | - |
| 59 | QString QFileSystemEngine::slowCanonicalized(const QString &path) | - |
| 60 | { | - |
| 61 | if (path.isEmpty()) never evaluated: path.isEmpty() | 0 |
| 62 | return path; never executed: return path; | 0 |
| 63 | | - |
| 64 | QFileInfo fi; never executed (the execution status of this line is deduced): QFileInfo fi; | - |
| 65 | const QChar slash(QLatin1Char('/')); never executed (the execution status of this line is deduced): const QChar slash(QLatin1Char('/')); | - |
| 66 | QString tmpPath = path; never executed (the execution status of this line is deduced): QString tmpPath = path; | - |
| 67 | int separatorPos = 0; never executed (the execution status of this line is deduced): int separatorPos = 0; | - |
| 68 | QSet<QString> nonSymlinks; never executed (the execution status of this line is deduced): QSet<QString> nonSymlinks; | - |
| 69 | QSet<QString> known; never executed (the execution status of this line is deduced): QSet<QString> known; | - |
| 70 | | - |
| 71 | known.insert(path); never executed (the execution status of this line is deduced): known.insert(path); | - |
| 72 | do { | - |
| 73 | #ifdef Q_OS_WIN | - |
| 74 | if (separatorPos == 0) { | - |
| 75 | if (tmpPath.size() >= 2 && tmpPath.at(0) == slash && tmpPath.at(1) == slash) { | - |
| 76 | // UNC, skip past the first two elements | - |
| 77 | separatorPos = tmpPath.indexOf(slash, 2); | - |
| 78 | } else if (tmpPath.size() >= 3 && tmpPath.at(1) == QLatin1Char(':') && tmpPath.at(2) == slash) { | - |
| 79 | // volume root, skip since it can not be a symlink | - |
| 80 | separatorPos = 2; | - |
| 81 | } | - |
| 82 | } | - |
| 83 | if (separatorPos != -1) | - |
| 84 | #endif | - |
| 85 | separatorPos = tmpPath.indexOf(slash, separatorPos + 1); never executed (the execution status of this line is deduced): separatorPos = tmpPath.indexOf(slash, separatorPos + 1); | - |
| 86 | QString prefix = separatorPos == -1 ? tmpPath : tmpPath.left(separatorPos); never evaluated: separatorPos == -1 | 0 |
| 87 | if (!nonSymlinks.contains(prefix)) { never evaluated: !nonSymlinks.contains(prefix) | 0 |
| 88 | fi.setFile(prefix); never executed (the execution status of this line is deduced): fi.setFile(prefix); | - |
| 89 | if (fi.isSymLink()) { never evaluated: fi.isSymLink() | 0 |
| 90 | QString target = fi.symLinkTarget(); never executed (the execution status of this line is deduced): QString target = fi.symLinkTarget(); | - |
| 91 | if(QFileInfo(target).isRelative()) never evaluated: QFileInfo(target).isRelative() | 0 |
| 92 | target = fi.absolutePath() + slash + target; never executed: target = fi.absolutePath() + slash + target; | 0 |
| 93 | if (separatorPos != -1) { never evaluated: separatorPos != -1 | 0 |
| 94 | if (fi.isDir() && !target.endsWith(slash)) never evaluated: fi.isDir() never evaluated: !target.endsWith(slash) | 0 |
| 95 | target.append(slash); never executed: target.append(slash); | 0 |
| 96 | target.append(tmpPath.mid(separatorPos)); never executed (the execution status of this line is deduced): target.append(tmpPath.mid(separatorPos)); | - |
| 97 | } | 0 |
| 98 | tmpPath = QDir::cleanPath(target); never executed (the execution status of this line is deduced): tmpPath = QDir::cleanPath(target); | - |
| 99 | separatorPos = 0; never executed (the execution status of this line is deduced): separatorPos = 0; | - |
| 100 | | - |
| 101 | if (known.contains(tmpPath)) never evaluated: known.contains(tmpPath) | 0 |
| 102 | return QString(); never executed: return QString(); | 0 |
| 103 | known.insert(tmpPath); never executed (the execution status of this line is deduced): known.insert(tmpPath); | - |
| 104 | } else { | 0 |
| 105 | nonSymlinks.insert(prefix); never executed (the execution status of this line is deduced): nonSymlinks.insert(prefix); | - |
| 106 | } | 0 |
| 107 | } | - |
| 108 | } while (separatorPos != -1); never executed: } never evaluated: separatorPos != -1 | 0 |
| 109 | | - |
| 110 | return QDir::cleanPath(tmpPath); never executed: return QDir::cleanPath(tmpPath); | 0 |
| 111 | } | - |
| 112 | | - |
| 113 | static inline bool _q_checkEntry(QFileSystemEntry &entry, QFileSystemMetaData &data, bool resolvingEntry) | - |
| 114 | { | - |
| 115 | if (resolvingEntry) { evaluated: resolvingEntry| yes Evaluation Count:46 | yes Evaluation Count:155179 |
| 46-155179 |
| 116 | if (!QFileSystemEngine::fillMetaData(entry, data, QFileSystemMetaData::ExistsAttribute) partially evaluated: !QFileSystemEngine::fillMetaData(entry, data, QFileSystemMetaData::ExistsAttribute)| no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
| 117 | || !data.exists()) { partially evaluated: !data.exists()| no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
| 118 | data.clear(); never executed (the execution status of this line is deduced): data.clear(); | - |
| 119 | return false; never executed: return false; | 0 |
| 120 | } | - |
| 121 | } executed: }Execution Count:46 | 46 |
| 122 | | - |
| 123 | return true; executed: return true;Execution Count:155224 | 155224 |
| 124 | } | - |
| 125 | | - |
| 126 | static inline bool _q_checkEntry(QAbstractFileEngine *&engine, bool resolvingEntry) | - |
| 127 | { | - |
| 128 | if (resolvingEntry) { evaluated: resolvingEntry| yes Evaluation Count:1 | yes Evaluation Count:8254 |
| 1-8254 |
| 129 | if (!(engine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::ExistsFlag)) { partially evaluated: !(engine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::ExistsFlag)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 130 | delete engine; never executed (the execution status of this line is deduced): delete engine; | - |
| 131 | engine = 0; never executed (the execution status of this line is deduced): engine = 0; | - |
| 132 | return false; never executed: return false; | 0 |
| 133 | } | - |
| 134 | } executed: }Execution Count:1 | 1 |
| 135 | | - |
| 136 | return true; executed: return true;Execution Count:8255 | 8255 |
| 137 | } | - |
| 138 | | - |
| 139 | static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &entry, QFileSystemMetaData &data, | - |
| 140 | QAbstractFileEngine *&engine, bool resolvingEntry = false) | - |
| 141 | { | - |
| 142 | QString const &filePath = entry.filePath(); executed (the execution status of this line is deduced): QString const &filePath = entry.filePath(); | - |
| 143 | if ((engine = qt_custom_file_engine_handler_create(filePath))) partially evaluated: (engine = qt_custom_file_engine_handler_create(filePath))| no Evaluation Count:0 | yes Evaluation Count:163556 |
| 0-163556 |
| 144 | return _q_checkEntry(engine, resolvingEntry); never executed: return _q_checkEntry(engine, resolvingEntry); | 0 |
| 145 | | - |
| 146 | #if defined(QT_BUILD_CORE_LIB) | - |
| 147 | for (int prefixSeparator = 0; prefixSeparator < filePath.size(); ++prefixSeparator) { evaluated: prefixSeparator < filePath.size()| yes Evaluation Count:451472 | yes Evaluation Count:8758 |
| 8758-451472 |
| 148 | QChar const ch = filePath[prefixSeparator]; executed (the execution status of this line is deduced): QChar const ch = filePath[prefixSeparator]; | - |
| 149 | if (ch == QLatin1Char('/')) evaluated: ch == QLatin1Char('/')| yes Evaluation Count:146464 | yes Evaluation Count:305006 |
| 146464-305006 |
| 150 | break; executed: break;Execution Count:146465 | 146465 |
| 151 | | - |
| 152 | if (ch == QLatin1Char(':')) { evaluated: ch == QLatin1Char(':')| yes Evaluation Count:8329 | yes Evaluation Count:296677 |
| 8329-296677 |
| 153 | if (prefixSeparator == 0) { evaluated: prefixSeparator == 0| yes Evaluation Count:8255 | yes Evaluation Count:74 |
| 74-8255 |
| 154 | engine = new QResourceFileEngine(filePath); executed (the execution status of this line is deduced): engine = new QResourceFileEngine(filePath); | - |
| 155 | return _q_checkEntry(engine, resolvingEntry); executed: return _q_checkEntry(engine, resolvingEntry);Execution Count:8255 | 8255 |
| 156 | } | - |
| 157 | | - |
| 158 | if (prefixSeparator == 1) evaluated: prefixSeparator == 1| yes Evaluation Count:2 | yes Evaluation Count:72 |
| 2-72 |
| 159 | break; executed: break;Execution Count:2 | 2 |
| 160 | | - |
| 161 | const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator)); executed (the execution status of this line is deduced): const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator)); | - |
| 162 | for (int i = 0; i < paths.count(); i++) { evaluated: i < paths.count()| yes Evaluation Count:47 | yes Evaluation Count:25 |
| 25-47 |
| 163 | entry = QFileSystemEntry(QDir::cleanPath(paths.at(i) % QLatin1Char('/') % filePath.mid(prefixSeparator + 1))); executed (the execution status of this line is deduced): entry = QFileSystemEntry(QDir::cleanPath(paths.at(i) % QLatin1Char('/') % filePath.mid(prefixSeparator + 1))); | - |
| 164 | // Recurse! | - |
| 165 | if (_q_resolveEntryAndCreateLegacyEngine_recursive(entry, data, engine, true)) partially evaluated: _q_resolveEntryAndCreateLegacyEngine_recursive(entry, data, engine, true)| yes Evaluation Count:47 | no Evaluation Count:0 |
| 0-47 |
| 166 | return true; executed: return true;Execution Count:47 | 47 |
| 167 | } | 0 |
| 168 | | - |
| 169 | // entry may have been clobbered at this point. | - |
| 170 | return false; executed: return false;Execution Count:25 | 25 |
| 171 | } | - |
| 172 | | - |
| 173 | // There's no need to fully validate the prefix here. Consulting the | - |
| 174 | // unicode tables could be expensive and validation is already | - |
| 175 | // performed in QDir::setSearchPaths. | - |
| 176 | // | - |
| 177 | // if (!ch.isLetterOrNumber()) | - |
| 178 | // break; | - |
| 179 | } executed: }Execution Count:296677 | 296677 |
| 180 | #endif // defined(QT_BUILD_CORE_LIB) | - |
| 181 | | - |
| 182 | return _q_checkEntry(entry, data, resolvingEntry); executed: return _q_checkEntry(entry, data, resolvingEntry);Execution Count:155225 | 155225 |
| 183 | } | - |
| 184 | | - |
| 185 | /*! | - |
| 186 | \internal | - |
| 187 | | - |
| 188 | Resolves the \a entry (see QDir::searchPaths) and returns an engine for | - |
| 189 | it, but never a QFSFileEngine. | - |
| 190 | | - |
| 191 | Returns a file engine that can be used to access the entry. Returns 0 if | - |
| 192 | QFileSystemEngine API should be used to query and interact with the file | - |
| 193 | system object. | - |
| 194 | */ | - |
| 195 | QAbstractFileEngine *QFileSystemEngine::resolveEntryAndCreateLegacyEngine( | - |
| 196 | QFileSystemEntry &entry, QFileSystemMetaData &data) { | - |
| 197 | QFileSystemEntry copy = entry; executed (the execution status of this line is deduced): QFileSystemEntry copy = entry; | - |
| 198 | QAbstractFileEngine *engine = 0; executed (the execution status of this line is deduced): QAbstractFileEngine *engine = 0; | - |
| 199 | | - |
| 200 | if (_q_resolveEntryAndCreateLegacyEngine_recursive(copy, data, engine)) evaluated: _q_resolveEntryAndCreateLegacyEngine_recursive(copy, data, engine)| yes Evaluation Count:163484 | yes Evaluation Count:25 |
| 25-163484 |
| 201 | // Reset entry to resolved copy. | - |
| 202 | entry = copy; executed: entry = copy;Execution Count:163489 | 163489 |
| 203 | else | - |
| 204 | data.clear(); executed: data.clear();Execution Count:25 | 25 |
| 205 | | - |
| 206 | return engine; executed: return engine;Execution Count:163509 | 163509 |
| 207 | } | - |
| 208 | | - |
| 209 | //these unix functions are in this file, because they are shared by symbian port | - |
| 210 | //for open C file handles. | - |
| 211 | #ifdef Q_OS_UNIX | - |
| 212 | //static | - |
| 213 | bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data) | - |
| 214 | { | - |
| 215 | data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags; executed (the execution status of this line is deduced): data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags; | - |
| 216 | data.knownFlagsMask |= QFileSystemMetaData::PosixStatFlags; executed (the execution status of this line is deduced): data.knownFlagsMask |= QFileSystemMetaData::PosixStatFlags; | - |
| 217 | | - |
| 218 | QT_STATBUF statBuffer; executed (the execution status of this line is deduced): struct stat64 statBuffer; | - |
| 219 | if (QT_FSTAT(fd, &statBuffer) == 0) { partially evaluated: ::fstat64(fd, &statBuffer) == 0| yes Evaluation Count:148162 | no Evaluation Count:0 |
| 0-148162 |
| 220 | data.fillFromStatBuf(statBuffer); executed (the execution status of this line is deduced): data.fillFromStatBuf(statBuffer); | - |
| 221 | return true; executed: return true;Execution Count:148163 | 148163 |
| 222 | } | - |
| 223 | | - |
| 224 | return false; never executed: return false; | 0 |
| 225 | } | - |
| 226 | | - |
| 227 | #if defined(Q_OS_QNX) | - |
| 228 | static void fillStat64fromStat32(struct stat64 *statBuf64, const struct stat &statBuf32) | - |
| 229 | { | - |
| 230 | statBuf64->st_mode = statBuf32.st_mode; | - |
| 231 | statBuf64->st_size = statBuf32.st_size; | - |
| 232 | statBuf64->st_ctime = statBuf32.st_ctime; | - |
| 233 | statBuf64->st_mtime = statBuf32.st_mtime; | - |
| 234 | statBuf64->st_atime = statBuf32.st_atime; | - |
| 235 | statBuf64->st_uid = statBuf32.st_uid; | - |
| 236 | statBuf64->st_gid = statBuf32.st_gid; | - |
| 237 | } | - |
| 238 | #endif | - |
| 239 | | - |
| 240 | void QFileSystemMetaData::fillFromStatBuf(const QT_STATBUF &statBuffer) | - |
| 241 | { | - |
| 242 | // Permissions | - |
| 243 | if (statBuffer.st_mode & S_IRUSR) evaluated: statBuffer.st_mode & 0400| yes Evaluation Count:200529 | yes Evaluation Count:22 |
| 22-200529 |
| 244 | entryFlags |= QFileSystemMetaData::OwnerReadPermission; executed: entryFlags |= QFileSystemMetaData::OwnerReadPermission;Execution Count:200529 | 200529 |
| 245 | if (statBuffer.st_mode & S_IWUSR) evaluated: statBuffer.st_mode & 0200| yes Evaluation Count:200398 | yes Evaluation Count:153 |
| 153-200398 |
| 246 | entryFlags |= QFileSystemMetaData::OwnerWritePermission; executed: entryFlags |= QFileSystemMetaData::OwnerWritePermission;Execution Count:200398 | 200398 |
| 247 | if (statBuffer.st_mode & S_IXUSR) evaluated: statBuffer.st_mode & 0100| yes Evaluation Count:14223 | yes Evaluation Count:186328 |
| 14223-186328 |
| 248 | entryFlags |= QFileSystemMetaData::OwnerExecutePermission; executed: entryFlags |= QFileSystemMetaData::OwnerExecutePermission;Execution Count:14223 | 14223 |
| 249 | | - |
| 250 | if (statBuffer.st_mode & S_IRGRP) evaluated: statBuffer.st_mode & (0400 >> 3)| yes Evaluation Count:196533 | yes Evaluation Count:4017 |
| 4017-196533 |
| 251 | entryFlags |= QFileSystemMetaData::GroupReadPermission; executed: entryFlags |= QFileSystemMetaData::GroupReadPermission;Execution Count:196533 | 196533 |
| 252 | if (statBuffer.st_mode & S_IWGRP) evaluated: statBuffer.st_mode & (0200 >> 3)| yes Evaluation Count:691 | yes Evaluation Count:199859 |
| 691-199859 |
| 253 | entryFlags |= QFileSystemMetaData::GroupWritePermission; executed: entryFlags |= QFileSystemMetaData::GroupWritePermission;Execution Count:692 | 692 |
| 254 | if (statBuffer.st_mode & S_IXGRP) evaluated: statBuffer.st_mode & (0100 >> 3)| yes Evaluation Count:12215 | yes Evaluation Count:188335 |
| 12215-188335 |
| 255 | entryFlags |= QFileSystemMetaData::GroupExecutePermission; executed: entryFlags |= QFileSystemMetaData::GroupExecutePermission;Execution Count:12215 | 12215 |
| 256 | | - |
| 257 | if (statBuffer.st_mode & S_IROTH) evaluated: statBuffer.st_mode & ((0400 >> 3) >> 3)| yes Evaluation Count:196485 | yes Evaluation Count:4065 |
| 4065-196485 |
| 258 | entryFlags |= QFileSystemMetaData::OtherReadPermission; executed: entryFlags |= QFileSystemMetaData::OtherReadPermission;Execution Count:196485 | 196485 |
| 259 | if (statBuffer.st_mode & S_IWOTH) evaluated: statBuffer.st_mode & ((0200 >> 3) >> 3)| yes Evaluation Count:648 | yes Evaluation Count:199902 |
| 648-199902 |
| 260 | entryFlags |= QFileSystemMetaData::OtherWritePermission; executed: entryFlags |= QFileSystemMetaData::OtherWritePermission;Execution Count:649 | 649 |
| 261 | if (statBuffer.st_mode & S_IXOTH) evaluated: statBuffer.st_mode & ((0100 >> 3) >> 3)| yes Evaluation Count:12215 | yes Evaluation Count:188335 |
| 12215-188335 |
| 262 | entryFlags |= QFileSystemMetaData::OtherExecutePermission; executed: entryFlags |= QFileSystemMetaData::OtherExecutePermission;Execution Count:12215 | 12215 |
| 263 | | - |
| 264 | // Type | - |
| 265 | if ((statBuffer.st_mode & S_IFMT) == S_IFREG) evaluated: (statBuffer.st_mode & 0170000) == 0100000| yes Evaluation Count:187910 | yes Evaluation Count:12640 |
| 12640-187910 |
| 266 | entryFlags |= QFileSystemMetaData::FileType; executed: entryFlags |= QFileSystemMetaData::FileType;Execution Count:187910 | 187910 |
| 267 | else if ((statBuffer.st_mode & S_IFMT) == S_IFDIR) evaluated: (statBuffer.st_mode & 0170000) == 0040000| yes Evaluation Count:12401 | yes Evaluation Count:240 |
| 240-12401 |
| 268 | entryFlags |= QFileSystemMetaData::DirectoryType; executed: entryFlags |= QFileSystemMetaData::DirectoryType;Execution Count:12401 | 12401 |
| 269 | else | - |
| 270 | entryFlags |= QFileSystemMetaData::SequentialType; executed: entryFlags |= QFileSystemMetaData::SequentialType;Execution Count:240 | 240 |
| 271 | | - |
| 272 | // Attributes | - |
| 273 | entryFlags |= QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): entryFlags |= QFileSystemMetaData::ExistsAttribute; | - |
| 274 | size_ = statBuffer.st_size; executed (the execution status of this line is deduced): size_ = statBuffer.st_size; | - |
| 275 | #if defined (Q_OS_MAC) && !defined(Q_OS_IOS) \ | - |
| 276 | && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | - |
| 277 | if (statBuffer.st_flags & UF_HIDDEN) { | - |
| 278 | entryFlags |= QFileSystemMetaData::HiddenAttribute; | - |
| 279 | knownFlagsMask |= QFileSystemMetaData::HiddenAttribute; | - |
| 280 | } | - |
| 281 | #endif | - |
| 282 | | - |
| 283 | // Times | - |
| 284 | creationTime_ = statBuffer.st_ctime ? statBuffer.st_ctime : statBuffer.st_mtime; evaluated: statBuffer.st_ctim.tv_sec| yes Evaluation Count:200549 | yes Evaluation Count:2 |
| 2-200549 |
| 285 | modificationTime_ = statBuffer.st_mtime; executed (the execution status of this line is deduced): modificationTime_ = statBuffer.st_mtim.tv_sec; | - |
| 286 | accessTime_ = statBuffer.st_atime; executed (the execution status of this line is deduced): accessTime_ = statBuffer.st_atim.tv_sec; | - |
| 287 | userId_ = statBuffer.st_uid; executed (the execution status of this line is deduced): userId_ = statBuffer.st_uid; | - |
| 288 | groupId_ = statBuffer.st_gid; executed (the execution status of this line is deduced): groupId_ = statBuffer.st_gid; | - |
| 289 | } executed: }Execution Count:200551 | 200551 |
| 290 | | - |
| 291 | void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry) | - |
| 292 | { | - |
| 293 | #if defined(Q_OS_QNX) | - |
| 294 | knownFlagsMask = 0; | - |
| 295 | entryFlags = 0; | - |
| 296 | for (dirent_extra *extra = _DEXTRA_FIRST(&entry); _DEXTRA_VALID(extra, &entry); | - |
| 297 | extra = _DEXTRA_NEXT(extra)) { | - |
| 298 | if (extra->d_type == _DTYPE_STAT || extra->d_type == _DTYPE_LSTAT) { | - |
| 299 | | - |
| 300 | const struct dirent_extra_stat * const extra_stat = | - |
| 301 | reinterpret_cast<struct dirent_extra_stat *>(extra); | - |
| 302 | | - |
| 303 | // Remember whether this was a link or not, this saves an lstat() call later. | - |
| 304 | if (extra->d_type == _DTYPE_LSTAT) { | - |
| 305 | knownFlagsMask |= QFileSystemMetaData::LinkType; | - |
| 306 | if (S_ISLNK(extra_stat->d_stat.st_mode)) | - |
| 307 | entryFlags |= QFileSystemMetaData::LinkType; | - |
| 308 | } | - |
| 309 | | - |
| 310 | // For symlinks, the extra type _DTYPE_LSTAT doesn't work for filling out the meta data, | - |
| 311 | // as we need the stat() information there, not the lstat() information. | - |
| 312 | // In this case, don't use the extra information. | - |
| 313 | // Unfortunately, readdir() never seems to return extra info of type _DTYPE_STAT, so for | - |
| 314 | // symlinks, we always incur the cost of an extra stat() call later. | - |
| 315 | if (S_ISLNK(extra_stat->d_stat.st_mode) && extra->d_type == _DTYPE_LSTAT) | - |
| 316 | continue; | - |
| 317 | | - |
| 318 | #if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT) | - |
| 319 | // Even with large file support, d_stat is always of type struct stat, not struct stat64, | - |
| 320 | // so it needs to be converted | - |
| 321 | struct stat64 statBuf; | - |
| 322 | fillStat64fromStat32(&statBuf, extra_stat->d_stat); | - |
| 323 | fillFromStatBuf(statBuf); | - |
| 324 | #else | - |
| 325 | fillFromStatBuf(extra_stat->d_stat); | - |
| 326 | #endif | - |
| 327 | knownFlagsMask |= QFileSystemMetaData::PosixStatFlags; | - |
| 328 | if (!S_ISLNK(extra_stat->d_stat.st_mode)) { | - |
| 329 | knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; | - |
| 330 | entryFlags |= QFileSystemMetaData::ExistsAttribute; | - |
| 331 | } | - |
| 332 | } | - |
| 333 | } | - |
| 334 | #elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4) | - |
| 335 | // BSD4 includes Mac OS X | - |
| 336 | | - |
| 337 | // ### This will clear all entry flags and knownFlagsMask | - |
| 338 | switch (entry.d_type) | - |
| 339 | { | - |
| 340 | case DT_DIR: | - |
| 341 | knownFlagsMask = QFileSystemMetaData::LinkType executed (the execution status of this line is deduced): knownFlagsMask = QFileSystemMetaData::LinkType | - |
| 342 | | QFileSystemMetaData::FileType executed (the execution status of this line is deduced): | QFileSystemMetaData::FileType | - |
| 343 | | QFileSystemMetaData::DirectoryType executed (the execution status of this line is deduced): | QFileSystemMetaData::DirectoryType | - |
| 344 | | QFileSystemMetaData::SequentialType executed (the execution status of this line is deduced): | QFileSystemMetaData::SequentialType | - |
| 345 | | QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): | QFileSystemMetaData::ExistsAttribute; | - |
| 346 | | - |
| 347 | entryFlags = QFileSystemMetaData::DirectoryType executed (the execution status of this line is deduced): entryFlags = QFileSystemMetaData::DirectoryType | - |
| 348 | | QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): | QFileSystemMetaData::ExistsAttribute; | - |
| 349 | | - |
| 350 | break; executed: break;Execution Count:22787 | 22787 |
| 351 | | - |
| 352 | case DT_BLK: | - |
| 353 | case DT_CHR: | - |
| 354 | case DT_FIFO: | - |
| 355 | case DT_SOCK: | - |
| 356 | // ### System attribute | - |
| 357 | knownFlagsMask = QFileSystemMetaData::LinkType executed (the execution status of this line is deduced): knownFlagsMask = QFileSystemMetaData::LinkType | - |
| 358 | | QFileSystemMetaData::FileType executed (the execution status of this line is deduced): | QFileSystemMetaData::FileType | - |
| 359 | | QFileSystemMetaData::DirectoryType executed (the execution status of this line is deduced): | QFileSystemMetaData::DirectoryType | - |
| 360 | | QFileSystemMetaData::BundleType executed (the execution status of this line is deduced): | QFileSystemMetaData::BundleType | - |
| 361 | | QFileSystemMetaData::AliasType executed (the execution status of this line is deduced): | QFileSystemMetaData::AliasType | - |
| 362 | | QFileSystemMetaData::SequentialType executed (the execution status of this line is deduced): | QFileSystemMetaData::SequentialType | - |
| 363 | | QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): | QFileSystemMetaData::ExistsAttribute; | - |
| 364 | | - |
| 365 | entryFlags = QFileSystemMetaData::SequentialType executed (the execution status of this line is deduced): entryFlags = QFileSystemMetaData::SequentialType | - |
| 366 | | QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): | QFileSystemMetaData::ExistsAttribute; | - |
| 367 | | - |
| 368 | break; executed: break;Execution Count:160 | 160 |
| 369 | | - |
| 370 | case DT_LNK: | - |
| 371 | knownFlagsMask = QFileSystemMetaData::LinkType; executed (the execution status of this line is deduced): knownFlagsMask = QFileSystemMetaData::LinkType; | - |
| 372 | entryFlags = QFileSystemMetaData::LinkType; executed (the execution status of this line is deduced): entryFlags = QFileSystemMetaData::LinkType; | - |
| 373 | break; executed: break;Execution Count:1993 | 1993 |
| 374 | | - |
| 375 | case DT_REG: | - |
| 376 | knownFlagsMask = QFileSystemMetaData::LinkType executed (the execution status of this line is deduced): knownFlagsMask = QFileSystemMetaData::LinkType | - |
| 377 | | QFileSystemMetaData::FileType executed (the execution status of this line is deduced): | QFileSystemMetaData::FileType | - |
| 378 | | QFileSystemMetaData::DirectoryType executed (the execution status of this line is deduced): | QFileSystemMetaData::DirectoryType | - |
| 379 | | QFileSystemMetaData::BundleType executed (the execution status of this line is deduced): | QFileSystemMetaData::BundleType | - |
| 380 | | QFileSystemMetaData::SequentialType executed (the execution status of this line is deduced): | QFileSystemMetaData::SequentialType | - |
| 381 | | QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): | QFileSystemMetaData::ExistsAttribute; | - |
| 382 | | - |
| 383 | entryFlags = QFileSystemMetaData::FileType executed (the execution status of this line is deduced): entryFlags = QFileSystemMetaData::FileType | - |
| 384 | | QFileSystemMetaData::ExistsAttribute; executed (the execution status of this line is deduced): | QFileSystemMetaData::ExistsAttribute; | - |
| 385 | | - |
| 386 | break; executed: break;Execution Count:61884 | 61884 |
| 387 | | - |
| 388 | case DT_UNKNOWN: | - |
| 389 | default: | - |
| 390 | clear(); never executed (the execution status of this line is deduced): clear(); | - |
| 391 | } | 0 |
| 392 | #else | - |
| 393 | Q_UNUSED(entry) | - |
| 394 | #endif | - |
| 395 | } executed: }Execution Count:86823 | 86823 |
| 396 | | - |
| 397 | #endif | - |
| 398 | | - |
| 399 | //static | - |
| 400 | QString QFileSystemEngine::resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &metaData) | - |
| 401 | { | - |
| 402 | #if defined(Q_OS_WIN) | - |
| 403 | Q_UNUSED(metaData); | - |
| 404 | return QFileSystemEngine::owner(entry, QAbstractFileEngine::OwnerUser); | - |
| 405 | #else //(Q_OS_UNIX) | - |
| 406 | if (!metaData.hasFlags(QFileSystemMetaData::UserId)) never evaluated: !metaData.hasFlags(QFileSystemMetaData::UserId) | 0 |
| 407 | QFileSystemEngine::fillMetaData(entry, metaData, QFileSystemMetaData::UserId); never executed: QFileSystemEngine::fillMetaData(entry, metaData, QFileSystemMetaData::UserId); | 0 |
| 408 | return resolveUserName(metaData.userId()); never executed: return resolveUserName(metaData.userId()); | 0 |
| 409 | #endif | - |
| 410 | } | - |
| 411 | | - |
| 412 | //static | - |
| 413 | QString QFileSystemEngine::resolveGroupName(const QFileSystemEntry &entry, QFileSystemMetaData &metaData) | - |
| 414 | { | - |
| 415 | #if defined(Q_OS_WIN) | - |
| 416 | Q_UNUSED(metaData); | - |
| 417 | return QFileSystemEngine::owner(entry, QAbstractFileEngine::OwnerGroup); | - |
| 418 | #else //(Q_OS_UNIX) | - |
| 419 | if (!metaData.hasFlags(QFileSystemMetaData::GroupId)) never evaluated: !metaData.hasFlags(QFileSystemMetaData::GroupId) | 0 |
| 420 | QFileSystemEngine::fillMetaData(entry, metaData, QFileSystemMetaData::GroupId); never executed: QFileSystemEngine::fillMetaData(entry, metaData, QFileSystemMetaData::GroupId); | 0 |
| 421 | return resolveGroupName(metaData.groupId()); never executed: return resolveGroupName(metaData.groupId()); | 0 |
| 422 | #endif | - |
| 423 | } | - |
| 424 | | - |
| 425 | QT_END_NAMESPACE | - |
| 426 | | - |
| | |