Commit 428520d8 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

don't include zero terminator into the string

fixes "run in terminal" and potentially numerous other bugs.

Task-number: QTCREATORBUG-4012
parent 919acf57
......@@ -160,7 +160,7 @@ QTCREATOR_UTILS_EXPORT QString getShortPathName(const QString &name, QString *er
return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);
(*getShortPathNameW)(nameC, buffer.data(), length);
const QString rc = QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.data()), length);
const QString rc = QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.data()), length - 1);
return rc;
}
......@@ -192,7 +192,7 @@ QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name, QString *err
return name;
QScopedArrayPointer<TCHAR> buffer(new TCHAR[length]);
(*getLongPathNameW)(nameC, buffer.data(), length);
const QString rc = QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.data()), length);
const QString rc = QString::fromUtf16(reinterpret_cast<const ushort *>(buffer.data()), length - 1);
return rc;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment