shlwapi: Don't use a long where an int is more than big enough.

Francois Gouget fgouget at free.fr
Tue Oct 18 09:46:29 CDT 2011


---

Long format specifiers are almost always used incorrectly so the fewer 
of them I have to review the better. In this case we want to print a 
value between 0 and 1023 so that should fit in an int with no trouble.

 dlls/shlwapi/shlwapi.rc |    2 +-
 dlls/shlwapi/string.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/shlwapi/shlwapi.rc b/dlls/shlwapi/shlwapi.rc
index a360b20..a942115 100644
--- a/dlls/shlwapi/shlwapi.rc
+++ b/dlls/shlwapi/shlwapi.rc
@@ -24,7 +24,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
 
 STRINGTABLE
 {
-    IDS_BYTES_FORMAT    "%ld bytes"
+    IDS_BYTES_FORMAT    "%d bytes"
     IDS_TIME_INTERVAL_HOURS    "#msgctxt#time unit: hours# hr"
     IDS_TIME_INTERVAL_MINUTES  "#msgctxt#time unit: minutes# min"
     IDS_TIME_INTERVAL_SECONDS  "#msgctxt#time unit: seconds# sec"
diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c
index 3519b34..9578565 100644
--- a/dlls/shlwapi/string.c
+++ b/dlls/shlwapi/string.c
@@ -2344,7 +2344,7 @@ LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
   {
     WCHAR wszBytesFormat[64];
     LoadStringW(shlwapi_hInstance, IDS_BYTES_FORMAT, wszBytesFormat, 64);
-    snprintfW(lpszDest, cchMax, wszBytesFormat, (long)llBytes);
+    snprintfW(lpszDest, cchMax, wszBytesFormat, (int)llBytes);
     return lpszDest;
   }
 
-- 
1.7.6.3



More information about the wine-patches mailing list