From: Bernhard Übelacker bernhardu@mailbox.org
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58372 --- dlls/oleaut32/tests/varformat.c | 4 ++++ dlls/oleaut32/varformat.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/tests/varformat.c b/dlls/oleaut32/tests/varformat.c index bc3b6c175f9..05978a0d366 100644 --- a/dlls/oleaut32/tests/varformat.c +++ b/dlls/oleaut32/tests/varformat.c @@ -363,6 +363,10 @@ static void test_VarFormat(void) VARFMT(VT_R8,V_R8,1.0001e-27,"##00.0000e-0",S_OK,"1000.1000e-30"); VARFMT(VT_R8,V_R8,47.11,".0000E+0",S_OK,".4711E+2"); VARFMT(VT_R8,V_R8,3.0401e-13,"#####.####e-0%",S_OK,"30401.e-15%"); + VARFMT(VT_R8,V_R8,29.565331,"0.#####E-#",S_OK,"2.95653E1"); + VARFMT(VT_R8,V_R8,29.123456789,"0.#####E-###",S_OK,"2.91235E1"); + VARFMT(VT_R8,V_R8,29.123456789,"0.#####E-#0#0",S_OK,"2.91235E01"); + VARFMT(VT_R8,V_R8,29.123456789,"0.#####E-0#0#",S_OK,"2.91235E01"); VARFMT(VT_R8,V_R8,1.57,"0.00",S_OK,"1.57"); VARFMT(VT_R8,V_R8,-1.57,"0.00",S_OK,"-1.57"); VARFMT(VT_R8,V_R8,-1.57,"#.##",S_OK,"-1.57"); diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c index 3f69a45a897..dacdb967325 100644 --- a/dlls/oleaut32/varformat.c +++ b/dlls/oleaut32/varformat.c @@ -690,9 +690,10 @@ HRESULT WINAPI VarTokenizeFormatString(LPOLESTR lpszFormat, LPBYTE rgbTok, } pFormat += 2; *++pOut = 0x0; - while (*pFormat == '0') + while (*pFormat == '0' || *pFormat == '#') { - *pOut = *pOut + 1; + if (*pFormat == '0') + *pOut = *pOut + 1; pFormat++; } pOut++;