[PATCH] taskmgr: use StrFormatKBSizeW to show memory usage

Vijay Kiran Kamuju infyquest at gmail.com
Wed Apr 3 07:53:48 CDT 2019


Superceeds Patch# 162216

From: Vijay Kiran Kamuju <infyquest at gmail.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
---
 programs/taskmgr/Makefile.in | 2 +-
 programs/taskmgr/graph.c     | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/programs/taskmgr/Makefile.in b/programs/taskmgr/Makefile.in
index 48313e93e66..e0f4daebe24 100644
--- a/programs/taskmgr/Makefile.in
+++ b/programs/taskmgr/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = taskmgr.exe
 APPMODE   = -mwindows -mno-cygwin
-IMPORTS   = shell32 comctl32 user32 gdi32 advapi32
+IMPORTS   = shell32 comctl32 user32 gdi32 advapi32 shlwapi
 
 C_SRCS = \
 	about.c \
diff --git a/programs/taskmgr/graph.c b/programs/taskmgr/graph.c
index 7e978e16f7a..f5190a101e9 100644
--- a/programs/taskmgr/graph.c
+++ b/programs/taskmgr/graph.c
@@ -26,6 +26,7 @@
 
 #include <windows.h>
 #include <commctrl.h>
+#include <shlwapi.h>
 #include <winnt.h>
 
 #include "taskmgr.h"
@@ -239,8 +240,6 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
 /* Top bars that are "unused", i.e. are dark green, representing free memory */
     int                i;
 
-    static const WCHAR    wszFormat[] = {'%','d','K',0};
-    
     /*
      * Get the client area rectangle
      */
@@ -257,7 +256,7 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
     CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK();
     CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
 
-    swprintf(Text, wszFormat, (int)CommitChargeTotal);
+    StrFormatKBSizeW(CommitChargeTotal, Text, ARRAY_SIZE(Text));
     
     /*
      * Draw the font text onto the graph
-- 
2.17.0




More information about the wine-devel mailing list