Fixed callers of GetLocaleInfoW to use the correct buffer size.
This commit is contained in:
parent
f39be9ff48
commit
b65d13605c
|
@ -143,8 +143,8 @@ static const char *debugstr_lang( LANGID lang )
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
LCID lcid = MAKELCID( lang, SORT_DEFAULT );
|
LCID lcid = MAKELCID( lang, SORT_DEFAULT );
|
||||||
|
|
||||||
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE, langW, sizeof(langW));
|
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE, langW, sizeof(langW)/sizeof(WCHAR));
|
||||||
GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE, countryW, sizeof(countryW));
|
GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE, countryW, sizeof(countryW)/sizeof(WCHAR));
|
||||||
strcpyWtoA( buffer, langW );
|
strcpyWtoA( buffer, langW );
|
||||||
strcat( buffer, "_" );
|
strcat( buffer, "_" );
|
||||||
strcpyWtoA( buffer + strlen(buffer), countryW );
|
strcpyWtoA( buffer + strlen(buffer), countryW );
|
||||||
|
@ -322,9 +322,9 @@ static BOOL CALLBACK find_language_id_proc( HMODULE hModule, LPCWSTR type,
|
||||||
buf_country[0] = 0;
|
buf_country[0] = 0;
|
||||||
|
|
||||||
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE,
|
GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME|LOCALE_NOUSEROVERRIDE,
|
||||||
buf_language, sizeof(buf_language));
|
buf_language, sizeof(buf_language)/sizeof(WCHAR));
|
||||||
GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
|
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))
|
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;
|
buf_en_language[0] = 0;
|
||||||
GetLocaleInfoW(lcid, LOCALE_SENGLANGUAGE|LOCALE_NOUSEROVERRIDE,
|
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;
|
if(l_data->lang[0] && !strcmpiW(l_data->lang, buf_en_language)) goto found;
|
||||||
return TRUE; /* not found, continue search */
|
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];
|
WCHAR buffW[128];
|
||||||
char buffA[128];
|
char buffA[128];
|
||||||
GetLocaleInfoW( MAKELCID( l_data.found_lang_id[i], SORT_DEFAULT ),
|
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 );
|
strcpyWtoA( buffA, buffW );
|
||||||
MESSAGE( " %s (%04X) - %s\n", debugstr_lang(l_data.found_lang_id[i]),
|
MESSAGE( " %s (%04X) - %s\n", debugstr_lang(l_data.found_lang_id[i]),
|
||||||
l_data.found_lang_id[i], buffA );
|
l_data.found_lang_id[i], buffA );
|
||||||
|
|
|
@ -1428,7 +1428,7 @@ HRESULT WINAPI VarUdateFromDate(DATE dateIn, ULONG dwFlags, UDATE *lpUdate)
|
||||||
|
|
||||||
#define GET_NUMBER_TEXT(fld,name) \
|
#define GET_NUMBER_TEXT(fld,name) \
|
||||||
buff[0] = 0; \
|
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"); \
|
WARN("buffer too small for " #fld "\n"); \
|
||||||
else \
|
else \
|
||||||
if (buff[0]) lpChars->name = buff[0]; \
|
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 */
|
/* Local currency symbols are often 2 characters */
|
||||||
lpChars->cCurrencyLocal2 = '\0';
|
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 3: lpChars->cCurrencyLocal2 = buff[1]; /* Fall through */
|
||||||
case 2: lpChars->cCurrencyLocal = buff[0];
|
case 2: lpChars->cCurrencyLocal = buff[0];
|
||||||
|
|
|
@ -652,7 +652,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
|
||||||
DWORD papersize;
|
DWORD papersize;
|
||||||
|
|
||||||
if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER,
|
if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER,
|
||||||
(LPWSTR)&papersize, sizeof(papersize))) {
|
(LPWSTR)&papersize, sizeof(papersize)/sizeof(WCHAR))) {
|
||||||
PSDRV_DEVMODEA dm;
|
PSDRV_DEVMODEA dm;
|
||||||
memset(&dm, 0, sizeof(dm));
|
memset(&dm, 0, sizeof(dm));
|
||||||
dm.dmPublic.dmFields = DM_PAPERSIZE;
|
dm.dmPublic.dmFields = DM_PAPERSIZE;
|
||||||
|
|
Loading…
Reference in New Issue