From 22c262d2d7a7c262c7cecf68c2f6bef5ec29e6b5 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 4 Feb 2016 09:41:22 +0100 Subject: 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 --- src/corelib/io/qfilesystementry.cpp | 16 ++++++++++------ 1 file 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 -- cgit v1.2.3