From a7e9efcb96a93f23636e8bc98bb89b705a82cbf4 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Tue, 11 Aug 2009 18:11:39 +0200 Subject: 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 --- src/corelib/io/qfsfileengine_win.cpp | 11 ++++++----- 1 file 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; -- cgit v0.12