diff --git a/programs/winefile/Makefile.in b/programs/winefile/Makefile.in index f400846..5106718 100644 --- a/programs/winefile/Makefile.in +++ b/programs/winefile/Makefile.in @@ -1,7 +1,7 @@ EXTRADEFS = -D__WINE__ MODULE = winefile.exe APPMODE = -mwindows -municode -IMPORTS = uuid shell32 comdlg32 comctl32 ole32 mpr version user32 gdi32 advapi32 +IMPORTS = uuid shell32 comdlg32 comctl32 ole32 mpr version user32 gdi32 advapi32 shlwapi C_SRCS = \ splitpath.c \ diff --git a/programs/winefile/resource.h b/programs/winefile/resource.h index 99f94aa..f4a9f134 100644 --- a/programs/winefile/resource.h +++ b/programs/winefile/resource.h @@ -128,9 +128,6 @@ #define IDS_COL_ATTR 1217 #define IDS_COL_SEC 1218 #define IDS_FREE_SPACE_FMT 1219 -#define IDS_UNIT_KB 1220 -#define IDS_UNIT_MB 1221 -#define IDS_UNIT_GB 1222 /* range for drive bar command ids: 0x9000..0x90FF */ diff --git a/programs/winefile/winefile.c b/programs/winefile/winefile.c index 327e92a..27079bb 100644 --- a/programs/winefile/winefile.c +++ b/programs/winefile/winefile.c @@ -2640,39 +2640,6 @@ static int insert_entries(Pane* pane, Entry* dir, LPCWSTR pattern, int filter_fl return idx; } - -static void format_bytes(LPWSTR buffer, LONGLONG bytes) -{ - static const WCHAR sFmtSmall[] = {'%', 'u', 0}; - static const WCHAR sFmtBig[] = {'%', '.', '1', 'f', ' ', '%', 's', '\0'}; - - if (bytes < 1024) - sprintfW(buffer, sFmtSmall, (DWORD)bytes); - else - { - WCHAR unit[64]; - UINT resid; - float fBytes; - if (bytes >= 1073741824) /* 1 GB */ - { - fBytes = ((float)bytes)/1073741824.f+.5f; - resid = IDS_UNIT_GB; - } - else if (bytes >= 1048576) /* 1 MB */ - { - fBytes = ((float)bytes)/1048576.f+.5f; - resid = IDS_UNIT_MB; - } - else /* bytes >= 1024 */ /* 1 kB */ - { - fBytes = ((float)bytes)/1024.f+.5f; - resid = IDS_UNIT_KB; - } - LoadStringW(Globals.hInstance, resid, unit, sizeof(unit)/sizeof(*unit)); - sprintfW(buffer, sFmtBig, fBytes, unit); - } -} - static void set_space_status(void) { ULARGE_INTEGER ulFreeBytesToCaller, ulTotalBytes, ulFreeBytes; @@ -2680,10 +2647,10 @@ static void set_space_status(void) if (GetDiskFreeSpaceExW(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) { DWORD_PTR args[2]; - format_bytes(b1, ulFreeBytesToCaller.QuadPart); - format_bytes(b2, ulTotalBytes.QuadPart); - args[0] = (DWORD_PTR)b1; - args[1] = (DWORD_PTR)b2; + + args[0] = (DWORD_PTR)StrFormatByteSizeW(ulFreeBytesToCaller.QuadPart, b1, sizeof(b1)/sizeof(*b1)); + args[1] = (DWORD_PTR)StrFormatByteSizeW(ulTotalBytes.QuadPart, b2, sizeof(b2)/sizeof(*b2)); + FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, RS(fmt,IDS_FREE_SPACE_FMT), 0, 0, buffer, sizeof(buffer)/sizeof(*buffer), (__ms_va_list*)args); diff --git a/programs/winefile/winefile.h b/programs/winefile/winefile.h index 31a1868..1ce3d4c 100644 --- a/programs/winefile/winefile.h +++ b/programs/winefile/winefile.h @@ -38,6 +38,7 @@ #include #include +#include #include /* for ShellExecuteW() */ #include diff --git a/programs/winefile/winefile.rc b/programs/winefile/winefile.rc index 758f740..1ea8315 100644 --- a/programs/winefile/winefile.rc +++ b/programs/winefile/winefile.rc @@ -114,9 +114,6 @@ STRINGTABLE IDS_COL_SEC "Security" IDS_FREE_SPACE_FMT "%1 of %2 free" - IDS_UNIT_KB "#msgctxt#unit kilobyte#kB" - IDS_UNIT_MB "#msgctxt#unit megabyte#MB" - IDS_UNIT_GB "#msgctxt#unit gigabyte#GB" } IDD_SELECT_DESTINATION DIALOG 15, 13, 210, 63