shlwapi: Resupply array sizes stripped by function interface

Andrew Talbot Andrew.Talbot at talbotville.com
Sun Sep 24 14:52:29 CDT 2006


If I'm not mistaken... :)

A formal parameter declared as an array is treated as a pointer; any size
specifier is ignored. So here, sizeof decimal_buffer, for example, would
equate to the size of a pointer to WCHAR, not to that of an array of eight
WCHARs.

-- Andy.
---
Changelog:
    shlwapi: Resupply array sizes stripped by function interface.

diff -urN a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c
--- a/dlls/shlwapi/string.c	2006-08-23 22:37:14.000000000 +0100
+++ b/dlls/shlwapi/string.c	2006-09-24 20:04:39.000000000 +0100
@@ -66,16 +66,17 @@
 static HRESULT WINAPI _SHStrDupAW(LPCWSTR,LPSTR*);
 
 
-static void FillNumberFmt(NUMBERFMTW *fmt, WCHAR decimal_buffer[8], WCHAR thousand_buffer[8])
+static void FillNumberFmt(NUMBERFMTW *fmt, WCHAR *decimal_buffer, WCHAR *thousand_buffer)
 {
   WCHAR grouping[64];
   WCHAR *c;
+  int buflen = 8;
 
   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, buflen);
+  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, thousand_buffer, buflen);
   fmt->lpThousandSep = thousand_buffer;
   fmt->lpDecimalSep = decimal_buffer;
   



More information about the wine-patches mailing list