summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2009-08-11 16:11:39 (GMT)
committerJoerg Bornemann <joerg.bornemann@trolltech.com>2009-08-11 16:24:20 (GMT)
commita7e9efcb96a93f23636e8bc98bb89b705a82cbf4 (patch)
tree26fe96bc98d2b5caa0afdfffa7ba2340d4f25779
parent1ff4c70e181e79456690a23a3af97cfef52c9f5e (diff)
downloadQt-a7e9efcb96a93f23636e8bc98bb89b705a82cbf4.zip
Qt-a7e9efcb96a93f23636e8bc98bb89b705a82cbf4.tar.gz
Qt-a7e9efcb96a93f23636e8bc98bb89b705a82cbf4.tar.bz2
optimize longFileName() a bit
isUncPath() is always called with native separator-ed paths, so we can avoid needless comparisons; don't declare isUncPath() under CE since it never used Merge-request: 1176 Reviewed-by: Joerg Bornemann <joerg.bornemann@trolltech.com>
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 9e341b9..a6c2c17 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -295,13 +295,14 @@ static bool isUncRoot(const QString &server)
return localPath.isEmpty();
}
+#if !defined(Q_OS_WINCE)
static bool isUncPath(const QString &path)
{
- // Starts with // or \\, but not \\. or //.
- return (path.startsWith(QLatin1String("//"))
- || path.startsWith(QLatin1String("\\\\")))
- && (path.size() > 2 && path.at(2) != QLatin1Char('.'));
+ // Starts with \\, but not \\.
+ return (path.startsWith(QLatin1String("\\\\"))
+ && path.size() > 2 && path.at(2) != QLatin1Char('.'));
}
+#endif
static bool isRelativePath(const QString &path)
{
@@ -398,7 +399,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path)
#if !defined(Q_OS_WINCE)
QString prefix = QLatin1String("\\\\?\\");
if (isUncPath(absPath)) {
- prefix = QLatin1String("\\\\?\\UNC\\");
+ prefix.append(QLatin1String("UNC\\")); // "\\\\?\\UNC\\"
absPath.remove(0, 2);
}
return prefix + absPath;