Andrew Talbot : shlwapi: Add size parameters to function that takes array arguments.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Sep 28 07:35:49 CDT 2006


Module: wine
Branch: master
Commit: b19c98481a6342c744926e60f5bc36f4ea8b0442
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=b19c98481a6342c744926e60f5bc36f4ea8b0442

Author: Andrew Talbot <Andrew.Talbot at talbotville.com>
Date:   Wed Sep 27 19:27:37 2006 +0100

shlwapi: Add size parameters to function that takes array arguments.

---

 dlls/shlwapi/string.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c
index ac5970f..f839546 100644
--- a/dlls/shlwapi/string.c
+++ b/dlls/shlwapi/string.c
@@ -66,7 +66,8 @@ static HRESULT WINAPI _SHStrDupAA(LPCSTR
 static HRESULT WINAPI _SHStrDupAW(LPCWSTR,LPSTR*);
 
 
-static void FillNumberFmt(NUMBERFMTW *fmt, WCHAR decimal_buffer[8], WCHAR thousand_buffer[8])
+static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bufwlen,
+                          LPWSTR thousand_buffer, int thousand_bufwlen)
 {
   WCHAR grouping[64];
   WCHAR *c;
@@ -74,11 +75,11 @@ static void FillNumberFmt(NUMBERFMTW *fm
   GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ILZERO|LOCALE_RETURN_NUMBER, (LPWSTR)&fmt->LeadingZero, sizeof(fmt->LeadingZero)/sizeof(WCHAR));
   GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER|LOCALE_RETURN_NUMBER, (LPWSTR)&fmt->LeadingZero, sizeof(fmt->NegativeOrder)/sizeof(WCHAR));
   fmt->NumDigits = 0;
-  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, decimal_buffer, sizeof(decimal_buffer)/sizeof(WCHAR));
-  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, thousand_buffer, sizeof(thousand_buffer)/sizeof(WCHAR));
+  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, decimal_buffer, decimal_bufwlen);
+  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, thousand_buffer, thousand_bufwlen);
   fmt->lpThousandSep = thousand_buffer;
   fmt->lpDecimalSep = decimal_buffer;
-  
+
   /* 
    * Converting grouping string to number as described on 
    * http://blogs.msdn.com/oldnewthing/archive/2006/04/18/578251.aspx
@@ -114,8 +115,9 @@ static int FormatInt(LONGLONG qdwValue, 
   WCHAR *c;
   BOOL neg = (qdwValue < 0);
 
-  FillNumberFmt(&fmt, decimal, thousand);  
-    
+  FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR),
+                thousand, sizeof thousand / sizeof (WCHAR));
+
   c = &buf[24];
   *(--c) = 0;
   do
@@ -147,7 +149,8 @@ static int FormatDouble(double value, in
   
   snprintfW(buf, 64, flfmt, value);
 
-  FillNumberFmt(&fmt, decimal, thousand);  
+  FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR),
+                 thousand, sizeof thousand / sizeof (WCHAR));
   fmt.NumDigits = decimals;
   return GetNumberFormatW(LOCALE_USER_DEFAULT, 0, buf, &fmt, pszBuf, cchBuf);
 }




More information about the wine-cvs mailing list