They are incompatible with decimal numbers and currencies.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- dlls/oleaut32/tests/vartest.c | 6 +----- dlls/oleaut32/variant.c | 5 +++-- 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index f6149005179..42e269eccb3 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -1654,12 +1654,10 @@ static void test_VarParseNumFromStrEn(void)
/* With flag, currency amounts cannot be in hexadecimal */ CONVERT("$&ha", NUMPRS_HEX_OCT|NUMPRS_CURRENCY); - todo_wine EXPECTFAIL; + EXPECTFAIL;
CONVERT("&ha$", NUMPRS_HEX_OCT|NUMPRS_CURRENCY); - if (broken(1)) /* FIXME Reenable once Wine is less broken */ EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_CURRENCY,NUMPRS_HEX_OCT,3,4,0); - todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags); EXPECTRGB(0,10); EXPECTRGB(1,FAILDIG);
@@ -1797,9 +1795,7 @@ static void test_VarParseNumFromStrEn(void)
/* With flag, incompatible with NUMPRS_HEX_OCT */ CONVERT("&o1e1", NUMPRS_HEX_OCT|NUMPRS_EXPONENT); - if (broken(1)) /* FIXME Reenable once Wine is less broken */ EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_EXPONENT,NUMPRS_HEX_OCT,3,3,0); - todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags); EXPECT2(1,FAILDIG);
/* With flag, even if it sort of looks like an exponent */ diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index 09c6f9dcad6..a3931bb1280 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -1709,7 +1709,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla break; }
- if (!(pNumprs->dwOutFlags & NUMPRS_DECIMAL)) + if (!(pNumprs->dwOutFlags & (NUMPRS_CURRENCY|NUMPRS_DECIMAL))) { if ((*lpszStr == '&' && (*(lpszStr+1) == 'H' || *(lpszStr+1) == 'h')) && pNumprs->dwInFlags & NUMPRS_HEX_OCT) @@ -1858,7 +1858,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla } else if ((*lpszStr == 'e' || *lpszStr == 'E') && pNumprs->dwInFlags & NUMPRS_EXPONENT && - !(pNumprs->dwOutFlags & NUMPRS_EXPONENT)) + !(pNumprs->dwOutFlags & (NUMPRS_HEX_OCT|NUMPRS_CURRENCY|NUMPRS_EXPONENT))) { dwState |= B_PROCESSING_EXPONENT; pNumprs->dwOutFlags |= NUMPRS_EXPONENT; @@ -2006,6 +2006,7 @@ HRESULT WINAPI VarParseNumFromStr(const OLECHAR *lpszStr, LCID lcid, ULONG dwFla pNumprs->dwOutFlags |= NUMPRS_NEG; } else if (pNumprs->dwInFlags & NUMPRS_CURRENCY && + !(pNumprs->dwOutFlags & NUMPRS_HEX_OCT) && wcsncmp(lpszStr, chars.sCurrency, chars.sCurrencyLen) == 0) { pNumprs->dwOutFlags |= NUMPRS_CURRENCY;
Only the first character matters but the extra ones should not prevent it from being used.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- 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)