oleaut32: Take lcid into account while parsing input variant in VARIANT_FormatString.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Piotr Caban 2015-11-14 13:17:39 +01:00 committed by Alexandre Julliard
parent aa71e545af
commit f9041da281
2 changed files with 24 additions and 1 deletions

View File

@ -568,6 +568,10 @@ static void test_VarFormatFromTokens(void)
static const WCHAR date[] = {'1','2','-','1','1',0};
static const WCHAR date_us[] = {'1','1','-','1','2',0};
static WCHAR string_fmt[] = {'@',0};
static const WCHAR string_de[] = {'1',',','5',0};
static const WCHAR string_us[] = {'1','.','5',0};
BYTE buff[256];
LCID lcid;
VARIANT var;
@ -615,6 +619,25 @@ static void test_VarFormatFromTokens(void)
SysFreeString(bstr);
VariantClear(&var);
V_VT(&var) = VT_R4;
V_R4(&var) = 1.5;
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
hres = VarTokenizeFormatString(string_fmt, buff, sizeof(buff), 1, 1, lcid, NULL);
ok(hres == S_OK, "VarTokenizeFormatString failed: %x\n", hres);
hres = VarFormatFromTokens(&var, string_fmt, buff, 0, &bstr, lcid);
ok(hres == S_OK, "VarFormatFromTokens failed: %x\n", hres);
ok(!strcmpW(bstr, string_us), "incorrectly formatted string: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
lcid = MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT);
hres = VarTokenizeFormatString(string_fmt, buff, sizeof(buff), 1, 1, lcid, NULL);
ok(hres == S_OK, "VarTokenizeFormatString failed: %x\n", hres);
hres = VarFormatFromTokens(&var, string_fmt, buff, 0, &bstr, lcid);
ok(hres == S_OK, "VarFormatFromTokens failed: %x\n", hres);
ok(!strcmpW(bstr, string_de), "incorrectly formatted string: %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
}
START_TEST(varformat)

View File

@ -1960,7 +1960,7 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
}
else
{
hRes = VariantChangeTypeEx(&vStr, pVarIn, LCID_US, VARIANT_NOUSEROVERRIDE, VT_BSTR);
hRes = VariantChangeTypeEx(&vStr, pVarIn, lcid, VARIANT_NOUSEROVERRIDE, VT_BSTR);
if (FAILED(hRes))
return hRes;