1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-17 19:18:36 +01:00

Use ScopedWCharArray

This commit is contained in:
Jonas Kvinge 2020-12-12 12:50:33 +01:00
parent a86640fdee
commit d5a0d67c7b

View File

@ -215,7 +215,12 @@ quint64 FileSystemCapacity(const QString &path) {
return quint64(fs_info.f_blocks) * quint64(fs_info.f_bsize);
#elif defined(Q_OS_WIN32)
_ULARGE_INTEGER ret;
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), nullptr,&ret, nullptr) != 0)
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ScopedWCharArray wchar(QDir::toNativeSeparators(path));
if (GetDiskFreeSpaceEx(wchar.get(), nullptr, &ret, nullptr) != 0)
# else
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), nullptr, &ret, nullptr) != 0)
# endif
return ret.QuadPart;
#endif
@ -231,7 +236,12 @@ quint64 FileSystemFreeSpace(const QString &path) {
return quint64(fs_info.f_bavail) * quint64(fs_info.f_bsize);
#elif defined(Q_OS_WIN32)
_ULARGE_INTEGER ret;
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ScopedWCharArray wchar(QDir::toNativeSeparators(path));
if (GetDiskFreeSpaceEx(wchar.get(), &ret, nullptr, nullptr) != 0)
# else
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), &ret, nullptr, nullptr) != 0)
# endif
return ret.QuadPart;
#endif