Commit 3153aa91 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

Ensure that underflowing negative float is represented as a positive

0, just as native oleaut32.
parent af2e7eb2
......@@ -4615,7 +4615,7 @@ static void test_VarBstrFromR4(void)
ok(hres == S_OK, "got hres 0x%08lx\n", hres);
if (bstr)
{
todo_wine ok(memcmp(bstr, szZero, sizeof(szZero)) == 0, "negative zero (got %s)\n", wtoascii(bstr));
ok(memcmp(bstr, szZero, sizeof(szZero)) == 0, "negative zero (got %s)\n", wtoascii(bstr));
}
}
......
......@@ -5258,6 +5258,19 @@ static HRESULT VARIANT_BstrFromReal(DOUBLE dblIn, LCID lcid, ULONG dwFlags,
return E_INVALIDARG;
sprintfW( buff, lpszFormat, dblIn );
/* Negative zeroes are disallowed (some applications depend on this).
If buff starts with a minus, and then nothing follows but zeroes
and/or a period, it is a negative zero and is replaced with a
canonical zero. This duplicates native oleaut32 behavior.
*/
if (buff[0] == '-')
{
const WCHAR szAccept[] = {'0', '.', '\0'};
if (strlenW(buff + 1) == strspnW(buff + 1, szAccept))
{ buff[0] = '0'; buff[1] = '\0'; }
}
TRACE("created string %s\n", debugstr_w(buff));
if (dwFlags & LOCALE_USE_NLS)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment