mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Simplify function call
This commit is contained in:
parent
b971eb52ee
commit
5608827429
1 changed files with 3 additions and 19 deletions
|
@ -310,26 +310,10 @@ qlonglong Utils::Fs::freeDiskSpaceOnPath(QString path)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR,
|
ULARGE_INTEGER bytesFree;
|
||||||
PULARGE_INTEGER,
|
if (GetDiskFreeSpaceExW((LPCTSTR)(toNativePath(dir_path.path())).utf16(), &bytesFree, NULL, NULL) == 0)
|
||||||
PULARGE_INTEGER,
|
|
||||||
PULARGE_INTEGER);
|
|
||||||
GetDiskFreeSpaceEx_t pGetDiskFreeSpaceEx =
|
|
||||||
(GetDiskFreeSpaceEx_t)::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "GetDiskFreeSpaceExW");
|
|
||||||
if (pGetDiskFreeSpaceEx) {
|
|
||||||
ULARGE_INTEGER bytesFree, bytesTotal;
|
|
||||||
unsigned long long *ret;
|
|
||||||
if (pGetDiskFreeSpaceEx((LPCTSTR)(toNativePath(dir_path.path())).utf16(), &bytesFree, &bytesTotal, NULL)) {
|
|
||||||
ret = (unsigned long long*)&bytesFree;
|
|
||||||
return *ret;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
return qlonglong(bytesFree.QuadPart);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue