diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-04-20 14:45:37 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-04-20 18:43:38 (GMT) |
commit | 96805a53d08a2f86b19aa77255a1e6467513def2 (patch) | |
tree | 00754278e8269156604b52350d37d74ed758174d /src | |
parent | 0ccdad9d1d84b23072f8a17e3cb06cf2f1b71792 (diff) | |
download | Qt-96805a53d08a2f86b19aa77255a1e6467513def2.zip Qt-96805a53d08a2f86b19aa77255a1e6467513def2.tar.gz Qt-96805a53d08a2f86b19aa77255a1e6467513def2.tar.bz2 |
fix nativeFilePath character width issue
the variable is a byte array, but it holds wchar_t's.
Reviewed-by: joerg
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfsfileengine_win.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index eeca07e..ec49f1a 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -542,11 +542,13 @@ qint64 QFSFileEnginePrivate::nativeSize() const if (errorCode == ERROR_ACCESS_DENIED || errorCode == ERROR_SHARING_VIOLATION) { QByteArray path = nativeFilePath; // path for the FindFirstFile should not end with a trailing slash - while (path.endsWith('\\')) - path.chop(1); + while (!path.isEmpty() && reinterpret_cast<const wchar_t *>( + path.constData() + path.length())[-1] == '\\') + path.chop(2); // FindFirstFile can not handle drives - if (!path.endsWith(':')) { + if (!path.isEmpty() && reinterpret_cast<const wchar_t *>( + path.constData() + path.length())[-1] != ':') { WIN32_FIND_DATA findData; HANDLE hFind = ::FindFirstFile((const wchar_t*)path.constData(), &findData); |