diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-07-11 16:08:00 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-16 20:08:31 +0000 |
commit | 8617ce5c881c7913e144153494b15d60ca0c0e83 (patch) | |
tree | 88cfebc8386a1d0f6b0a4d52c2321d3d380dee81 /src/gui/text/qzip.cpp | |
parent | ff00b2efbd359b1241dfdc4caf325d8f4b7e6118 (diff) |
Use QStringRef() more, exploiting its new ::chop()
Change-Id: Id2201639be604b9a32b2dc5d21e675a961bee477
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/text/qzip.cpp')
-rw-r--r-- | src/gui/text/qzip.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index 7cb89543ba..b68c36fd9e 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -498,11 +498,13 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const // fix the file path, if broken (convert separators, eat leading and trailing ones) fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath); - while (!fileInfo.filePath.isEmpty() && (fileInfo.filePath.at(0) == QLatin1Char('.') || fileInfo.filePath.at(0) == QLatin1Char('/'))) - fileInfo.filePath = fileInfo.filePath.mid(1); - while (!fileInfo.filePath.isEmpty() && fileInfo.filePath.at(fileInfo.filePath.size() - 1) == QLatin1Char('/')) - fileInfo.filePath.chop(1); + QStringRef filePathRef(&fileInfo.filePath); + while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/'))) + filePathRef = filePathRef.mid(1); + while (filePathRef.endsWith(QLatin1Char('/'))) + filePathRef.chop(1); + fileInfo.filePath = filePathRef.toString(); return fileInfo; } |