mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[SYSDM] Better formatting of user profile size
This commit is contained in:
parent
1601afd0a6
commit
b5368185da
2 changed files with 2 additions and 30 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <tchar.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
#include <setupapi.h>
|
||||
#include <cpl.h>
|
||||
|
||||
|
|
|
@ -433,35 +433,6 @@ GetProfileName(
|
|||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
FormatProfileSize(
|
||||
_Out_ LPWSTR Buffer,
|
||||
_In_ double size)
|
||||
{
|
||||
const LPWSTR units[] = {L"MB", L"GB", L"TB"};
|
||||
int i = 0, j;
|
||||
|
||||
size /= 1024;
|
||||
size /= 1024;
|
||||
|
||||
while (size >= 1024 && i < 3)
|
||||
{
|
||||
size /= 1024;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (size < 10)
|
||||
j = 2;
|
||||
else if (size < 100)
|
||||
j = 1;
|
||||
else
|
||||
j = 0;
|
||||
|
||||
swprintf(Buffer, L"%.*f %s", j, size, units[i]);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
AddUserProfile(
|
||||
_In_ HWND hwndListView,
|
||||
|
@ -585,7 +556,7 @@ AddUserProfile(
|
|||
iItem = ListView_InsertItem(hwndListView, &lvi);
|
||||
|
||||
/* Set the profile size */
|
||||
FormatProfileSize(szNameBuffer, (double)ullProfileSize);
|
||||
StrFormatByteSizeW(ullProfileSize, szNameBuffer, ARRAYSIZE(szNameBuffer) - 1);
|
||||
ListView_SetItemText(hwndListView, iItem, 1, szNameBuffer);
|
||||
|
||||
/* Set the profile type */
|
||||
|
|
Loading…
Reference in a new issue