Fixed callers of GetLocaleInfoW to use the correct buffer size.

This commit is contained in:
Alexandre Julliard 2004-02-25 01:35:01 +00:00
parent f39be9ff48
commit b65d13605c
3 changed files with 9 additions and 9 deletions

View File

@ -143,8 +143,8 @@ static const char *debugstr_lang( LANGID lang )
char buffer[8];
LCID lcid = MAKELCID( lang, SORT_DEFAULT );
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE, langW, sizeof(langW));
GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE, countryW, sizeof(countryW));
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE, langW, sizeof(langW)/sizeof(WCHAR));
GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE, countryW, sizeof(countryW)/sizeof(WCHAR));
strcpyWtoA( buffer, langW );
strcat( buffer, "_" );
strcpyWtoA( buffer + strlen(buffer), countryW );
@ -322,9 +322,9 @@ static BOOL CALLBACK find_language_id_proc( HMODULE hModule, LPCWSTR type,
buf_country[0] = 0;
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE,
buf_language, sizeof(buf_language));
buf_language, sizeof(buf_language)/sizeof(WCHAR));
GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
buf_country, sizeof(buf_country));
buf_country, sizeof(buf_country)/sizeof(WCHAR));
if(l_data->lang[0] && !strcmpiW(l_data->lang, buf_language))
{
@ -347,7 +347,7 @@ static BOOL CALLBACK find_language_id_proc( HMODULE hModule, LPCWSTR type,
*/
buf_en_language[0] = 0;
GetLocaleInfoW(lcid, LOCALE_SENGLANGUAGE|LOCALE_NOUSEROVERRIDE,
buf_en_language, sizeof(buf_en_language));
buf_en_language, sizeof(buf_en_language)/sizeof(WCHAR));
if(l_data->lang[0] && !strcmpiW(l_data->lang, buf_en_language)) goto found;
return TRUE; /* not found, continue search */
@ -438,7 +438,7 @@ static LANGID get_language_id(LPCSTR Lang, LPCSTR Country, LPCSTR Charset, LPCST
WCHAR buffW[128];
char buffA[128];
GetLocaleInfoW( MAKELCID( l_data.found_lang_id[i], SORT_DEFAULT ),
LOCALE_SLANGUAGE|LOCALE_NOUSEROVERRIDE, buffW, sizeof(buffW));
LOCALE_SLANGUAGE|LOCALE_NOUSEROVERRIDE, buffW, sizeof(buffW)/sizeof(WCHAR));
strcpyWtoA( buffA, buffW );
MESSAGE( " %s (%04X) - %s\n", debugstr_lang(l_data.found_lang_id[i]),
l_data.found_lang_id[i], buffA );

View File

@ -1428,7 +1428,7 @@ HRESULT WINAPI VarUdateFromDate(DATE dateIn, ULONG dwFlags, UDATE *lpUdate)
#define GET_NUMBER_TEXT(fld,name) \
buff[0] = 0; \
if (!GetLocaleInfoW(lcid, lctype|fld, buff, sizeof(WCHAR) * 2)) \
if (!GetLocaleInfoW(lcid, lctype|fld, buff, 2)) \
WARN("buffer too small for " #fld "\n"); \
else \
if (buff[0]) lpChars->name = buff[0]; \
@ -1451,7 +1451,7 @@ void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID lcid, D
/* Local currency symbols are often 2 characters */
lpChars->cCurrencyLocal2 = '\0';
switch(GetLocaleInfoW(lcid, lctype|LOCALE_SCURRENCY, buff, sizeof(WCHAR) * 4))
switch(GetLocaleInfoW(lcid, lctype|LOCALE_SCURRENCY, buff, sizeof(buff)/sizeof(WCHAR)))
{
case 3: lpChars->cCurrencyLocal2 = buff[1]; /* Fall through */
case 2: lpChars->cCurrencyLocal = buff[0];

View File

@ -652,7 +652,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
DWORD papersize;
if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER,
(LPWSTR)&papersize, sizeof(papersize))) {
(LPWSTR)&papersize, sizeof(papersize)/sizeof(WCHAR))) {
PSDRV_DEVMODEA dm;
memset(&dm, 0, sizeof(dm));
dm.dmPublic.dmFields = DM_PAPERSIZE;