summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2016-02-04 09:41:22 +0100
committerEdward Welbourne <edward.welbourne@theqtcompany.com>2016-02-09 16:12:12 +0000
commit22c262d2d7a7c262c7cecf68c2f6bef5ec29e6b5 (patch)
treeb50aee87bcf43cab7bf30a7520cc67013aa1caf2 /src/corelib
parent2ddd11dde2131ff403aa522e5aa3f6bbb836dccc (diff)
Readability fix for MS isRelative, isAbsolute.
The layout and phrasing of these two QFileSystemEntry methods was such as to obscure what they actually test. (Overlong lines, extraneous parentheses, spurious conditions and poor line-breaking.) Rewrote to make both clearer; and, in particular, to make it obvious that they are *not* mutually complementary. Behavior is not changed. Change-Id: If748e48d41fe3a76bab3a1f840c7b7ca62442f8f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfilesystementry.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index c590d81f7a..9bd31932b3 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -260,17 +260,21 @@ QString QFileSystemEntry::completeSuffix() const
bool QFileSystemEntry::isRelative() const
{
resolveFilePath();
- return (m_filePath.isEmpty() || (!m_filePath.isEmpty() && (m_filePath.at(0).unicode() != '/')
- && (!(m_filePath.length() >= 2 && m_filePath.at(1).unicode() == ':'))));
+ return (m_filePath.isEmpty()
+ || (m_filePath.at(0).unicode() != '/'
+ && !(m_filePath.length() >= 2 && m_filePath.at(1).unicode() == ':')));
}
bool QFileSystemEntry::isAbsolute() const
{
resolveFilePath();
- return (!m_filePath.isEmpty() && ((m_filePath.length() >= 3
- && (m_filePath.at(0).isLetter() && m_filePath.at(1).unicode() == ':' && m_filePath.at(2).unicode() == '/'))
- || (m_filePath.length() >= 2 && (m_filePath.at(0) == QLatin1Char('/') && m_filePath.at(1) == QLatin1Char('/')))
- ));
+ return ((m_filePath.length() >= 3
+ && m_filePath.at(0).isLetter()
+ && m_filePath.at(1).unicode() == ':'
+ && m_filePath.at(2).unicode() == '/')
+ || (m_filePath.length() >= 2
+ && m_filePath.at(0) == QLatin1Char('/')
+ && m_filePath.at(1) == QLatin1Char('/')));
}
#else
bool QFileSystemEntry::isRelative() const