Skip to content
Snippets Groups Projects
Commit f6ebc857 authored by rswindell's avatar rswindell
Browse files

getfreediskspace() - treat unit value of 1 the same as 0 (no need to divide

or shift).
parent 310b41a6
No related branches found
No related tags found
No related merge requests found
...@@ -619,7 +619,7 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit) ...@@ -619,7 +619,7 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit)
NULL)) // receives the free bytes on disk NULL)) // receives the free bytes on disk
return(0); return(0);
if(unit) if(unit>1)
avail.QuadPart=Int64ShrlMod32(avail.QuadPart,bit_num(unit)); avail.QuadPart=Int64ShrlMod32(avail.QuadPart,bit_num(unit));
#if defined(_ANONYMOUS_STRUCT) #if defined(_ANONYMOUS_STRUCT)
...@@ -647,7 +647,7 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit) ...@@ -647,7 +647,7 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit)
)) ))
return(0); return(0);
if(unit) if(unit>1)
NumberOfFreeClusters/=unit; NumberOfFreeClusters/=unit;
return(NumberOfFreeClusters*SectorsPerCluster*BytesPerSector); return(NumberOfFreeClusters*SectorsPerCluster*BytesPerSector);
...@@ -660,7 +660,7 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit) ...@@ -660,7 +660,7 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit)
if (statfs(path, &fs) < 0) if (statfs(path, &fs) < 0)
return 0; return 0;
if(unit) if(unit>1)
fs.f_bavail/=unit; fs.f_bavail/=unit;
return fs.f_bsize * fs.f_bavail; return fs.f_bsize * fs.f_bavail;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment