From d07d4ef7991991850479930db438292d176b24a6 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Tue, 10 Aug 2021 05:12:57 +0200 Subject: [PATCH] oleaut32: Allow longer regional settings values. Only the first character matters but the extra ones should not prevent it from being used. Signed-off-by: Francois Gouget Signed-off-by: Alexandre Julliard --- dlls/oleaut32/tests/vartest.c | 2 +- dlls/oleaut32/variant.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 42e269eccb3..05efb5a888b 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -2324,7 +2324,7 @@ static void test_VarParseNumFromStrMisc(void) SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, L" \xa0"); hres = wconvert_str(L"1 000", ARRAY_SIZE(rgb), NUMPRS_THOUSANDS|NUMPRS_USE_ALL, &np, rgb, LOCALE_USER_DEFAULT, 0); - todo_wine EXPECT(1,NUMPRS_THOUSANDS|NUMPRS_USE_ALL,NUMPRS_THOUSANDS,5,0,3); + EXPECT(1,NUMPRS_THOUSANDS|NUMPRS_USE_ALL,NUMPRS_THOUSANDS,5,0,3); EXPECTRGB(0,1); /* Don't test extra digits, see "1,000" test */ EXPECTRGB(4,FAILDIG); diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index a3931bb1280..40a1170e247 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -1514,11 +1514,11 @@ typedef struct tagVARIANT_NUMBER_CHARS #define GET_NUMBER_TEXT(fld,name) \ buff[0] = 0; \ - if (!GetLocaleInfoW(lcid, lctype|fld, buff, 2)) \ + if (!GetLocaleInfoW(lcid, lctype|fld, buff, ARRAY_SIZE(buff))) \ WARN("buffer too small for " #fld "\n"); \ else \ if (buff[0]) lpChars->name = buff[0]; \ - TRACE("lcid 0x%x, " #name "=%d '%c'\n", lcid, lpChars->name, lpChars->name) + TRACE("lcid 0x%x, " #name "=%s\n", lcid, wine_dbgstr_wn(&lpChars->name, 1)) /* Get the valid number characters for an lcid */ static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID lcid, DWORD dwFlags)