From 894a81a1fbb12fbde923015a517a7fcdcae923b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 12 May 2015 11:37:17 +0100 Subject: Fix hidden detach The methods are const but the member is mutable. Spotted being detached a few times at app startup. Strings were a few hundred chars big. Change-Id: Iaa3dc42a4f01f819a3fc4f8d756e35d38ce0aa1b Reviewed-by: David Faure --- src/corelib/io/qfilesystementry.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index faaf7a00af..79f16a0839 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -255,15 +255,15 @@ QString QFileSystemEntry::completeSuffix() const bool QFileSystemEntry::isRelative() const { resolveFilePath(); - return (m_filePath.isEmpty() || (!m_filePath.isEmpty() && (m_filePath[0].unicode() != '/') - && (!(m_filePath.length() >= 2 && m_filePath[1].unicode() == ':')))); + return (m_filePath.isEmpty() || (!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[0].isLetter() && m_filePath[1].unicode() == ':' && m_filePath[2].unicode() == '/')) + && (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('/'))) )); } @@ -276,7 +276,7 @@ bool QFileSystemEntry::isRelative() const bool QFileSystemEntry::isAbsolute() const { resolveFilePath(); - return (!m_filePath.isEmpty() && (m_filePath[0].unicode() == '/')); + return (!m_filePath.isEmpty() && (m_filePath.at(0).unicode() == '/')); } #endif @@ -337,10 +337,10 @@ void QFileSystemEntry::findFileNameSeparators() const int i = m_filePath.size() - 1; for (; i >= stop; --i) { - if (m_filePath[i].unicode() == '.') { + if (m_filePath.at(i).unicode() == '.') { firstDotInFileName = lastDotInFileName = i; break; - } else if (m_filePath[i].unicode() == '/') { + } else if (m_filePath.at(i).unicode() == '/') { lastSeparator = i; break; } @@ -348,9 +348,9 @@ void QFileSystemEntry::findFileNameSeparators() const if (lastSeparator != i) { for (--i; i >= stop; --i) { - if (m_filePath[i].unicode() == '.') + if (m_filePath.at(i).unicode() == '.') firstDotInFileName = i; - else if (m_filePath[i].unicode() == '/') { + else if (m_filePath.at(i).unicode() == '/') { lastSeparator = i; break; } -- cgit v1.2.3